Browse Source

编译通过,准备调试

guohui 1 year ago
parent
commit
600b092164
4 changed files with 1410 additions and 560 deletions
  1. 1379 519
      pro/src/Cellular.c
  2. 7 24
      pro/src/Cellular.h
  3. 1 16
      pro/src/mqtt.c
  4. 23 1
      pro/src/mqtt.h

File diff suppressed because it is too large
+ 1379 - 519
pro/src/Cellular.c


+ 7 - 24
pro/src/Cellular.h

@@ -1,41 +1,24 @@
 #ifndef __CELLULAR_Hx__
 #define __CELLULAR_Hx__
 
-enum {
-    CELL_UDP=0,
-    CELL_TCP,
-    CELL_SMS,
-    CELL_GNSS,
-    CELL_DIALOG,
-    CELL_EXCEPT,
-
-    CELL_MAX
-};
-
 typedef struct {
-    int  dbm;
-    int  ber;
-
     char apn[32];
     char cnum[32];
     char imsi[32];
     char imei[32];
     char isp[32];
-    
-}cellular_info_t;
-
+}cell_info_t;
 
-typedef int (*cell_fn_t)(int cell, void *data, int len);
+typedef struct {
+    int  dbm;
+    int  ber;
+}cell_stat_t;
 
 int cellular_init(void);
 int cellular_deinit(void);
 int cellular_reset(void);
 
-int cellular_get_info(cellular_info_t *info);
-int cellular_set_cb(int cell, cell_fn_t fn);
-int cellular_send(int cell, void *data, int len);
-
-
-
+int cellular_get_info(cell_info_t *info);
+int cellular_get_stat(cell_stat_t *stat);
 
 #endif

+ 1 - 16
pro/src/mqtt.c

@@ -8,7 +8,6 @@
 #include "elog.h"
 #include "lock.h"
 #include "sys.h"
-#include "cfg.h"
 #include "xlist.h"
 #include "websocket_handle.h"
 #include "switch_ctrl.h"
@@ -37,20 +36,6 @@
 #define SEND_PERIOD         5000    //ms
 
 
-enum {
-    SERV_NTP=0,
-    SERV_SMTP,
-    SERV_MESG,
-    SERV_MQTT,
-    SERV_CLOUD,
-    SERV_TELNET,
-    SERV_SNMP_V1,
-    SERV_SNMP_V2C,
-    SERV_SNMP_V3,
-    SERV_SNMP_TRAP,
-    
-    SERV_MAX
-};
 #define BGET(flag,mask)  ((flag)&(1<<(mask)))
 #define BSET(flag,mask)  ((flag)|=(1<<(mask)))
 
@@ -494,7 +479,7 @@ static void mqtt_fn(mg_conn_t *c, int ev, void *ev_data)
         }
         break;
 
-        case  MG_EV_MQTT_OPEN:
+        case MG_EV_MQTT_OPEN:
         {
             send_once(conn);
             set_status(conn, 1);

+ 23 - 1
pro/src/mqtt.h

@@ -2,7 +2,7 @@
 #define __MQTT_Hx__
 
 #include <stdint.h>
-
+#include "cfg.h"
 
 enum {
     MQTT_SUB_CMD_POWER_ALL=0,
@@ -27,6 +27,20 @@ enum {
 
     MQTT_PUB_MAX
 };
+enum {
+    SERV_NTP=0,
+    SERV_SMTP,
+    SERV_MESG,
+    SERV_MQTT,
+    SERV_CLOUD,
+    SERV_TELNET,
+    SERV_SNMP_V1,
+    SERV_SNMP_V2C,
+    SERV_SNMP_V3,
+    SERV_SNMP_TRAP,
+    
+    SERV_MAX
+};
 
 typedef struct {
     int id;
@@ -41,4 +55,12 @@ int mqtt_deinit(void);
 int mqtt_post_alarm(int type, int subtype, char *content, alarm_para_t *para);
 int mqtt_test(void);
 
+
+#ifdef USE_MQTT
+extern char *topic_sub[MQTT_SUB_MAX];
+extern char *topic_pub[MQTT_PUB_MAX];
+extern const char *serv_str[SERV_MAX];
+#endif
+
+
 #endif