2021-09-18 13:45:24 +08:00
|
|
|
|
#ifndef _COMMONFUNC_
|
|
|
|
|
#define _COMMONFUNC_
|
|
|
|
|
|
|
|
|
|
#include <stdio.h>
|
|
|
|
|
#include <unistd.h>
|
|
|
|
|
#include <sys/socket.h>
|
|
|
|
|
#include <netinet/in.h>
|
|
|
|
|
#include <net/if.h>
|
|
|
|
|
#include <stdlib.h>
|
|
|
|
|
#include <memory.h>
|
|
|
|
|
#include <string>
|
|
|
|
|
#include <list>
|
|
|
|
|
#include <boost/algorithm/string/split.hpp>
|
|
|
|
|
#include <boost/thread/mutex.hpp>
|
|
|
|
|
#include <boost/algorithm/string/classification.hpp>
|
|
|
|
|
#include <iostream>
|
|
|
|
|
#include <fstream>
|
|
|
|
|
#include <arpa/inet.h>
|
|
|
|
|
#include <sys/ioctl.h>
|
|
|
|
|
#include <boost/lexical_cast.hpp>
|
|
|
|
|
#include <sys/statfs.h>
|
|
|
|
|
#include <json/json.h>
|
|
|
|
|
#include <sys/mman.h>
|
|
|
|
|
#include <fcntl.h>
|
|
|
|
|
#include <memory.h>
|
|
|
|
|
#include <sys/ipc.h>//ipc
|
|
|
|
|
#include <sys/shm.h>
|
|
|
|
|
#include "dirent.h"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//配置文件位置
|
|
|
|
|
#define NETWORK "/etc/network/interfaces"
|
|
|
|
|
#define SYSTEMINFOFILE "/opt/configenv/SystemInfo.json" //系统信息
|
|
|
|
|
#define SERVERCONFIG "/opt/configenv/ServerConfig.json"
|
|
|
|
|
#define NETWORKCONFIG "/opt/configenv/NetWorkConfig.json"
|
|
|
|
|
#define SOFTWARE_RUN_LOG "/opt/configenv/cidn.log"
|
|
|
|
|
#define BOARDTYPE "/opt/configenv/boardtype" //设备类型
|
|
|
|
|
#define ZIGBEECONFIG "/opt/configenv/ZigbeeConfig.json"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#define SN "/opt/system/sn" //设备序列号
|
|
|
|
|
#define SYSTEMSTART "/opt/system/start" //系统启动类型标志 0:正常启动 1:重启 2:
|
2021-10-11 09:33:47 +08:00
|
|
|
|
#define BUILD_UINT16(x,y) (((x & 0x00FFu) << 8u) | (y & 0x00FFu))
|
2021-09-18 13:45:24 +08:00
|
|
|
|
#define GENERAL_BUF_SIZE 128*1024
|
|
|
|
|
|
|
|
|
|
using namespace std;
|
|
|
|
|
|
|
|
|
|
enum TIME_SIZE{
|
|
|
|
|
TIME_MINUTE=5,
|
|
|
|
|
TIME_SECEOND=8
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct DevData{
|
|
|
|
|
char mData[128];
|
|
|
|
|
char mDataMing[128];
|
|
|
|
|
int mLen;
|
|
|
|
|
DevData():mLen(0){
|
|
|
|
|
memset(mData, 0, 128);
|
|
|
|
|
memset(mDataMing, 0, 128);
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct DevDataOfGwid{
|
|
|
|
|
std::string mDevdata;
|
|
|
|
|
std::string mDevid;
|
|
|
|
|
bool mIsSimulate;
|
|
|
|
|
DevDataOfGwid():mDevdata(""),mDevid(""),mIsSimulate(false){
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef void (*onReceiveUart) (DevDataOfGwid &devData);
|
|
|
|
|
|
|
|
|
|
struct sys_data {
|
|
|
|
|
char data[10240];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int total;
|
|
|
|
|
int count;
|
|
|
|
|
int type;
|
|
|
|
|
int number;
|
|
|
|
|
int flag;
|
|
|
|
|
char channelId[16];
|
|
|
|
|
char SensorEngineeringUnit[32];
|
|
|
|
|
float waveData[32000];
|
|
|
|
|
} WAVE_CONTAIN;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct ZigbeeInfo {
|
|
|
|
|
int DevMode;
|
|
|
|
|
int Channel;
|
|
|
|
|
std::string PanID;
|
|
|
|
|
std::string MyAddr;
|
|
|
|
|
std::string DstAddr;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct ZIGBEE {
|
|
|
|
|
char reserve[4];
|
|
|
|
|
char DevName[16];
|
|
|
|
|
char DevPwd[16];
|
|
|
|
|
unsigned char DevMode;
|
|
|
|
|
unsigned char Chan;
|
|
|
|
|
short PanID;
|
|
|
|
|
short MyAddr;
|
|
|
|
|
unsigned char MyIEEE[8];
|
|
|
|
|
short DstAddr;
|
|
|
|
|
unsigned char DstIEEE[8];
|
|
|
|
|
unsigned char Reserve0;
|
|
|
|
|
unsigned char PowerLevel;
|
|
|
|
|
unsigned char RetryNum;
|
|
|
|
|
unsigned char TranTimeout;
|
|
|
|
|
unsigned char Serial_Rate;
|
|
|
|
|
unsigned char Serial_DataB;
|
|
|
|
|
unsigned char Serial_StopB;
|
|
|
|
|
unsigned char Serial_ParityB;
|
|
|
|
|
unsigned char Reserve[10];
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct RecvData {
|
|
|
|
|
unsigned char Head[3];
|
|
|
|
|
unsigned char ShortAddr[2];
|
|
|
|
|
unsigned char Type;
|
|
|
|
|
unsigned char Order;
|
|
|
|
|
unsigned char Data[92];
|
|
|
|
|
unsigned char Crc;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct DataNodeInfo {
|
|
|
|
|
int InitFlag;
|
|
|
|
|
int AccFlag;
|
|
|
|
|
int ZigbeeFlag;
|
|
|
|
|
int TemTopFlag;
|
|
|
|
|
int TemBotFlag;
|
|
|
|
|
int EquipSta;//设备状态
|
|
|
|
|
std::string HardVersion;
|
|
|
|
|
std::string SoftVersion;
|
|
|
|
|
std::string BpNo;
|
|
|
|
|
std::string SerialNo;
|
|
|
|
|
std::string FirstPowerTime;
|
|
|
|
|
int ConfigFlag;
|
|
|
|
|
std::string StartBrands;
|
|
|
|
|
std::string StopBrands;
|
|
|
|
|
unsigned int FeatureInterVal;
|
|
|
|
|
unsigned int WaveInterVal;
|
|
|
|
|
int SamplingRate;//采样率
|
|
|
|
|
int Range;//量程
|
|
|
|
|
std::string EnvelopeBandPass;
|
|
|
|
|
std::string FaultFrequency;
|
|
|
|
|
std::string ZigbeePanId;
|
|
|
|
|
int ZigbeeChannel;
|
|
|
|
|
std::string ZigbeeShortAddr;
|
|
|
|
|
std::string ZigbeeLongAddr;
|
|
|
|
|
std::string ZigbeeDesAddr;
|
|
|
|
|
std::string ConfigDate;
|
|
|
|
|
int VIntegralFilterFrequency;//速度积分滤波频率
|
|
|
|
|
|
|
|
|
|
int RSSI; // 接收信号强度
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct DataRecvStatic {
|
|
|
|
|
float TemTop;
|
|
|
|
|
float TemBot;
|
|
|
|
|
int Dip;
|
|
|
|
|
int Voltage;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct DataRecvDym {
|
|
|
|
|
float DiagnosisPk;
|
|
|
|
|
float IntegratPk;
|
|
|
|
|
float IntegratRMS;
|
|
|
|
|
float RmsValues;
|
|
|
|
|
float EnvelopEnergy;
|
|
|
|
|
float Amp1;
|
|
|
|
|
float Amp2;
|
|
|
|
|
float Amp3;
|
|
|
|
|
float Amp4;
|
|
|
|
|
float Amp5;
|
|
|
|
|
float Phase1;
|
|
|
|
|
float Phase2;
|
|
|
|
|
float Phase3;
|
|
|
|
|
float Phase4;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct TopicList{
|
|
|
|
|
std::string mPubData; //每秒特征数据上传主题
|
|
|
|
|
std::string mPubStatus; //状态上传主题
|
|
|
|
|
std::string mPubHeart;
|
|
|
|
|
std::string mPubConfig; //上传配置主题
|
|
|
|
|
std::string mSubData; //订阅主题
|
|
|
|
|
std::string mPubWaveData; //原始数据发布主题
|
|
|
|
|
std::string mPubWaveSecondData; //原始数据发布主题
|
|
|
|
|
std::string mPubCmd; //命令控制发布主题
|
|
|
|
|
std::string mPubRep;
|
|
|
|
|
|
|
|
|
|
std::string mPubLocalWifi;
|
|
|
|
|
std::string mPubLocalWaveServer;
|
|
|
|
|
std::string mPubLocalWaveQt;
|
|
|
|
|
std::string mPubLocalTrigger;
|
|
|
|
|
std::string mPubLocalConfig;
|
|
|
|
|
std::string mPubLocalCmd;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//系统描述文件数据定义
|
|
|
|
|
typedef struct
|
|
|
|
|
{
|
|
|
|
|
string siteID; //Unique ID for each site
|
|
|
|
|
string siteName; //Controller site name
|
|
|
|
|
string siteCountry; //Controller location country
|
|
|
|
|
string siteProvince; //province
|
|
|
|
|
string siteCity; //city
|
|
|
|
|
double siteLongitude; //longitude
|
|
|
|
|
double siteLatitude; //latitude
|
|
|
|
|
string siteTimeZone;
|
|
|
|
|
string plantName; //Unique plant number
|
|
|
|
|
string plantNo;
|
|
|
|
|
string equipmentName; //Equipment Description in the plant
|
|
|
|
|
string equipmentNo;
|
|
|
|
|
string dataWatchName; //DNS Name for the DataWatch
|
|
|
|
|
long dataWachAddedDate; //Date of settings’ creation (Time Stamp)
|
|
|
|
|
string dataWatchAssetID; //Unique equipment Asset ID
|
|
|
|
|
string deviceType;
|
|
|
|
|
string dataWachAddedBy; //User who edited settings
|
|
|
|
|
string serialNumber;
|
|
|
|
|
string softVersion;
|
|
|
|
|
|
|
|
|
|
}SystemInfo;
|
|
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
|
int number;
|
|
|
|
|
std::string SensorEngineeringUnit;
|
|
|
|
|
float waveData[GENERAL_BUF_SIZE];
|
|
|
|
|
} WAVE_GENERAL;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_01 {
|
|
|
|
|
int mMode; //0:登陆 1:更改密码
|
|
|
|
|
std::string mUserName;
|
|
|
|
|
std::string mPassWord;
|
|
|
|
|
std::string mPassWordNew;
|
|
|
|
|
Param_01():mMode(0), mUserName(""), mPassWord(""), mPassWordNew(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_02 {
|
|
|
|
|
int mMode; //0:配置时间 1:获取时间
|
|
|
|
|
int mTimeStamp;
|
|
|
|
|
Param_02():mMode(0),mTimeStamp(0){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_20 {
|
|
|
|
|
int mMode; //0: 配置 1:获取
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mDataWatchName;
|
|
|
|
|
std::string mDataWatchAssetId;
|
|
|
|
|
std::string mDataWatchAddedBy;
|
|
|
|
|
Param_20():mMode(0), mCmdSerial(""), mDataWatchName(""), mDataWatchAssetId(""), mDataWatchAddedBy(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_22 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mTimeZone;
|
|
|
|
|
Param_22():mMode(0),mCmdSerial(""), mTimeZone(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_23 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mServerIp;
|
|
|
|
|
std::string mPort;
|
|
|
|
|
std::string mCommMode; // 通信模式,有线通信模式 = 1;4G LTE 无线通信模式 = 2
|
|
|
|
|
Param_23():mMode(0),mCmdSerial(""), mServerIp(""),mPort(""),mCommMode(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_24 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mFileServerIp;
|
|
|
|
|
std::string mFilePort;
|
|
|
|
|
std::string mFileServerSwitch;
|
|
|
|
|
Param_24():mMode(0),mCmdSerial(""), mFileServerIp(""),mFilePort(""),mFileServerSwitch(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_25 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mDnsName;
|
|
|
|
|
std::string mNetworkPortStatus;
|
|
|
|
|
std::string mGateway;
|
|
|
|
|
std::string mSubnetMask;
|
|
|
|
|
std::string mIp;
|
|
|
|
|
std::string mHostName;
|
|
|
|
|
Param_25():mMode(0),mCmdSerial(""), mDnsName(""),mGateway(""),mSubnetMask(""),mIp(""),mHostName(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_26 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mDataNodeNo;
|
|
|
|
|
Param_26():mMode(0),mCmdSerial(""),mDataNodeNo(""){};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_27 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mDataNodeNo;
|
|
|
|
|
Param_27():mMode(0),mCmdSerial(""),mDataNodeNo(""){};
|
|
|
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
struct Param_28 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mDataNodeNo;
|
|
|
|
|
std::string mDataNodeName;
|
|
|
|
|
Param_28():mMode(0),mDataNodeNo(""),mDataNodeName(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_29 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mChannelId;
|
|
|
|
|
std::string mDataNodeNo;
|
|
|
|
|
int mPackageFlag;
|
|
|
|
|
Param_29():mMode(0),mCmdSerial(""),mChannelId(""),mDataNodeNo(""),mPackageFlag(0){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_30 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mChannelId;
|
|
|
|
|
std::string mDataNodeNo;
|
|
|
|
|
int mPackageFlag;
|
|
|
|
|
Param_30():mMode(0),mChannelId(""),mDataNodeNo(""),mPackageFlag(0){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_31 {
|
|
|
|
|
int mMode;
|
|
|
|
|
//int mChannelId;
|
|
|
|
|
std::string mChannelId;
|
|
|
|
|
Param_31():mMode(0),mChannelId(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_32 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mChannelId;
|
|
|
|
|
int mPackageFlag;
|
|
|
|
|
Param_32():mMode(0),mChannelId(""),mPackageFlag(0){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_33 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mUnit;
|
|
|
|
|
Param_33():mMode(0),mUnit(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_34 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mBeforeTime;
|
|
|
|
|
std::string mAfterTime;
|
|
|
|
|
Param_34():mMode(0),mBeforeTime(""),mAfterTime(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_35 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mTriggerInterValTime;
|
|
|
|
|
std::string mTriggerInterValSwitch;
|
|
|
|
|
Param_35():mMode(0),mTriggerInterValTime(""),mTriggerInterValSwitch(){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_36 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mTriggerTime;
|
|
|
|
|
std::string mTriggerTimeSwitch;
|
|
|
|
|
Param_36():mMode(0),mTriggerTime(""),mTriggerTimeSwitch(){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_37 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mTriggerDelayTime;
|
|
|
|
|
std::string mTriggerDelaySwitch;
|
|
|
|
|
Param_37():mMode(0),mTriggerDelayTime(""),mTriggerDelaySwitch(){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_39 {
|
|
|
|
|
int mMode;
|
|
|
|
|
int mPage;
|
|
|
|
|
int mNumber;
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_45 {
|
|
|
|
|
int mMode; //0: 配置 1:获取
|
|
|
|
|
std::string mCmdSerial;
|
|
|
|
|
std::string mCountryId;
|
|
|
|
|
std::string mProvincesId ;
|
|
|
|
|
std::string mCityListId;
|
|
|
|
|
Param_45():mMode(0),mCmdSerial(""), mCountryId(""),mProvincesId(""),mCityListId(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_46 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mFileName;
|
|
|
|
|
Param_46():mMode(0),mFileName(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
struct Param_47 {
|
|
|
|
|
int mMode;
|
|
|
|
|
std::string mFileName;
|
|
|
|
|
Param_47():mMode(0),mFileName(""){};
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 系统运行时输入入参进行系统软件版本查询
|
|
|
|
|
* @param argv 输入参数 -vV版本查询 --debugmode日志调试模式
|
|
|
|
|
* @return 函数返回0执行成功
|
|
|
|
|
*/
|
|
|
|
|
extern int CheckFileVersion(int argc, char** argv);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取当前实时时间
|
|
|
|
|
* @return 时间string 例:2018-11-18 17:16:10
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetCurrentTime();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 和系统交互函数
|
|
|
|
|
* @param cmd 要发出的系统命令 例:ls
|
|
|
|
|
* @param buf 系统返回的数据存在buf里
|
|
|
|
|
* @return -1:失败 0:成功
|
|
|
|
|
*/
|
|
|
|
|
extern int system_custom(const char *cmd, char *buf);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//extern int uartreadhandle();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 向日志写入内存信息
|
|
|
|
|
*/
|
|
|
|
|
extern void WriteMemoryInfo();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取当前日期
|
|
|
|
|
* @return 当前日期的string
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetDayDate();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取当前时间 例 12:00
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
extern void GetTime_(char * time_buff,TIME_SIZE len) ;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取当前时间戳
|
|
|
|
|
* @param timebuf 定义的buf存储数据
|
|
|
|
|
* @param type 0 是毫秒级的时间戳 1 秒级的时间戳
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
extern void GetTimeNet(char* timebuf, int type);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 从配置文件中读取数据
|
|
|
|
|
* @param filename 配置文件名
|
|
|
|
|
* @param config 配置选项
|
|
|
|
|
* @param option 具体配置参数
|
|
|
|
|
* @return std::string 返回要获取的参数数据
|
|
|
|
|
*/
|
|
|
|
|
extern std::string ReadStrByOpt(std::string filename, std::string config, std::string option);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 写配置文件
|
|
|
|
|
* @param filename 配置文件名
|
|
|
|
|
* @param config 配置选项
|
|
|
|
|
* @param option 具体配置参数
|
|
|
|
|
* @param value 具体的数据值
|
|
|
|
|
* @return int 0:配置成功
|
|
|
|
|
*/
|
|
|
|
|
extern int WriteStr2Config(std::string filename, std::string config, std::string option, std::string value, bool listable = false);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取设备的MAC地址做为设备的唯一标识
|
|
|
|
|
* @return std::string Mac地址
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetLocalMac();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取设备IP
|
|
|
|
|
* @return std::string IP地址
|
|
|
|
|
*/
|
|
|
|
|
extern std::string IpAddrInit();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取正在工作的网卡
|
|
|
|
|
* @return std::string
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetWorkNic();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取系统基本信息
|
|
|
|
|
* @return std::string CPU MEM DISK info
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetSysInfo();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 去掉字符串所有空格
|
|
|
|
|
* @return std::string
|
|
|
|
|
*/
|
|
|
|
|
extern std::string & ClearAllSpace(std::string &str);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 调用接口写入data数据
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
extern void StartWriteToDat();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 循环检测文件
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
extern void BackupDatFile();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 降采样
|
|
|
|
|
* @return double
|
|
|
|
|
*/
|
|
|
|
|
extern float * ReSample(int WaveDataLength, int N, int *NewWaveDataLength, std::vector<float> & WaveData);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 设置系统时间
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
extern int SetTime(unsigned long seconds, int milliseconds = 0);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 删除配置文件
|
|
|
|
|
* @return int
|
|
|
|
|
*/
|
|
|
|
|
extern void RemoveConfig();
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取文件内容
|
|
|
|
|
* @param filename 文件名
|
|
|
|
|
* @param line 第几行
|
|
|
|
|
* @return std::string
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetFileContent(std::string filename, int line);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 配置时区
|
|
|
|
|
* @param zoneid 时区ID
|
|
|
|
|
* @return void
|
|
|
|
|
*/
|
|
|
|
|
extern void ZoneConfig(std::string zoneid);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @brief 获取系统基本信息
|
|
|
|
|
* @return std::string CPU MEM DISK info
|
|
|
|
|
*/
|
|
|
|
|
extern std::string GetSysStatus();
|
|
|
|
|
|
2021-10-28 16:06:30 +08:00
|
|
|
|
extern bool CheckIP(const char *ip);
|
|
|
|
|
bool IsValidMask(std::string mask);
|
2021-10-11 09:33:47 +08:00
|
|
|
|
//read update config file
|
|
|
|
|
extern std::vector <std::string> ReadStrByOpt(std::string filename,std::string strUpdataFileName);
|
|
|
|
|
|
2021-09-18 13:45:24 +08:00
|
|
|
|
extern void swap(char *data);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#endif
|