// // Created by ps on 19-3-1. // #ifndef GB28181SDK_GB28181SERVER_H #define GB28181SDK_GB28181SERVER_H #include #include #include #include #include #include #include #include #include #include #include #include #include "28181SDK.h" #include "SpinLock.hpp" struct MysqlDBServerCfg { std::string Host; //连接数据库的ip地址 int Port;//连接数据库的端口 std::string UserName;//连接数据库的用户名 std::string Passwd;//连接数据库的密码 std::string DBName;//连接数据库的表名 int DBConnCount;//连接数据库的数量 }; struct GBServerCfg { std::string SvrIp; // 国标服务的ip地址 (本机的ip地址) std::string SvrNatIp; //注意: 此处如果没有穿网ip地址不需要配置 (一般部署公网时使用) int SvrPort; // 国标服务监听的端口 std::string SvrPubID; // 国标服务器的ID bool bMD5Auth; // 是否需要MD5加密 std::string UserName;// 国标服务的用户名 (下级设备注册的用户名) std::string Passwd; // 国标服务的密码 (下级设备注册的密码) int SubScribeTime; // 订阅时间 如果为0 表示不订阅 }; struct UpperPFCfg { std::string Name; std::string PublicID; std::string AuthUserName; std::string AuthPasswd; std::string IpAddr; int Port; int RegisterItv; int KeepAliveItv; }; class GB28181Server { public: GB28181Server(); virtual ~GB28181Server(); void setMysqlConnParam(const MysqlDBServerCfg &_MysqlConnParam); void setGBServerParam(const GBServerCfg &_GBServerParam); void setUpperPlatform(const UpperPFCfg &_upperinfo); bool initServer(); private: // mysql数据库的配置信息 MysqlConnParam_T MysqlConnParam; // 国标服务的配置信息 GBServerParam_T GBServerParam; UpperPlatform_T upperinfo; static bool bGetLoaclRes; private: //打印事件回调信息 static void enventcallback(int eventtype, int eventparam, int datalen, char *data) { printf("eventtype:%d, eventparam:%d, datalen:%d, data:%s\n", eventtype, eventparam, datalen, data); if (eventtype == 2) { // GB28181Server::bGetLoaclRes = true; } else if (eventtype == 1 && eventparam == 1) { C_GetResource(NULL); } } }; #endif //GB28181SDK_GB28181SERVER_H