/* * @Description: USERAPP * @Version: 1.0 * @Autor: lishengyin * @Date: 2021-10-13 09:41:50 * @LastEditors: lishengyin * @LastEditTime: 2022-07-20 15:33:48 */ #pragma once #include #include // ZLMediaKit #include "Util/logger.h" #include "Util/NoticeCenter.h" #include "Poller/EventPoller.h" #include "Util/SqlPool.h" #include "Network/TcpClient.h" #include "Poller/Timer.h" #include "inifile.h" #include #include #include #include #include "inference.h" #include "DataSource.h" // dataType #include "SendLogin.h" #include "NettyServerCommandEnum.h" #include "NettyServerResultMsg.h" #include "NettyClientResultMsg.h" #include "SendLogin.h" #include "NettyClientCommandEnum.h" #include "InferData.h" #include "CrowdednessConfig.h" #include "CrowdednessTimeConfig.h" #include "SendPassengerFlow.h" #include "CNStreamInferData.h" #include "SendCarData.h" #include "Notices.h" #include "HttpClient.h" #include "recorder.h" #include "Cleaner.h" #include "monitor.h" #include "deviceState.h" #include "Manager.h" #include #include "Disposition.hpp" #include "ExpelControler.hpp" #include #include using namespace toolkit; using namespace std; namespace gsd_ds { class UserApp { public: /** * @description: 创建对象 * @param {*} * @return {std::shared_ptr} 智能指针 * @author: lishengyin */ static std::shared_ptr CreateNew(); UserApp(); ~UserApp(); /** * @description: 模块初始化 * @param {string} appName 应用名 * @return {int} 是否成功 * @author: lishengyin */ int32_t Init(std::string appName); /** * @description: 释放数据 * @param {*} * @return {*} * @author: lishengyin */ void Destroy(); /** * @description: 启动任务 * @param {*} * @return {*} * @author: lishengyin */ void StartTask(); /** * @description: 赋值struct sockaddr * @param {sockaddr} *out * @param {char} *ip * @param {uint16_t} port * @return {*} * @author: lishengyin */ static void makeAddr(struct sockaddr *out,const char *ip,uint16_t port); /** * @description: 监听推理模块广播 * @param {int} Source_id 数据源ID * @param {CNStreamInferData} 推理指针 * @return {*} * @author: lishengyin */ void ListenInfer(int Source_id, CNStreamInferData::Ptr data); /** * @description: 监听推理模块广播 */ void ExperControler(int Source_id, int num); /** * @description: 启动推理 * @return {*} */ void StartInfer(); private: std::string m_appName; int device_id; Timer::Ptr m_timer1; // Infer推理 std::shared_ptr m_Infer = nullptr; // Infer数据 std::shared_ptr m_InferInfo = nullptr; HttpClient::Ptr m_httpClient = nullptr; // 驱鸟设备状态 bool m_DevPowerState = false; bool stop = false; std::condition_variable condition; std::mutex m_mutex; private: /** * 上报推理数据到Netty * @param {*} * @return {*} */ void ReportInferData(); /** * 监听数据 * @param {*} * @return {*} */ void MonitorData(); }; }