123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- /*
- * @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 <iostream>
- #include <signal.h>
- // 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 <gst/gst.h>
- #include <vector>
- #include <map>
- #include <time.h>
- #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 <httplib.h>
- #include "Disposition.hpp"
- #include "ExpelControler.hpp"
- #include <condition_variable>
- #include <mutex>
- using namespace toolkit;
- using namespace std;
- namespace gsd_ds
- {
- class UserApp
- {
- public:
- /**
- * @description: 创建对象
- * @param {*}
- * @return {std::shared_ptr<UserApp>} 智能指针
- * @author: lishengyin
- */
- static std::shared_ptr<UserApp> 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<Inference> m_Infer = nullptr;
- // Infer数据
- std::shared_ptr<InferInfo> 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();
- };
- }
|