#ifndef GLOBALDEFINE_H #define GLOBALDEFINE_H #include #include class LedCard { public: QString id; QString ip; int mWidth{0}; int mHeight{0}; int bright{100}; int BrightnessLevel{255}; QString FirmwareVersion; QString HardVersion = "0000"; QString ScreenResolution; QString androidVersion; QString alias; bool hasPassword{false}; bool isLocked{true}; bool isScreenOn{true}; bool isOnline{true}; }; enum { MainPage_DeviceManager = 0, MainPage_ProgManager, MainPage_Setting, MainPage_LoraScreen, MainPage_End, }; struct RESTORE_IP { char cNewIp[20]; char cMask[20]; char cGateway[20]; char cDns[20]; }; struct UDPPacket { unsigned char SyncHead[3]; unsigned char ucCommType; char serialCode[20]; unsigned int iLength; }; struct STREAM_PACKET { unsigned char SyncHead[3]; unsigned char ucCommType; char ucSerialCode[20]; unsigned int iLength; char pDataBuffer[2049]; }; struct ST_ANSY_PROGRAM_PACKET { unsigned char SyncHead[3]; unsigned char ucCommType; int iBaoLiu; unsigned int iLength; unsigned char pDataBuffer[20]; }; enum _NET_COMMU_TYPE { COMMAND_SAVE_ADVANCE_PARAM_NOT_RESET=0x40, COMMAND_ONLY_RESET_CARD_IP=0X43, COMMAND_SET_M31_DOUBLE_HUB=0X44, COMMAND_CONNECT_COLSE =0x7A, COMMAND_UPGRADE = 0x80, COMMAND_SIGNLE_FILE_UPGRADE , COMMAND_LOOPCHECK , COMMAND_VERIFY_CLOCK , COMMAND_SCREEN_OPERATOR,//0x84 COMMAND_SET_SERIAL_NUM, NET_COMMU_TYPE_PLAY_IN_LINE , // 网络同步在线播放. NET_COMMU_TYPE_PREVIEW_IN_LINE, // 网络在线预览. NET_COMMU_TYPE_UPGRADE_SYSTEM, // 系统升级. NET_COMMU_TYPE_RECOVER_SYSTEM, // 系统还原到上一次正确的启动. SCREEN_OPERATOR_COMM_PARAMS_SAVE, // 参数保存. NET_COMMU_TYPE_COMM_EXIT,//普通退出,不重启 NET_COMMU_TYPE_AUDIO_PLAY,//0X8C NET_COMMU_TYPE_IO, NET_COMMU_TYPE_IO_CHECK, NET_COMMU_TYPE_LIMITE_TIME, NET_COMMU_TYPE_SYSTEM_BROADCAST,//0X90 NET_COMMU_TYPE_REALTIME_INSERT_PLAY, NET_COMMU_TYPE_MODIFY_SERIAL_ID, NET_COMMU_TYPE_KERNEL_UPGRADE_SYSTEM, NET_COMMU_TYPE_UPGRADE_FINISHED_EXIT, NET_COMMU_TYPE_REAL_TIME_INSERT_PLAY_WITH_LIST_EXIT, NET_COMMU_TYPE_ZNSZ,// 智能设置命令. NET_COMMU_TYPE_SELECT_PROGRAM_PLAY,// 选节目播放.0x97 NET_COMMU_TYPE_SELECT_MULI_PROGRAM_PLAY,//98选播多个节目 NET_COMMU_TYPE_GET_PROGRAM_NAME,//99获取所有节目的名称 NET_COMMU_TYPE_GET_CUR_PLAY_STATUS,//9a查询当前播放的详细信息 NET_COMMU_TYPE_POWER_PANEL_ON_OR_OFF,//9b开关大屏幕 NET_COMMU_TYPE_ADJUST_BRIGHTNESS,//9c调节亮度 NET_COMMU_TYPE_GET_SYSTEM_STATUS,//9d获取系统状态 NET_COMMU_TYPE_VERIFY_SIGN,//校验签名9e NET_COMMU_TYPE_SET_WEB_SERVER_PARAM,//配置web服务器参数 NET_COMMU_TYPE_GET_WEB_SERVER_PARAM,//a0 NET_COMMU_TYPE_SET_WIFI_PARAM,//a1配置wifi参数 NET_COMMU_TYPE_GET_WIFI_PARAM,//a2获取wifi参数 NET_COMMU_TYPE_SCAN_AP_WIFI_PARAM,//a3获取ap热点的名称 NET_COMMU_TYPE_GET_ANDROID=0xa4, NET_COMMU_TYPE_INSTALL_APK=0xa5, NET_COMMU_TYPE_UNINSTALL_APK=0xa6, NET_COMMU_TYPE_SET_DNS=0xa7, NET_COMMU_TYPE_GET_DNS=0xa8, NET_COMMU_TYPE_SET_PROXY=0xa9, NET_COMMU_TYPE_GET_PROXY=0xaa, NET_COMMU_TYPE_SET_ANDROID_COMMUNICATION=0xab, NET_COMMU_TYPE_GET_ANDROID_COMMUNICATION=0xac, NET_COMMU_TYPE_GET_SIM_STATUS=0xad, NET_COMMU_TYPE_GET_APN_PARAM=0xae, NET_COMMU_TYPE_GET_APK_VERSION=0xaf, NET_COMMU_TYPE_SET_REALTIME_PARAM=0xb0, NET_COMMU_TYPE_GET_REALTIME_PARAM=0xb1, NET_COMMU_TYPE_SET_REALTIME_LINSTEN_PARAM=0xb2, NET_COMMU_TYPE_GET_REALTIME_LINSTEN_PARAM=0xb3, NET_COMMU_TYPE_SET_HUAWEI_4G=0xB4, NET_COMMU_TYPE_GET_HUAWEI_4G=0xB5, NET_COMMU_TYPE_CLEAR_ANDROID_PROGRAM=0xB6, NET_COMMU_TYPE_SET_AP_PARAM=0xB7, NET_COMMU_TYPE_GET_AP_PARAM=0xB8, GET_REALY_RESOLUTION=0xB9, GET_REALY_ANDROID_FIRMWARE_INFO=0xBA, NET_COMMU_TYPE_NUM, COMMAND_UPGRADE_ANSWER =0xC0, COMMAND_SIGNLE_FILE_UPGRADE_ANSWER , COMMAND_LOOPCHECK_ANSWER , COMMAND_VERIFY_CLOCK_ANSWER , COMMAND_SCREEN_OPERATOR_ANSWER, COMMAND_SET_SERIAL_NUM_ANSWER, NET_COMMU_TYPE_PLAY_IN_LINE_ANSWER , // 网络同步在线播放. NET_COMMU_TYPE_PREVIEW_IN_LINE_ANSWER, // 网络在线预览. NET_COMMU_TYPE_UPGRADE_SYSTEM_ANSWER, // 系统升级. NET_COMMU_TYPE_RECOVER_SYSTEM_ANSWER, // 系统还原到上一次正确的启动. SCREEN_OPERATOR_COMM_PARAMS_SAVE_ANSWER, NET_COMMU_TYPE_COMM_EXIT_ANSWER, NET_COMMU_TYPE_AUDIO_PLAY_ANSWER,//0XcC NET_COMMU_TYPE_IO_ANSWER, NET_COMMU_TYPE_IO_CHECK_ANSWER, NET_COMMU_TYPE_LIMITE_TIME_ANSWER, NET_COMMU_TYPE_SYSTEM_BROADCAST_ANSWER, NET_COMMU_TYPE_REALTIME_INSERT_PLAY_ANSWER, NET_COMMU_TYPE_REALTIME_INSERT_PLAY_WITH_GLINT_ANSWER , //带闪烁功能的实时插播 NET_COMMU_TYPE_KERNEL_UPGRADE_SYSTEM_ANSWER, NET_COMMU_TYPE_UPGRADE_FINISHED_EXIT_ANSWER,//0xd4 NET_COMMU_TYPE_REAL_TIME_INSERT_PLAY_WITH_LIST_EXIT_ANSWER, NET_COMMU_TYPE_ZNSZ_ANSWER,// 智能设置命令. NET_COMMU_TYPE_SELECT_PROGRAM_PLAY_ANSWER,//0x97 选节目播放. NET_COMMU_TYPE_SELECT_MULI_PROGRAM_PLAY_ANSWER, NET_COMMU_TYPE_GET_PROGRAM_NAME_ANSWER, NET_COMMU_TYPE_GET_CUR_PLAY_STATUS_ANSWER, NET_COMMU_TYPE_POWER_PANEL_ON_OR_OFF_ANSWER, NET_COMMU_TYPE_ADJUST_BRIGHTNESS_ANSWER, NET_COMMU_TYPE_GET_SYSTEM_STATUS_ANSWER,//获取系统状态 NET_COMMU_TYPE_NUM_ANSWER, COMMAND_CONNECT_COLSE_ANSWER }; class DevicePanel; extern DevicePanel *gDevicePanel; extern QList gSelCards; extern bool gVideoCompress; extern bool gVideoTranscoding; extern bool gTextAntialiasing; extern bool gShowLoraScreen; extern bool gWidthSplit; extern quint64 dirFileSize(const QString &path); extern bool copyDir(const QString &source, const QString &destination, bool override); extern unsigned char GetCheckCodeIn8(unsigned char * pBuffer,unsigned int uiSize); enum _ENUM_CONTRL_WIDGET { Setting_Bright=0, Setting_PowerControl, Setting_NetCfg, Setting_VerifyClock, Setting_Encrypt, Setting_HDMI, Setting_Volume, Setting_Advanced, Setting_Test, Setting_End, }; class DeviceItem; extern DeviceItem *findItem(QString id); QString replyErr(QNetworkReply *); QString checkReply(QNetworkReply *, QJsonDocument * = 0); QString checkReplyForJson(QNetworkReply *, QJsonDocument * = 0, QByteArray * = 0); #define Def_CtrlReqPre \ waitingDlg->show();\ auto card = gSelCards[0];\ auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);\ waitingDlg->connAbort(reply); #define Def_CtrlSetReqAfter \ QString err = checkReplyForJson(reply);\ if(! err.isEmpty()) {\ waitingDlg->close();\ QMessageBox::critical(this, tr("Error"), err);\ return;\ }\ waitingDlg->success(); #define Def_CtrlSingleGetReply \ QJsonDocument json;\ QString err = checkReplyForJson(reply, &json);\ if(! err.isEmpty()) {\ waitingDlg->close();\ QMessageBox::critical(this, tr("Error"), err);\ return;\ } #define Def_CtrlSetMulti(tip) \ auto reply = NetReq("http://"+card.ip+":2016/settings").timeout(120000).post(json);\ connect(reply, &QNetworkReply::finished, gFdResInfo, [=] {\ QString err = checkReplyForJson(reply);\ gFdResInfo->append(card.id+" "+tip+" "+(err.isEmpty()?QCoreApplication::translate("Def","Success"):err));\ }); #endif // GLOBALDEFINE_H