remove dg102 codes.
This commit is contained in:
parent
658de5c5ef
commit
fecc3ee4b1
@ -127,44 +127,8 @@ int InitGpio(unsigned int gpioN, unsigned int inout) {
|
|||||||
close(fd);
|
close(fd);
|
||||||
sleep(1);
|
sleep(1);
|
||||||
//闂傚倸鍊烽悞锕€<E99495>?<3F>?Ο鑲╃煋闁割偅娲橀崑<E6A980>?<3F>堟煕閻<E78595>?彃鍘o闂傚倷绀侀幖<E4BE80>?<3F>﹀磹婵犳艾绠犻柟鎹愵嚙缁犳牠鏌ㄩ悤鍌涘<E98D8C>?
|
//闂傚倸鍊烽悞锕€<E99495>?<3F>?Ο鑲╃煋闁割偅娲橀崑<E6A980>?<3F>堟煕閻<E78595>?彃鍘o闂傚倷绀侀幖<E4BE80>?<3F>﹀磹婵犳艾绠犻柟鎹愵嚙缁犳牠鏌ㄩ悤鍌涘<E98D8C>?
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
char tmp2[100] = {0};
|
|
||||||
if (gpioN == 507)
|
|
||||||
memcpy(tmp2, "P18_3", 5);
|
|
||||||
else if (gpioN == 499)
|
|
||||||
memcpy(tmp2, "P17_3", 5);
|
|
||||||
else if (gpioN == 496)
|
|
||||||
memcpy(tmp2, "P17_0", 5);
|
|
||||||
else if (gpioN == 130)
|
|
||||||
memcpy(tmp2, "P9_0", 4);
|
|
||||||
else if (gpioN == 408)
|
|
||||||
memcpy(tmp2, "P6_0", 4);
|
|
||||||
else if (gpioN == 363)
|
|
||||||
memcpy(tmp2, "P0_3", 4);
|
|
||||||
else if (gpioN == 498)
|
|
||||||
memcpy(tmp2, "P17_2", 5);
|
|
||||||
else if (gpioN == 466)
|
|
||||||
memcpy(tmp2, "P13_2", 5);
|
|
||||||
else if (gpioN == 488)
|
|
||||||
memcpy(tmp2, "P16_0", 5);
|
|
||||||
else if (gpioN == 474)
|
|
||||||
memcpy(tmp2, "P14_2", 5);
|
|
||||||
else if (gpioN == 497)
|
|
||||||
memcpy(tmp2, "P17_1", 5);
|
|
||||||
else if (gpioN == 409)
|
|
||||||
memcpy(tmp2, "P6_1", 4);
|
|
||||||
else if (gpioN == 410)
|
|
||||||
memcpy(tmp2, "P6_2", 4);
|
|
||||||
else if (gpioN == 449)
|
|
||||||
memcpy(tmp2, "P11_1", 5);
|
|
||||||
else if (gpioN == 489)
|
|
||||||
memcpy(tmp2, "P16_1", 5);
|
|
||||||
|
|
||||||
sprintf(tmp, "/sys/class/gpio/%s/direction", tmp2);
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
sprintf(tmp, "/sys/class/gpio/gpio%d/direction", gpioN);
|
sprintf(tmp, "/sys/class/gpio/gpio%d/direction", gpioN);
|
||||||
#endif
|
|
||||||
|
|
||||||
zlog_info(zbt, "open GPIO = %s", tmp);
|
zlog_info(zbt, "open GPIO = %s", tmp);
|
||||||
fd = open(tmp, O_WRONLY);
|
fd = open(tmp, O_WRONLY);
|
||||||
@ -196,43 +160,8 @@ int InitGpio(unsigned int gpioN, unsigned int inout) {
|
|||||||
int gpio_set(unsigned int gpioN, char x) {
|
int gpio_set(unsigned int gpioN, char x) {
|
||||||
int fd = 0;
|
int fd = 0;
|
||||||
char tmp[100] = {0};
|
char tmp[100] = {0};
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
char tmp2[100] = {0};
|
|
||||||
if (gpioN == 507)
|
|
||||||
memcpy(tmp2, "P18_3", 5);
|
|
||||||
else if (gpioN == 499)
|
|
||||||
memcpy(tmp2, "P17_3", 5);
|
|
||||||
else if (gpioN == 496)
|
|
||||||
memcpy(tmp2, "P17_0", 5);
|
|
||||||
else if (gpioN == 130)
|
|
||||||
memcpy(tmp2, "P9_0", 4);
|
|
||||||
else if (gpioN == 408)
|
|
||||||
memcpy(tmp2, "P6_0", 4);
|
|
||||||
else if (gpioN == 363)
|
|
||||||
memcpy(tmp2, "P0_3", 4);
|
|
||||||
else if (gpioN == 498)
|
|
||||||
memcpy(tmp2, "P17_2", 5);
|
|
||||||
else if (gpioN == 466)
|
|
||||||
memcpy(tmp2, "P13_2", 5);
|
|
||||||
else if (gpioN == 488)
|
|
||||||
memcpy(tmp2, "P16_0", 5);
|
|
||||||
else if (gpioN == 474)
|
|
||||||
memcpy(tmp2, "P14_2", 5);
|
|
||||||
else if (gpioN == 497)
|
|
||||||
memcpy(tmp2, "P17_1", 5);
|
|
||||||
else if (gpioN == 409)
|
|
||||||
memcpy(tmp2, "P6_1", 4);
|
|
||||||
else if (gpioN == 410)
|
|
||||||
memcpy(tmp2, "P6_2", 4);
|
|
||||||
else if (gpioN == 449)
|
|
||||||
memcpy(tmp2, "P11_1", 5);
|
|
||||||
else if (gpioN == 489)
|
|
||||||
memcpy(tmp2, "P16_1", 5);
|
|
||||||
sprintf(tmp, "/sys/class/gpio/%s/value", tmp2);
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
sprintf(tmp, "/sys/class/gpio/gpio%d/value", gpioN);
|
sprintf(tmp, "/sys/class/gpio/gpio%d/value", gpioN);
|
||||||
#endif
|
|
||||||
|
|
||||||
//闂傚倷鑳堕幊鎾绘倶濮樿泛绠伴柛婵<E69F9B>?劜椤洟鏌熸潏鈺佲偓宄 value闂傚倷绀侀幖<E4BE80>?<3F>﹀磹缁<E7A3B9>?5娲晲閸涱亝鐎婚梺璺ㄥ櫐閹凤拷
|
//闂傚倷鑳堕幊鎾绘倶濮樿泛绠伴柛婵<E69F9B>?劜椤洟鏌熸潏鈺佲偓宄 value闂傚倷绀侀幖<E4BE80>?<3F>﹀磹缁<E7A3B9>?5娲晲閸涱亝鐎婚梺璺ㄥ櫐閹凤拷
|
||||||
fd = open(tmp, O_WRONLY);
|
fd = open(tmp, O_WRONLY);
|
||||||
@ -265,43 +194,8 @@ int gpio_read(unsigned int gpioN) {
|
|||||||
|
|
||||||
char tmp[100] = {0};
|
char tmp[100] = {0};
|
||||||
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
char tmp2[100] = {0};
|
|
||||||
if (gpioN == 507)
|
|
||||||
memcpy(tmp2, "P18_3", 5);
|
|
||||||
else if (gpioN == 499)
|
|
||||||
memcpy(tmp2, "P17_3", 5);
|
|
||||||
else if (gpioN == 496)
|
|
||||||
memcpy(tmp2, "P17_0", 5);
|
|
||||||
else if (gpioN == 130)
|
|
||||||
memcpy(tmp2, "P9_0", 4);
|
|
||||||
else if (gpioN == 408)
|
|
||||||
memcpy(tmp2, "P6_0", 4);
|
|
||||||
else if (gpioN == 363)
|
|
||||||
memcpy(tmp2, "P0_3", 4);
|
|
||||||
else if (gpioN == 498)
|
|
||||||
memcpy(tmp2, "P17_2", 5);
|
|
||||||
else if (gpioN == 466)
|
|
||||||
memcpy(tmp2, "P13_2", 5);
|
|
||||||
else if (gpioN == 488)
|
|
||||||
memcpy(tmp2, "P16_0", 5);
|
|
||||||
else if (gpioN == 474)
|
|
||||||
memcpy(tmp2, "P14_2", 5);
|
|
||||||
else if (gpioN == 497)
|
|
||||||
memcpy(tmp2, "P17_1", 5);
|
|
||||||
else if (gpioN == 409)
|
|
||||||
memcpy(tmp2, "P6_1", 4);
|
|
||||||
else if (gpioN == 410)
|
|
||||||
memcpy(tmp2, "P6_2", 4);
|
|
||||||
else if (gpioN == 449)
|
|
||||||
memcpy(tmp2, "P11_1", 5);
|
|
||||||
else if (gpioN == 489)
|
|
||||||
memcpy(tmp2, "P16_1", 5);
|
|
||||||
sprintf(tmp, "/sys/class/gpio/%s/value", tmp2);
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
sprintf(tmp, "/sys/class/gpio/gpio%d/value", gpioN);
|
sprintf(tmp, "/sys/class/gpio/gpio%d/value", gpioN);
|
||||||
#endif
|
|
||||||
//闂傚倷鑳堕幊鎾绘倶濮樿泛绠伴柛婵<E69F9B>?劜椤洟鏌熸潏鈺佲偓宄 value闂傚倷绀侀幖<E4BE80>?<3F>﹀磹缁<E7A3B9>?5娲晲閸涱亝鐎婚梺璺ㄥ櫐閹凤拷
|
//闂傚倷鑳堕幊鎾绘倶濮樿泛绠伴柛婵<E69F9B>?劜椤洟鏌熸潏鈺佲偓宄 value闂傚倷绀侀幖<E4BE80>?<3F>﹀磹缁<E7A3B9>?5娲晲閸涱亝鐎婚梺璺ㄥ櫐閹凤拷
|
||||||
fd = open(tmp, O_RDONLY);
|
fd = open(tmp, O_RDONLY);
|
||||||
if (-1 == fd) {
|
if (-1 == fd) {
|
||||||
@ -1099,16 +993,12 @@ std::string GetSysStatus() {
|
|||||||
char rateHardUse[32];
|
char rateHardUse[32];
|
||||||
char chRes[100];
|
char chRes[100];
|
||||||
memset(chRes, 0, 100);
|
memset(chRes, 0, 100);
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
char hardName[32];
|
char hardName[32];
|
||||||
char hardUse[32];
|
char hardUse[32];
|
||||||
const char *getEmmcInfo = "df -h | grep /opt";
|
const char *getEmmcInfo = "df -h | grep /opt";
|
||||||
system_custom(getEmmcInfo, chRes);
|
system_custom(getEmmcInfo, chRes);
|
||||||
sscanf(chRes, "%s%s%s%s%s", hardName, hardTotal, hardUse, hardFree, rateHardUse);
|
sscanf(chRes, "%s%s%s%s%s", hardName, hardTotal, hardUse, hardFree, rateHardUse);
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
getDiskInfo(hardTotal, hardFree);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
std::string strhardTotal(hardTotal);
|
std::string strhardTotal(hardTotal);
|
||||||
std::string strhardFree(hardFree);
|
std::string strhardFree(hardFree);
|
||||||
|
|||||||
@ -22,7 +22,6 @@ enum enumZigBeeTransmitStatus {
|
|||||||
//#define WIFI_MODULE
|
//#define WIFI_MODULE
|
||||||
//#define NR5G_MEIGE
|
//#define NR5G_MEIGE
|
||||||
//#define G2UL_GATEWAY
|
//#define G2UL_GATEWAY
|
||||||
#define IMX6UL_GATEWAY
|
|
||||||
|
|
||||||
class GlobalConfig
|
class GlobalConfig
|
||||||
{
|
{
|
||||||
@ -57,14 +56,9 @@ public :
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
#define SAVE_COUNT 4320
|
#define SAVE_COUNT 4320
|
||||||
#define OneWeek 432000 //5天
|
#define OneWeek 432000 //5天
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
#define SAVE_COUNT 4800*4
|
|
||||||
#define OneWeek 604800*7
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//按8 取整
|
//按8 取整
|
||||||
#define Length_(len) do{ \
|
#define Length_(len) do{ \
|
||||||
|
|||||||
@ -176,9 +176,9 @@ std::string JsonData::JsonCmd_25(Param_25 ¶m) {
|
|||||||
bFlag4 = true;
|
bFlag4 = true;
|
||||||
}
|
}
|
||||||
zlog_info(zct, "bFlag1 = %d,bFlag2 = %d,bFlag3 = %d,bFlag4 = %d", bFlag1, bFlag2, bFlag3, bFlag4);
|
zlog_info(zct, "bFlag1 = %d,bFlag2 = %d,bFlag3 = %d,bFlag4 = %d", bFlag1, bFlag2, bFlag3, bFlag4);
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
param.mNet = "Net";
|
param.mNet = "Net";
|
||||||
#endif
|
|
||||||
if (0 == param.mMode && (bFlag1 && bFlag2 && bFlag3 && bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
if (0 == param.mMode && (bFlag1 && bFlag2 && bFlag3 && bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "dnsName", param.mDnsName);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "dnsName", param.mDnsName);
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "networkPortStatus", param.mNetworkPortStatus);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "networkPortStatus", param.mNetworkPortStatus);
|
||||||
@ -187,11 +187,10 @@ std::string JsonData::JsonCmd_25(Param_25 ¶m) {
|
|||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", param.mIp);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", param.mIp);
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", param.mHostName);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", param.mHostName);
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
char GateWay[100] = {0x00};
|
char GateWay[100] = {0x00};
|
||||||
sprintf(GateWay, "sed -i '7c route add default gw %s' /etc/init.d/S90start_userapp.sh", param.mGateway.c_str());
|
sprintf(GateWay, "sed -i '7c route add default gw %s' /etc/init.d/S90start_userapp.sh", param.mGateway.c_str());
|
||||||
system(GateWay);
|
system(GateWay);
|
||||||
#endif
|
|
||||||
PlatformInit::EquipIpInit(param.mNet);
|
PlatformInit::EquipIpInit(param.mNet);
|
||||||
|
|
||||||
} else if (0 == param.mMode && param.mNetworkPortStatus == "DHCP") {
|
} else if (0 == param.mMode && param.mNetworkPortStatus == "DHCP") {
|
||||||
@ -202,9 +201,7 @@ std::string JsonData::JsonCmd_25(Param_25 ¶m) {
|
|||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", "");
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", "");
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", "");
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", "");
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
system("sed -i '7c udhcpc -i eth0 > /dev/null &' /etc/init.d/S90start_userapp.sh");
|
system("sed -i '7c udhcpc -i eth0 > /dev/null &' /etc/init.d/S90start_userapp.sh");
|
||||||
#endif
|
|
||||||
PlatformInit::EquipIpInit(param.mNet);
|
PlatformInit::EquipIpInit(param.mNet);
|
||||||
|
|
||||||
} else if (0 == param.mMode && (!bFlag1 || !bFlag2 || !bFlag3 || !bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
} else if (0 == param.mMode && (!bFlag1 || !bFlag2 || !bFlag3 || !bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
||||||
|
|||||||
@ -539,10 +539,9 @@ std::string JsonData::JsonCmd_Cgi_25(Param_25 ¶m) {
|
|||||||
bFlag4 = true;
|
bFlag4 = true;
|
||||||
}
|
}
|
||||||
zlog_info(zct, "bFlag1 = %d,bFlag2 = %d,bFlag3 = %d,bFlag4 = %d", bFlag1, bFlag2, bFlag3, bFlag4);
|
zlog_info(zct, "bFlag1 = %d,bFlag2 = %d,bFlag3 = %d,bFlag4 = %d", bFlag1, bFlag2, bFlag3, bFlag4);
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
strNet = param.mNet;
|
strNet = param.mNet;
|
||||||
param.mNet = "Net";
|
param.mNet = "Net";
|
||||||
#endif
|
|
||||||
if (0 == param.mMode && (bFlag1 && bFlag2 && bFlag3 && bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
if (0 == param.mMode && (bFlag1 && bFlag2 && bFlag3 && bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "dnsName", param.mDnsName);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "dnsName", param.mDnsName);
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "networkPortStatus", param.mNetworkPortStatus);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "networkPortStatus", param.mNetworkPortStatus);
|
||||||
@ -551,12 +550,10 @@ std::string JsonData::JsonCmd_Cgi_25(Param_25 ¶m) {
|
|||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", param.mIp);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", param.mIp);
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", param.mHostName);
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", param.mHostName);
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
char GateWay[100] = {0x00};
|
char GateWay[100] = {0x00};
|
||||||
sprintf(GateWay, "sed -i '7c route add default gw %s' /etc/init.d/S90start_userapp.sh", param.mGateway.c_str());
|
sprintf(GateWay, "sed -i '7c route add default gw %s' /etc/init.d/S90start_userapp.sh", param.mGateway.c_str());
|
||||||
zlog_info(zct, "GateWay = %s", GateWay);
|
zlog_info(zct, "GateWay = %s", GateWay);
|
||||||
system(GateWay);
|
system(GateWay);
|
||||||
#endif
|
|
||||||
PlatformInit::EquipIpInit(param.mNet);
|
PlatformInit::EquipIpInit(param.mNet);
|
||||||
|
|
||||||
} else if (0 == param.mMode && param.mNetworkPortStatus == "DHCP") {
|
} else if (0 == param.mMode && param.mNetworkPortStatus == "DHCP") {
|
||||||
@ -567,9 +564,7 @@ std::string JsonData::JsonCmd_Cgi_25(Param_25 ¶m) {
|
|||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", "");
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "ipAddress", "");
|
||||||
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", "");
|
WriteStr2Config(NETWORKCONFIG, param.mNet, "hostName", "");
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
system("sed -i '7c udhcpc -i eth0 > /dev/null &' /etc/init.d/S90start_userapp.sh");
|
system("sed -i '7c udhcpc -i eth0 > /dev/null &' /etc/init.d/S90start_userapp.sh");
|
||||||
#endif
|
|
||||||
PlatformInit::EquipIpInit(param.mNet);
|
PlatformInit::EquipIpInit(param.mNet);
|
||||||
|
|
||||||
} else if (0 == param.mMode && (!bFlag1 || !bFlag2 || !bFlag3 || !bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
} else if (0 == param.mMode && (!bFlag1 || !bFlag2 || !bFlag3 || !bFlag4) && param.mNetworkPortStatus == "STATIC") {
|
||||||
|
|||||||
@ -115,22 +115,12 @@ void my_disconnect_callback(struct mosquitto *mosq, void *obj, int result) {
|
|||||||
#ifdef WIFI_MODULE
|
#ifdef WIFI_MODULE
|
||||||
char buf[128] = {0};
|
char buf[128] = {0};
|
||||||
std::string wpa_state = "";
|
std::string wpa_state = "";
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
wpa_state = "/usr/sbin/wpa_cli status|grep wpa_state | cut -f 2 -d '='";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
wpa_state = "/opt/Cidn/wpa_cli status|grep wpa_state | cut -f 2 -d '='";
|
wpa_state = "/opt/Cidn/wpa_cli status|grep wpa_state | cut -f 2 -d '='";
|
||||||
#endif
|
|
||||||
system_custom(wpa_state.c_str(), buf);
|
system_custom(wpa_state.c_str(), buf);
|
||||||
std::string state = std::string(buf);
|
std::string state = std::string(buf);
|
||||||
std::string RSSI_cmd = "";
|
std::string RSSI_cmd = "";
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
RSSI_cmd = "/usr/sbin/wpa_cli signal_poll|grep RSSI | cut -f 2 -d '='";
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
RSSI_cmd = "/opt/Cidn/wpa_cli signal_poll|grep RSSI | cut -f 2 -d '='";
|
RSSI_cmd = "/opt/Cidn/wpa_cli signal_poll|grep RSSI | cut -f 2 -d '='";
|
||||||
#endif
|
|
||||||
system_custom(RSSI_cmd.c_str(), buf);
|
system_custom(RSSI_cmd.c_str(), buf);
|
||||||
std::string RSSI = std::string(buf);
|
std::string RSSI = std::string(buf);
|
||||||
|
|
||||||
|
|||||||
@ -176,22 +176,6 @@ void PlatformInit::Sqlite3Init() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void PlatformInit::GPIOInit() {
|
void PlatformInit::GPIOInit() {
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
GlobalConfig::GPIO_G.zigAckrep = 507;
|
|
||||||
GlobalConfig::GPIO_G.zigAckreset = 499;
|
|
||||||
GlobalConfig::GPIO_G.zigReset = 496;
|
|
||||||
GlobalConfig::GPIO_G.commPower = 363;
|
|
||||||
GlobalConfig::GPIO_G.vol3_8 = 498;
|
|
||||||
GlobalConfig::GPIO_G.commRest = 466;
|
|
||||||
GlobalConfig::GPIO_G.wifiPower = 488;
|
|
||||||
GlobalConfig::GPIO_G.wifiReset = 474;
|
|
||||||
GlobalConfig::GPIO_G.hardWatchDog = 497;
|
|
||||||
GlobalConfig::GPIO_G.zigDef = 408;
|
|
||||||
GlobalConfig::GPIO_G.runLed = 409;
|
|
||||||
GlobalConfig::GPIO_G.errorLed = 410;
|
|
||||||
GlobalConfig::GPIO_G.netResetNet0 = 489;
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
GlobalConfig::GPIO_G.zigAckrep = 119;
|
GlobalConfig::GPIO_G.zigAckrep = 119;
|
||||||
GlobalConfig::GPIO_G.zigAckreset = 120;
|
GlobalConfig::GPIO_G.zigAckreset = 120;
|
||||||
GlobalConfig::GPIO_G.zigReset = 116;
|
GlobalConfig::GPIO_G.zigReset = 116;
|
||||||
@ -199,7 +183,6 @@ void PlatformInit::GPIOInit() {
|
|||||||
GlobalConfig::GPIO_G.commRest = 8;
|
GlobalConfig::GPIO_G.commRest = 8;
|
||||||
GlobalConfig::GPIO_G.power = 9;
|
GlobalConfig::GPIO_G.power = 9;
|
||||||
GlobalConfig::GPIO_G.errorLed = 130;
|
GlobalConfig::GPIO_G.errorLed = 130;
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void PlatformInit::SystemInfoInit() {
|
void PlatformInit::SystemInfoInit() {
|
||||||
@ -264,29 +247,16 @@ void PlatformInit::EquipIpInit(std::string eth) {
|
|||||||
if (0 == networkPortStatus.compare("DHCP")) {
|
if (0 == networkPortStatus.compare("DHCP")) {
|
||||||
zlog_info(zbt, "dhcp config\n");
|
zlog_info(zbt, "dhcp config\n");
|
||||||
std::string cmd = "";
|
std::string cmd = "";
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
system("sed -i '17c auto eth0' /etc/network/interfaces");
|
system("sed -i '17c auto eth0' /etc/network/interfaces");
|
||||||
system("sed -i '18c iface eth0 inet dhcp' /etc/network/interfaces");
|
system("sed -i '18c iface eth0 inet dhcp' /etc/network/interfaces");
|
||||||
system("sed -i '20c ' /etc/network/interfaces");
|
system("sed -i '20c ' /etc/network/interfaces");
|
||||||
system("sed -i '21c ' /etc/network/interfaces");
|
system("sed -i '21c ' /etc/network/interfaces");
|
||||||
system("sed -i '22c ' /etc/network/interfaces");
|
system("sed -i '22c ' /etc/network/interfaces");
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
if (eth == "eth0") {
|
|
||||||
system("sed -i '5c DHCP=ipv4' /etc/systemd/network/static/10-eth0-static.network");
|
|
||||||
system("sed -i '6c ' /etc/systemd/network/static/10-eth0-static.network");
|
|
||||||
system("sed -i '7c ' /etc/systemd/network/static/10-eth0-static.network");
|
|
||||||
} else if (eth == "eth1") {
|
|
||||||
system("sed -i '5c DHCP=ipv4' /etc/systemd/network/dynamic/20-eth1-dynamic.network");
|
|
||||||
system("sed -i '6c ' /etc/systemd/network/dynamic/20-eth1-dynamic.network");
|
|
||||||
system("sed -i '7c ' /etc/systemd/network/dynamic/20-eth1-dynamic.network");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// flag = 0;
|
// flag = 0;
|
||||||
}
|
}
|
||||||
if (0 == networkPortStatus.compare("STATIC")) {
|
if (0 == networkPortStatus.compare("STATIC")) {
|
||||||
std::string cmd = "";
|
std::string cmd = "";
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
system("sed -i '18c iface eth0 inet static' /etc/network/interfaces");
|
system("sed -i '18c iface eth0 inet static' /etc/network/interfaces");
|
||||||
if (dataWatchIpAddress.length() > 0) {
|
if (dataWatchIpAddress.length() > 0) {
|
||||||
cmd = "sed -i '20c address " + dataWatchIpAddress + "' /etc/network/interfaces";
|
cmd = "sed -i '20c address " + dataWatchIpAddress + "' /etc/network/interfaces";
|
||||||
@ -311,36 +281,9 @@ void PlatformInit::EquipIpInit(std::string eth) {
|
|||||||
}
|
}
|
||||||
system(cmd.c_str());
|
system(cmd.c_str());
|
||||||
cmd.clear();
|
cmd.clear();
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
if (eth == "eth0") {
|
|
||||||
cmd = "sed -i '5c Address=" + dataWatchIpAddress + "' /etc/systemd/network/static/10-eth0-static.network";
|
|
||||||
system(cmd.c_str());
|
|
||||||
cmd = "sed -i '6c Netmask=" + subnetMask + "' /etc/systemd/network/static/10-eth0-static.network";
|
|
||||||
system(cmd.c_str());
|
|
||||||
cmd = "sed -i '7c Gateway=" + gateway + "' /etc/systemd/network/static/10-eth0-static.network";
|
|
||||||
system(cmd.c_str());
|
|
||||||
} else if (eth == "eth1") {
|
|
||||||
cmd = "sed -i '5c Address=" + dataWatchIpAddress + "' /etc/systemd/network/dynamic/20-eth1-dynamic.network";
|
|
||||||
system(cmd.c_str());
|
|
||||||
cmd = "sed -i '6c Netmask=" + subnetMask + "' /etc/systemd/network/dynamic/20-eth1-dynamic.network";
|
|
||||||
system(cmd.c_str());
|
|
||||||
cmd = "sed -i '7c Gateway=" + gateway + "' /etc/systemd/network/dynamic/20-eth1-dynamic.network";
|
|
||||||
system(cmd.c_str());
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
// flag = 1;
|
|
||||||
}
|
}
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
zlog_info(zbt, "system reboot by reboot system call");
|
zlog_info(zbt, "system reboot by reboot system call");
|
||||||
system("sync");
|
system("sync");
|
||||||
sleep(1);
|
sleep(1);
|
||||||
system("reboot");
|
system("reboot");
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
zlog_info(zbt, "network restart by systemctl call");
|
|
||||||
system("systemctl restart systemd-networkd.service");
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -39,14 +39,12 @@ void CheckThread() {
|
|||||||
if (10 == heart_count) {
|
if (10 == heart_count) {
|
||||||
if (GlobalConfig::LinkCount > 30) {
|
if (GlobalConfig::LinkCount > 30) {
|
||||||
zlog_error(zct, "MQTT connect failed ");
|
zlog_error(zct, "MQTT connect failed ");
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
char connect[10] = {0x00};
|
char connect[10] = {0x00};
|
||||||
readStringValue("config", "connect", connect, (char *)GlobalConfig::Config_G.c_str());
|
readStringValue("config", "connect", connect, (char *)GlobalConfig::Config_G.c_str());
|
||||||
if (atoi(connect)) {
|
if (atoi(connect)) {
|
||||||
zlog_error(zct, "MQTT connect failed,reboot");
|
zlog_error(zct, "MQTT connect failed,reboot");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
std::string ipTemp = IpAddrInit();
|
std::string ipTemp = IpAddrInit();
|
||||||
GlobalConfig::IpAddr_G = ipTemp;
|
GlobalConfig::IpAddr_G = ipTemp;
|
||||||
@ -67,16 +65,13 @@ void CheckThread() {
|
|||||||
iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str());
|
iRet = data_publish(str2.c_str(), GlobalConfig::Topic_G.mPubCmd.c_str());
|
||||||
if (iRet != 0) {
|
if (iRet != 0) {
|
||||||
zlog_error(zct, "MQTT connect failed ,time check");
|
zlog_error(zct, "MQTT connect failed ,time check");
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
char connect[10] = {0x00};
|
char connect[10] = {0x00};
|
||||||
readStringValue("config", "connect", connect, (char *)GlobalConfig::Config_G.c_str());
|
readStringValue("config", "connect", connect, (char *)GlobalConfig::Config_G.c_str());
|
||||||
if (atoi(connect)) {
|
if (atoi(connect)) {
|
||||||
zlog_error(zct, "MQTT connect failed,time check ,reboot");
|
zlog_error(zct, "MQTT connect failed,time check ,reboot");
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
#ifdef NR5G_MODULE
|
#ifdef NR5G_MODULE
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
dial.closePort();
|
dial.closePort();
|
||||||
gpio_set(GlobalConfig::GPIO_G.commRest, 0);
|
gpio_set(GlobalConfig::GPIO_G.commRest, 0);
|
||||||
zlog_warn(zct, "GPIO 8 start");
|
zlog_warn(zct, "GPIO 8 start");
|
||||||
@ -87,33 +82,8 @@ void CheckThread() {
|
|||||||
dial.openPort("/dev/ttyUSB2");
|
dial.openPort("/dev/ttyUSB2");
|
||||||
dial.setState();
|
dial.setState();
|
||||||
#endif
|
#endif
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
dial.closePort();
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commPower, 0);
|
|
||||||
zlog_warn(zct, "commPower start");
|
|
||||||
sleep(2);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
|
||||||
zlog_warn(zct, "commPower End");
|
|
||||||
sleep(20);
|
|
||||||
connectCount++;
|
|
||||||
if (connectCount > 10) {
|
|
||||||
zlog_error(zct, "5G reset error ,reboot!");
|
|
||||||
system("reboot");
|
|
||||||
}
|
|
||||||
#ifndef NR5G_MEIGE
|
|
||||||
dial.openPort("/dev/ttyUSB2");
|
|
||||||
dial.setState();
|
|
||||||
#else
|
|
||||||
char szquectel[100] = {0x00};
|
|
||||||
std::string strAPN = ReadStrByOpt(SERVERCONFIG, "Server", "APN");
|
|
||||||
sprintf(szquectel, "/opt/quectel-CM/Meig-CM -s %s &", strAPN.c_str());
|
|
||||||
system(szquectel);
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#endif
|
|
||||||
#ifdef WIFI_MODULE
|
#ifdef WIFI_MODULE
|
||||||
zlog_warn(zct, "WiFi reset!");
|
zlog_warn(zct, "WiFi reset!");
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
||||||
sleep(5);
|
sleep(5);
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
||||||
@ -122,25 +92,6 @@ void CheckThread() {
|
|||||||
wpa.ReconnectWiFi();
|
wpa.ReconnectWiFi();
|
||||||
system("/etc/init.d/wpa_restart");
|
system("/etc/init.d/wpa_restart");
|
||||||
system("udhcpc -i wlan2 &");
|
system("udhcpc -i wlan2 &");
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
system("/etc/init.d/wpa_restart");
|
|
||||||
sleep(5);
|
|
||||||
string strip = GetGwIp_("wlan0");
|
|
||||||
print_info("strip = %s\n", strip.c_str());
|
|
||||||
if (strip.compare("0.0.0.0") != 0) {
|
|
||||||
} else {
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
|
||||||
sleep(5);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
|
||||||
sleep(30);
|
|
||||||
wifi::WPAClient wpa;
|
|
||||||
wpa.ReconnectWiFi();
|
|
||||||
system("/etc/init.d/wpa_restart");
|
|
||||||
sleep(5);
|
|
||||||
system("udhcpc -b -i wlan0 &");
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -243,14 +194,8 @@ void CheckThread() {
|
|||||||
char localtimestamp[32] = {0};
|
char localtimestamp[32] = {0};
|
||||||
GetTimeNet(localtimestamp, 1);
|
GetTimeNet(localtimestamp, 1);
|
||||||
char whereCon[1024] = {0};
|
char whereCon[1024] = {0};
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
sprintf(whereCon, " timestamp < '%ld' ", atol(localtimestamp) - 2592000 * 2); //删除2个月前的数据
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
sprintf(whereCon, " timestamp < '%ld' ", atol(localtimestamp) - 2592000); //删除1个月前的数据
|
sprintf(whereCon, " timestamp < '%ld' ", atol(localtimestamp) - 2592000); //删除1个月前的数据
|
||||||
#endif
|
|
||||||
sqlite_db_ctrl::instance().DeleteTableData(" t_battery_history ", whereCon);
|
sqlite_db_ctrl::instance().DeleteTableData(" t_battery_history ", whereCon);
|
||||||
|
|
||||||
sqlite_db_ctrl::instance().DeleteTableData(" receive_wave_status ", whereCon);
|
sqlite_db_ctrl::instance().DeleteTableData(" receive_wave_status ", whereCon);
|
||||||
}
|
}
|
||||||
#ifdef WIFI_MODULE
|
#ifdef WIFI_MODULE
|
||||||
@ -268,13 +213,7 @@ void CheckThread() {
|
|||||||
if (currentssid.length() > 0) {
|
if (currentssid.length() > 0) {
|
||||||
char buf[64] = {0};
|
char buf[64] = {0};
|
||||||
std::string rssiSend = "";
|
std::string rssiSend = "";
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
rssiSend = "/usr/sbin/wpa_cli signal_poll|grep RSSI | cut -f 2 -d '='";
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
rssiSend = "/opt/Cidn/wpa_cli signal_poll|grep RSSI | cut -f 2 -d '='";
|
rssiSend = "/opt/Cidn/wpa_cli signal_poll|grep RSSI | cut -f 2 -d '='";
|
||||||
#endif
|
|
||||||
system_custom(rssiSend.c_str(), buf);
|
system_custom(rssiSend.c_str(), buf);
|
||||||
std::string Rssi = std::string(buf);
|
std::string Rssi = std::string(buf);
|
||||||
|
|
||||||
|
|||||||
@ -177,20 +177,11 @@ void UartStart() {
|
|||||||
gpio_set(GlobalConfig::GPIO_G.zigReset, 1);
|
gpio_set(GlobalConfig::GPIO_G.zigReset, 1);
|
||||||
zlog_info(zbt, "GPIO Init");
|
zlog_info(zbt, "GPIO Init");
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.errorLed, 1); //指示灯
|
InitGpio(GlobalConfig::GPIO_G.errorLed, 1); //指示灯
|
||||||
gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
|
gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
|
||||||
InitGpio(GlobalConfig::GPIO_G.power, 1); // power reset
|
InitGpio(GlobalConfig::GPIO_G.power, 1); // power reset
|
||||||
gpio_set(GlobalConfig::GPIO_G.power, 0);
|
gpio_set(GlobalConfig::GPIO_G.power, 0);
|
||||||
#endif
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.runLed, 1);
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.errorLed, 1);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.runLed, 1);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.errorLed, 0);
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.netResetNet0, 1);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.netResetNet0, 0);
|
|
||||||
#endif
|
|
||||||
GlobalConfig::Zigbee_G.Serial_Rate = 0x07;
|
GlobalConfig::Zigbee_G.Serial_Rate = 0x07;
|
||||||
GlobalConfig::Zigbee_G.Serial_DataB = 0x08;
|
GlobalConfig::Zigbee_G.Serial_DataB = 0x08;
|
||||||
GlobalConfig::Zigbee_G.Serial_StopB = 0x01;
|
GlobalConfig::Zigbee_G.Serial_StopB = 0x01;
|
||||||
@ -204,39 +195,14 @@ void UartStart() {
|
|||||||
|
|
||||||
void InitModule() {
|
void InitModule() {
|
||||||
#ifdef NR5G_MODULE
|
#ifdef NR5G_MODULE
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commPower, 1); // 4G,5G模组供电,
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.vol3_8, 1); // 5G 高电平3.8V,低电平3.3V
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.vol3_8, 1);
|
|
||||||
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
||||||
gpio_set(GlobalConfig::GPIO_G.commRest, 0); //高电平复位
|
gpio_set(GlobalConfig::GPIO_G.commRest, 1);
|
||||||
#endif // G2UL_GATEWAY
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commRest, 1); //
|
|
||||||
#endif // IMX6UL_GATEWAY
|
|
||||||
#endif // NR5G_MODULE
|
#endif // NR5G_MODULE
|
||||||
|
|
||||||
#ifdef Q4G_MODULE
|
#ifdef Q4G_MODULE
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commPower, 1); // 4G,5G模组供电,
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commPower, 1);
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.commRest, 1);
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.commRest, 0); //高电平复位
|
|
||||||
sleep(10);
|
|
||||||
char szquectel[100] = {0x00};
|
|
||||||
std::string strAPN = ReadStrByOpt(SERVERCONFIG, "Server", "APN");
|
|
||||||
sprintf(szquectel, "/opt/quectel-CM/quectel-CM -s %s &", strAPN.c_str());
|
|
||||||
system(szquectel);
|
|
||||||
#endif // G2UL_GATEWAY
|
|
||||||
#endif // Q4G_MODULE
|
#endif // Q4G_MODULE
|
||||||
#ifdef WIFI_MODULE
|
#ifdef WIFI_MODULE
|
||||||
zlog_info(zbt, "Init WiFi!");
|
zlog_info(zbt, "Init WiFi!");
|
||||||
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.wifiReset, 1); // WiFi模组复位,0复位,1取消复位
|
InitGpio(GlobalConfig::GPIO_G.wifiReset, 1); // WiFi模组复位,0复位,1取消复位
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
gpio_set(GlobalConfig::GPIO_G.wifiReset, 1);
|
||||||
sleep(10);
|
sleep(10);
|
||||||
@ -244,18 +210,6 @@ void InitModule() {
|
|||||||
wpa.ReconnectWiFi();
|
wpa.ReconnectWiFi();
|
||||||
system("/etc/init.d/wpa_restart");
|
system("/etc/init.d/wpa_restart");
|
||||||
system("udhcpc -i wlan2 &");
|
system("udhcpc -i wlan2 &");
|
||||||
#endif // IMX6UL_GATEWAY
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.wifiReset, 1); // WiFi模组复位,1复位,0取消复位
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiReset, 0);
|
|
||||||
InitGpio(GlobalConfig::GPIO_G.wifiPower, 1); // WiFi模组上电
|
|
||||||
gpio_set(GlobalConfig::GPIO_G.wifiPower, 1);
|
|
||||||
sleep(10);
|
|
||||||
wifi::WPAClient wpa;
|
|
||||||
wpa.ReconnectWiFi();
|
|
||||||
system("/usr/sbin/wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf &");
|
|
||||||
system("udhcpc -b -i wlan0 &");
|
|
||||||
#endif // G2UL_GATEWAY
|
|
||||||
#endif // WIFI_MODULE
|
#endif // WIFI_MODULE
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -79,7 +79,6 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
memset(buff, 0, sizeof(buff));
|
memset(buff, 0, sizeof(buff));
|
||||||
ret = read_data(fd, buff, BUF_LENGTH, 50);
|
ret = read_data(fd, buff, BUF_LENGTH, 50);
|
||||||
if (ret <= 0) {
|
if (ret <= 0) {
|
||||||
@ -93,34 +92,6 @@ int Uart::UartRecv(int fd, char srcshow, char *buffer) {
|
|||||||
printf("\n");
|
printf("\n");
|
||||||
FindRecvPackage(ret, buff, head);
|
FindRecvPackage(ret, buff, head);
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
memset(buff, 0x00, sizeof(buff));
|
|
||||||
ret = read_data(fd, buff, BUF_LENGTH, 50);
|
|
||||||
if (ret <= 0) {
|
|
||||||
timeoutflag++;
|
|
||||||
if (timeoutflag > 5) {
|
|
||||||
FindRecvPackage(offSize, szbuffer, (char *)head);
|
|
||||||
memset(szbuffer, 0x00, sizeof(szbuffer));
|
|
||||||
timeoutflag = 0;
|
|
||||||
offSize = 0;
|
|
||||||
maxSize = 0;
|
|
||||||
mssleep(10000);
|
|
||||||
}
|
|
||||||
} else if (ret > 0) {
|
|
||||||
maxSize += ret;
|
|
||||||
zlog_info(zct, "0x8888==str_recv===,ret = %d offSize = %d\n", ret, maxSize);
|
|
||||||
for (int i = 0; i < ret; i++) {
|
|
||||||
printf( "%02x ", buff[i] & 0xff);
|
|
||||||
}
|
|
||||||
zlog_info(zct, "\n");
|
|
||||||
timeoutflag = 0;
|
|
||||||
m_TimeStamp = 0;
|
|
||||||
memcpy(szbuffer + offSize, buff, ret);
|
|
||||||
offSize = offSize + ret;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -157,12 +128,7 @@ Uart::~Uart() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Uart::InitUart(speed_t speed) {
|
void Uart::InitUart(speed_t speed) {
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
fd = config_uart("/dev/ttySC2", speed);
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
fd = config_uart("/dev/ttymxc4", speed);
|
fd = config_uart("/dev/ttymxc4", speed);
|
||||||
#endif
|
|
||||||
zlog_info(zct, "InitUart fd = %d", fd);
|
zlog_info(zct, "InitUart fd = %d", fd);
|
||||||
if (fd < 0) {
|
if (fd < 0) {
|
||||||
zlog_error(zct, "config_uart error");
|
zlog_error(zct, "config_uart error");
|
||||||
|
|||||||
@ -13,12 +13,7 @@
|
|||||||
#include "common/global.hpp"
|
#include "common/global.hpp"
|
||||||
|
|
||||||
namespace wifi {
|
namespace wifi {
|
||||||
#ifdef G2UL_GATEWAY
|
|
||||||
const std::string WPA_PATH = "/var/run/wpa_supplicant/wlan0"; //进程间通信地址加上网络接口额名称
|
|
||||||
#endif
|
|
||||||
#ifdef IMX6UL_GATEWAY
|
|
||||||
const std::string WPA_PATH = "/var/run/wpa_supplicant/wlan2"; //进程间通信地址加上网络接口额名称
|
const std::string WPA_PATH = "/var/run/wpa_supplicant/wlan2"; //进程间通信地址加上网络接口额名称
|
||||||
#endif
|
|
||||||
struct WPAContext {
|
struct WPAContext {
|
||||||
int s;
|
int s;
|
||||||
struct sockaddr_un local;
|
struct sockaddr_un local;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user