Преглед изворни кода

1、网页语言文件更新漏掉,补上
2、解决wifi的bug

guohui пре 1 година
родитељ
комит
421444a9c7

+ 2 - 1
cust_data/web/unique/i18n/i18n_deguo.js

@@ -470,7 +470,8 @@ const i18n_deguo= {
   "qy":"Aktivieren",
   "xhqd":"Signalintensität",
   "yys":"Betreiber",
-  "tel":"Telefonnummer:"
+  "tel":"Telefonnummer:",
+  "ztts":"Push-Benachrichtigungen pausieren"
 
 
 }

+ 2 - 1
cust_data/web/unique/i18n/i18n_eguo.js

@@ -471,5 +471,6 @@ const i18n_eguo={
   "qy":"Включить",
   "xhqd":"Сила сигнала",
   "yys":"Оператор",
-  "tel":"Номер телефона"
+  "tel":"Номер телефона",
+  "ztts":"Приостановить толкание"
 }

+ 2 - 1
cust_data/web/unique/i18n/i18n_faguo.js

@@ -470,7 +470,8 @@ const i18n_faguo={
   "qy":"Activer",
   "xhqd":"Force du signal",
   "yys":"Opérateur",
-  "tel":"Numéro de téléphone"
+  "tel":"Numéro de téléphone",
+  "ztts":"Suspendre le push"
 
 
 

+ 2 - 1
cust_data/web/unique/i18n/i18n_putaoya.js

@@ -470,7 +470,8 @@ const i18n_putaoya={
   "qy":"Activar",
   "xhqd":"intensidade do sinal",
   "yys":"Operador",
-  "tel":"Número de telefone:"
+  "tel":"Número de telefone:",
+  "ztts":"Pausa o empurramento"
 
 
 

+ 2 - 1
cust_data/web/unique/i18n/i18n_riben.js

@@ -470,7 +470,8 @@ const i18n_riben={
   "qy":"有効化",
   "xhqd":"しんごうきょうど",
   "yys":"オペレータ",
-  "tel":"電話番号"
+  "tel":"電話番号",
+  "ztts":"プッシュの一時停止"
 
 
 

+ 2 - 1
cust_data/web/unique/i18n/i18n_xibanya.js

@@ -470,7 +470,8 @@ const i18n_xibanya={
   "qy":"Habilitar",
   "xhqd":"Intensidad de la señal",
   "yys":"Operadores",
-  "tel":"Número de teléfono"
+  "tel":"Número de teléfono",
+  "ztts":"Suspensión de empuje"
 
 
 

+ 2 - 1
cust_data/web/unique/i18n/i18n_yidali.js

@@ -470,7 +470,8 @@ const i18n_yidali={
   "qy":"Abilita",
   "xhqd":"Fortezza del segnale",
   "yys":"Operatore",
-  "tel":"Numero di telefono:"
+  "tel":"Numero di telefono:",
+  "ztts":"Metti in pausa le notifiche push"
 
 
 

+ 2 - 1
cust_data/web/unique/i18n/i18n_yingguo.js

@@ -470,6 +470,7 @@ const i18n_yingguo={
   "qy":"Enable",
   "xhqd":"Signal strength",
   "yys":"Operator",
-  "tel":"phone number"
+  "tel":"phone number",
+  "ztts":"Pause push notifications"
 
 }

+ 2 - 1
cust_data/web/unique/i18n/i18n_zh_CN.js

@@ -470,7 +470,8 @@ const i18n_zh_CN = {
   "qy":"启用",
   "xhqd":"信号强度",
   "yys":"运营商",
-  "tel":"电话号码"
+  "tel":"电话号码",
+  "ztts":"暂停推送"
 
 
 

+ 2 - 2
pro/config/cfg.h

@@ -42,8 +42,8 @@
 #define USE_MQTT
 #define MQTT_SERVER_BUILTIN
 
-//#define USE_CELL
-//#define USE_WIFI
+#define USE_CELL
+#define USE_WIFI
 
 
 #if (defined PRJ_XIAN_AC_I1_O1_P4) || (defined PRJ_XIAN_AC_I1_O1_P8)  //GOM037

+ 2 - 1
pro/src/app.c

@@ -30,6 +30,7 @@
 #include <unistd.h>
 #include "pduMIB_trap.h"
 #include "Cellular.h"
+#include "wifi.h"
 
 
 
@@ -2608,7 +2609,7 @@ int app_init(void)
     appweb_init();
 
     //Cellular_init();
-   // wifi_init();
+    wifi_init();
 
     upg_init();
     dev_Alarm_Run_message(_globalDeviceManager,language_alarm_Init_Success[0],"Server Thread");

+ 27 - 0
pro/src/paras.c

@@ -3553,9 +3553,11 @@ static int ini_reset(paras_handle_t *h)
     fprintf(fp, "led         = \"%d\"\n", info->misc.led);
     fprintf(fp, "beep        = \"%d\"\n", info->misc.beep);
     fprintf(fp, "rotate      = \"%d\"\n", info->misc.rotate);
+    fprintf(fp, "\n");
 
     fprintf(fp, "[cell]\n");
     fprintf(fp, "mode        = \"%d\"\n", info->cell);
+    fprintf(fp, "\n");
     
     fprintf(fp, "[wifi]\n");
     fprintf(fp, "mode        = \"%d\"\n", info->wifi.mode);
@@ -3598,6 +3600,31 @@ static int ini_save(paras_handle_t *h)
         return -1;
     }
 
+    r = proc_ptotal(h->dic, PARAS_WRITE, &h->info->ptotal);
+    if(r) {
+        LOGE("___proc_ptotal failed\n");
+    }
+
+    r = proc_webcfg(h->dic, PARAS_WRITE, &h->info->webcfg);
+    if(r) {
+        LOGE("___proc_webcfg failed\n");
+    }
+
+    r = proc_cellular(h->dic, PARAS_WRITE, &h->info->cell);
+    if(r) {
+        LOGE("___proc_cellular failed\n");
+    }
+
+    r = proc_wifi(h->dic, PARAS_WRITE, &h->info->wifi);
+    if(r) {
+        LOGE("___proc_wifi failed\n");
+    }
+
+    r = proc_misc(h->dic, PARAS_WRITE, &h->info->misc);
+    if(r) {
+        LOGE("___proc_misc failed\n");
+    }
+
     FILE *fp=fopen(h->path, "w");
     if(!fp) {
         LOGE("___%s open failed\n", h->path);

+ 15 - 0
pro/src/websocket_handle.c

@@ -12,6 +12,9 @@
 #include "json_handle.h"
 #include "cascade.h"
 #include "cfg.h"
+#include "wifi.h"
+#include "Cellular.h"
+
 
 #define USE_WS2
 #define WS_SEND_TLEN_MAX  (1024*1024*10)
@@ -244,11 +247,13 @@ static int ws_Cellular_update(ws_handle_t *h)
 {
     char *json;
 
+#ifdef USE_CELL
     json = communication_4G_ack_to_json(&_globalCellularManager,1);
     if(json) {
         ws_send_data(h, json, strlen(json));
         cJSON_free(json);
     }
+#endif
 
     return 0;
 }
@@ -257,11 +262,21 @@ static int ws_WIFI_update(ws_handle_t *h)
 {
     char *json;
 
+#ifdef USE_CELL
+    ap_stat_t stat;
+
+    int r = wifi_sta_stat(&stat);
+    if(r==0) {
+        _globalWIFIManager.Link_status = stat.link;
+        strcpy(_globalWIFIManager.WIFI_ip, stat.ipaddr);
+    }
+
     json = communication_WIFI_ack_to_json(&_globalWIFIManager,1);
     if(json) {
         ws_send_data(h, json, strlen(json));
         cJSON_free(json);
     }
+#endif
 
     return 0;
 }

+ 12 - 9
pro/src/wifi.c

@@ -269,6 +269,7 @@ static int callback_stat(struct nl_msg *msg, void *arg)
     } else {
         stat->link = 0;
     }
+    printf("____link: %d, signal: %d\n", stat->link, stat->signal);
 
     return NL_OK;
 }
@@ -472,7 +473,7 @@ static int nl80211_free(nl_handle_t *h)
     
     return 0;
 }
-static int get_ipaddr(char *ifname, char *ipaddr)
+static int get_ipaddr(char *ifname, int family, char *ipaddr)
 {
     int r=-1;
     struct ifaddrs *ifap, *ifa;
@@ -483,8 +484,8 @@ static int get_ipaddr(char *ifname, char *ipaddr)
     }
 
     for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) {
-        if (ifa->ifa_addr != NULL && strcmp(ifa->ifa_name, ifname)==0) {
-            if(ifa->ifa_addr->sa_family==AF_INET) {
+        if (ifa->ifa_addr != NULL && strcmp(ifa->ifa_name, ifname)==0 && ifa->ifa_addr->sa_family==family) {
+            if(family==AF_INET) {
                 struct sockaddr_in *sa,*msk;
                 sa = (struct sockaddr_in *)  ifa->ifa_addr;
                 msk = (struct sockaddr_in *) ifa->ifa_netmask;
@@ -513,7 +514,7 @@ static int nl_get_ip(ap_stat_t *stat)
     int r;
 
     stat->ipaddr[0] = 0;
-    r = get_ipaddr(WLAN_IFNAME, stat->ipaddr);
+    r = get_ipaddr(WLAN_IFNAME, AF_INET, stat->ipaddr);
 
     return r;
 }
@@ -529,12 +530,13 @@ static int nl_get_signal(ap_stat_t *stat)
     h = &nl;
 
     stat->link = stat->signal = 0;
-    genlmsg_put(h->msg, 0, 0, h->nl_id, 0, NLM_F_DUMP, NL80211_CMD_GET_STATION, 0);  // Setup which command to run.
+    genlmsg_put(h->msg, 0, 0, h->nl_id, 0, 0, NL80211_CMD_GET_STATION, 0);  // Setup which command to run.
     nla_put_u32(h->msg, NL80211_ATTR_IFINDEX, h->ifindex);  // Add message attribute, which interface to use.
-    nl_socket_modify_cb(h->sock, NL_CB_VALID, NL_CB_CUSTOM, callback_stat, stat);
-    r = nl_send_auto(h->sock, h->msg);
+    nl_cb_set(h->cb, NL_CB_VALID, NL_CB_CUSTOM, callback_stat, stat);
+    r = nl_send_auto_complete(h->sock, h->msg);
+    printf("__________________________r: %d\n", r);
     if(r>=0) {
-        nl_recvmsgs_default(h->sock);
+        nl_recvmsgs(h->sock, h->cb);
         r = 0;
     }
     nl80211_free(h);
@@ -786,4 +788,5 @@ int wifi_list_free(ap_list_t *list)
     list->cnt = 0;
     list->info = NULL;
     return 0;
-}
+}
+