78 lines
2.2 KiB
C++
78 lines
2.2 KiB
C++
|
|
#ifndef GLOBAL_HPP_
|
|||
|
|
#define GLOBAL_HPP_
|
|||
|
|
#include <string.h>
|
|||
|
|
#include <stdio.h>
|
|||
|
|
#include <unistd.h>
|
|||
|
|
#include <boost/date_time/posix_time/posix_time.hpp>
|
|||
|
|
#include <sys/syscall.h>
|
|||
|
|
#include <signal.h>
|
|||
|
|
#include "../API_log/SH_log.h"
|
|||
|
|
#include "SH_CommonFunc.hpp"
|
|||
|
|
#include "../mqttclient/SH_MqttClient.h"
|
|||
|
|
#include "../minilzo-2.10/minilzo.h"
|
|||
|
|
|
|||
|
|
|
|||
|
|
#define SECTION_MAX_LEN 1024
|
|||
|
|
//******************** 全局变量**********************
|
|||
|
|
enum enumZigBeeTransmitStatus {
|
|||
|
|
NO_ENTER_TRANSMITTING_STATUS = 0,
|
|||
|
|
ENTER_TRANSMITTING_STATUS
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
|
|||
|
|
//#define NR5G_MODULE
|
|||
|
|
//#define Q4G_MODULE
|
|||
|
|
//#define WIFI_MODULE
|
|||
|
|
//#define NR5G_MEIGE
|
|||
|
|
#define G2UL_GATEWAY
|
|||
|
|
//#define IMX6UL_GATEWAY
|
|||
|
|
|
|||
|
|
class GlobalConfig
|
|||
|
|
{
|
|||
|
|
public :
|
|||
|
|
static int RUN_MODE; //1调试模式 0运行模式
|
|||
|
|
static int QuitFlag_G; //程序退出标志
|
|||
|
|
static int LinkStatus_G; //和服务器连接状态
|
|||
|
|
static int LinkCount;
|
|||
|
|
static int NetSignal;
|
|||
|
|
static int serverStatus;
|
|||
|
|
static int net0Status;
|
|||
|
|
static std::string NR5GTemp;
|
|||
|
|
static std::string NetStatus;
|
|||
|
|
static std::string NetType;
|
|||
|
|
static std::string Version; //软件版本号
|
|||
|
|
static std::string MacAddr_G; //设备MAC地址
|
|||
|
|
static std::string MacAddr_G2; //设备光纤MAC地址
|
|||
|
|
static std::string IpAddr_G; //设备IP
|
|||
|
|
static std::string DbName_G; //数据库名字
|
|||
|
|
static std::string Config_G; //配置文件
|
|||
|
|
static std::string ServerIP; //服务器地址
|
|||
|
|
static int ServerPort; //服务器端口
|
|||
|
|
static int threadStatus;
|
|||
|
|
static std::string UartName_G;
|
|||
|
|
static TopicList Topic_G; //发布的主题
|
|||
|
|
static ZigbeeInfo ZigbeeInfo_G; //gateway zigbee info
|
|||
|
|
static ZIGBEE Zigbee_G;
|
|||
|
|
static GPIOInfo GPIO_G;
|
|||
|
|
static enumZigBeeTransmitStatus EnterZigBeeWaveTransmittingFlag_G; // 进入ZigBee网络原始数据传输状态标志
|
|||
|
|
static int EnterZigBeeWaveTransmittingCnt_G; // 进入ZigBee网络原始数据传输状态计数器,以秒为单位进行计数
|
|||
|
|
static int day;
|
|||
|
|
|
|||
|
|
};
|
|||
|
|
|
|||
|
|
#ifdef IMX6UL_GATEWAY
|
|||
|
|
#define SAVE_COUNT 4320
|
|||
|
|
#define OneWeek 432000 //5天
|
|||
|
|
#endif
|
|||
|
|
#ifdef G2UL_GATEWAY
|
|||
|
|
#define SAVE_COUNT 4800*4
|
|||
|
|
#define OneWeek 604800*7
|
|||
|
|
#endif
|
|||
|
|
|
|||
|
|
//按8 取整
|
|||
|
|
#define Length_(len) do{ \
|
|||
|
|
len = ((((len>>3) + ((len&0x7)>0?1:0))<<4) + 8); \
|
|||
|
|
} while (0)
|
|||
|
|
|
|||
|
|
#endif
|