|
@@ -0,0 +1,76 @@
|
|
|
|
|
+#include <time.h>
|
|
|
|
|
+#include "common.h"
|
|
|
|
|
+#include "Cellular.h"
|
|
|
|
|
+#include <pthread.h>
|
|
|
|
|
+#include "thread.h"
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+static void* Cellular_thread(void *arg)
|
|
|
|
|
+{
|
|
|
|
|
+ while(1) {
|
|
|
|
|
+
|
|
|
|
|
+ sleep(100);
|
|
|
|
|
+ }
|
|
|
|
|
+ pthread_exit(NULL);
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+/**
|
|
|
|
|
+ * @brief 初始化蜂窝通信模块
|
|
|
|
|
+ *
|
|
|
|
|
+ * 该函数用于初始化蜂窝通信模块。
|
|
|
|
|
+ *
|
|
|
|
|
+ * @return 初始化结果。如果初始化成功,返回0;如果初始化失败,返回-1。
|
|
|
|
|
+ */
|
|
|
|
|
+int Cellular_init(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int r = -1;
|
|
|
|
|
+
|
|
|
|
|
+ InitCellularManager();
|
|
|
|
|
+ if (_globalCellularManager.mode == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ thread_start(THREAD_ID_Cellular, Cellular_thread, &_globalCellularManager);
|
|
|
|
|
+ r = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int Cellular_deinit(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int r=-1;
|
|
|
|
|
+
|
|
|
|
|
+ if (_globalCellularManager.mode == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ r = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int WIFI_init(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int r = -1;
|
|
|
|
|
+
|
|
|
|
|
+ InitWIFIManager();
|
|
|
|
|
+ if (_globalWIFIManager.mode == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+
|
|
|
|
|
+ //thread_start(THREAD_ID_Cellular, Cellular_thread, &_globalCellularManager);
|
|
|
|
|
+ r = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+int WIFI_deinit(void)
|
|
|
|
|
+{
|
|
|
|
|
+ int r=-1;
|
|
|
|
|
+
|
|
|
|
|
+ if (_globalWIFIManager.mode == 1)
|
|
|
|
|
+ {
|
|
|
|
|
+ r = 0;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ return r;
|
|
|
|
|
+}
|
|
|
|
|
+
|