1、缩短按电源开机时间 80/1 80/head 81/target/1 82/target/1
authorSnickerSun <snickersun@163.com>
Thu, 25 Apr 2024 07:14:08 +0000 (15:14 +0800)
committerSnickerSun <snickersun@163.com>
Thu, 25 Apr 2024 07:14:08 +0000 (15:14 +0800)
2、添加runtime 接口,供整个系统使用
3、优化cat1 消息解析,都移动到cat1_server里,直接修改runtime
4、优化工厂测试 cat1 测试接口
5、custom_utils添加thread terminal接口

13 files changed:
code/sdk/application/brandy/brandy_standard/board_init.c
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testabout.cpp
code/sdk/application/wearable/fd230app/nativeui/producttest/src/testcat1.cpp
code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_ctl.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp
code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h
code/sdk/drivers/peripheral/utils/CMakeLists.txt
code/sdk/drivers/peripheral/utils/custom_runtime.c [new file with mode: 0644]
code/sdk/drivers/peripheral/utils/custom_runtime.h [new file with mode: 0644]
code/sdk/drivers/peripheral/utils/custom_utils.c
code/sdk/drivers/peripheral/utils/custom_utils.h

index 2003168..1adcbfc 100755 (executable)
@@ -133,7 +133,7 @@ void check_pwrkey_3s(void)
             uapi_tcxo_delay_ms(200);\r
         }\r
         \r
-        if(pressed_count <10 )\r
+        if(pressed_count < 5 )\r
         {\r
             PRINT("not pressed 3 seconds , poweroff!"NEWLINE);\r
             uapi_poweroff_device();\r
index 2409161..898ed3b 100644 (file)
@@ -140,6 +140,8 @@ namespace OHOS
         label_button->SetText("next");
         label_button->SetFont(DEFAULT_VECTOR_FONT_FILENAME, 44);
         label_button->SetStyleForState(STYLE_BORDER_COLOR, 0xff0b1928, UIButton::PRESSED);
+        label_button->SetStyle(STYLE_BACKGROUND_OPA, 0x80);
+
         UIView::OnClickListener *touchListener = static_cast<UIView::OnClickListener *>(testPresenter::GetInstance());
         label_button->SetOnClickListener(touchListener);
         // Add to rootView
index 794a056..b14c8c6 100644 (file)
@@ -7,6 +7,8 @@
 #include "cat1_server.h"
 #include "cat1_ctl.h"
 #include "cat1_server_hal.h"
+#include "custom_runtime.h"
+
 namespace OHOS
 {
 
@@ -30,13 +32,19 @@ namespace OHOS
 
         return g_pSystemAboutTheWatchView;
     }
-
+    static osTimerId_t  Gsenson_TEST_timer=NULL;
     void testcat1View::ClearAll()
     {
         if(testcat1ScrollView)
         {
             testcat1ScrollView->RemoveAll();
 
+            if (Gsenson_TEST_timer != NULL) {
+                osTimerStop(Gsenson_TEST_timer);
+                osTimerDelete(Gsenson_TEST_timer);
+                Gsenson_TEST_timer = NULL;
+                return ;
+            }
             if(button)
             {
                 delete button;
@@ -93,10 +101,10 @@ namespace OHOS
     void testcat1View:: setcat1vermsg(cat1_Ver t)
     {
         
-        if(label_1_cat1msg_1!=nullptr)
+        if(label_1_cat1vison!=nullptr)
         {
             char buf[124]={0};
-            sprintf(buf,"aoover:%s\nmodem_ver:%s\n",t.cat1appver,t.modem_version);
+            sprintf(buf,"appver:%s\nmodem_ver:%s\n",t.cat1appver,t.modem_version);
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",buf);
             label_1_cat1vison->SetText(buf);
             RootView::GetInstance()->Invalidate();
@@ -119,7 +127,7 @@ namespace OHOS
         button->SetStyleForState(STYLE_BACKGROUND_COLOR, Color::Black().full, UIButton::PRESSED);
         //button->SetStyleForState(STYLE_BORDER_RADIUS,0, UIButton::PRESSED);
         button->SetTouchable(true);
-
+        button->SetStyle(STYLE_BACKGROUND_OPA, 0x80);
         button->SetText(buttonconfig.str);
         button->SetAlign(TEXT_ALIGNMENT_LEFT);
         button->SetLabelPosition(buttonconfig.label_x,buttonconfig.label_y );
@@ -171,7 +179,30 @@ namespace OHOS
 
 
 
-
+    static void  mgdataTimerCallBack(int data)
+    {
+        cat1_getsignal();
+        cat1_getver();
+        runtime_status_t *runtime = get_device_runtime_status();
+        OHOS::testcat1View *pview = OHOS::testcat1View::GetInstance();
+        OHOS::testcat1View::cat1_Ver msgver={0};
+   
+        msgver.cat1appver = runtime->cat1_runtime.pyVer;
+        msgver.modem_version = runtime->cat1_runtime.modemVer;
+
+        OHOS::testcat1View::cat1_msg msg={0};
+        msg.imei = runtime->cat1_runtime.imei;
+        msg.sim = runtime->cat1_runtime.sim;
+        msg.signal = runtime->cat1_runtime.signal;
+        msg.oper = runtime->cat1_runtime.opera;
+   
+        if(pview !=NULL)
+        {
+            pview->setcat1vermsg(msgver);
+            pview->setcat1msg(msg);
+        }
+  
+    }
     
     bool testcat1View::tesScat1ScrollViewcrollViewinit(void)
     {
@@ -209,9 +240,9 @@ namespace OHOS
         Config = {
             .left = 50,
             .top = 200,
-            .width = 200,
+            .width = 350,
             .height = 35,
-            .fontSize = 30,
+            .fontSize = 25,
             .lineHeigh = 35,
             .text = "",
             .lineBreakMode = UILabel::LINE_BREAK_WRAP,
@@ -251,9 +282,9 @@ namespace OHOS
         /* -------------------------------------------------------------------------- */
         ButtonConfig_ext_t buttonconfig;
         buttonconfig.x = 100;
-        buttonconfig.y = 300;
+        buttonconfig.y = 350;
         buttonconfig.w = 180;
-        buttonconfig.h = 116;
+        buttonconfig.h = 96;
         buttonconfig.label_x=40;
         buttonconfig.label_y=0;
         buttonconfig.Fontsize=30;
@@ -303,8 +334,17 @@ namespace OHOS
 
         testcat1ScrollView->SetTouchable(true);
         testcat1ScrollView->SetDraggable(true);
-
-
+        uint32_t tick;
+        osStatus_t retTimer;
+        Gsenson_TEST_timer = osTimerNew((osTimerFunc_t)mgdataTimerCallBack, osTimerPeriodic, NULL, NULL);
+        tick =3000;// osMs2Tick(1000);
+        retTimer = osTimerStart(Gsenson_TEST_timer, tick);
+        if (retTimer != osOK && Gsenson_TEST_timer != NULL) {
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP,"StartCallTimer osTimerStart failed, ret = %lx!!", retTimer);
+            osTimerDelete(Gsenson_TEST_timer);
+            Gsenson_TEST_timer = NULL;
+            return false;
+        }
         return true;
     }
 
index e54d7e9..346ac7f 100644 (file)
@@ -24,6 +24,7 @@
 #include "nandflash_config.h"\r
 #include "string.h"\r
 #include "custom_utils.h"\r
+#include "custom_runtime.h"\r
 #include "bletest.h"\r
 #pragma pack(1)\r
 typedef struct factorytest_cmd_header_t\r
@@ -1253,17 +1254,8 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint
 \r
                 cat1_getsignal();\r
                 msleep(1000);\r
-                char *tokbuf=NULL;\r
-                tokbuf=strtok(networkmsg,":");\r
-                if(strcmp(tokbuf,"imei")==0)\r
-                {\r
-                    tokbuf=strtok(NULL,",");\r
-                    tokbuf=strtok(NULL,":");\r
-                    tokbuf=strtok(NULL,",");\r
-                    send_data[1]=atoi(tokbuf);\r
-                    PRINT("sim status : %d \r\n",send_data[1]);\r
-                }\r
-\r
+                runtime_status_t * runtime = get_device_runtime_status();\r
+                send_data[1]=runtime->cat1_runtime.sim;\r
                 factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
                         BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1,\r
                         0x03,\r
@@ -1276,21 +1268,8 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint
 \r
                 cat1_getsignal();\r
                 msleep(1000);\r
-                char *tokbuf=NULL;\r
-                tokbuf=strtok(networkmsg,":");\r
-                if(strcmp(tokbuf,"imei")==0)\r
-                {\r
-                    tokbuf=strtok(NULL,",");\r
-                    tokbuf=strtok(NULL,":");\r
-                    tokbuf=strtok(NULL,",");\r
-                    tokbuf=strtok(NULL,"(");\r
-                    tokbuf=strtok(NULL,")");\r
-                    tokbuf=strtok(NULL,":");\r
-                    tokbuf=strtok(NULL,",");\r
-                    send_data[1]=atoi(tokbuf);\r
-                    PRINT("signal : %d \r\n",send_data[1]);\r
-                }\r
-\r
+                runtime_status_t * runtime = get_device_runtime_status();\r
+                send_data[1]=runtime->cat1_runtime.signal;\r
 \r
                 factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
                         BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1,\r
@@ -1304,33 +1283,16 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint
 \r
                 cat1_getsignal();\r
                 msleep(1000);\r
-                char *tokbuf=NULL;\r
-                char *buf1=NULL;\r
-                char *buf2=NULL;\r
-\r
-                tokbuf=strtok(networkmsg,":");\r
-                if(strcmp(tokbuf,"imei")==0)\r
-                {\r
-                    //'CHN-CT', 'CT', '460', '11'\r
-                    tokbuf=strtok(NULL,",");\r
-                    tokbuf=strtok(NULL,":");\r
-                    tokbuf=strtok(NULL,",");\r
-                    tokbuf=strtok(NULL,"(");\r
-                    tokbuf=strtok(NULL,")");\r
-\r
-                    buf1=strtok(tokbuf+1,"-");\r
-                    buf2=strtok(NULL,"'");\r
-                     \r
-                     \r
-                    strcat(buf1,buf2);\r
-                    PRINT("send_buf : %s \r\n",buf1);\r
-                }\r
-\r
+ \r
+                runtime_status_t * runtime = get_device_runtime_status();\r
+             \r
+                PRINT("send_buf : %s \r\n",runtime->cat1_runtime.opera);\r
+                \r
                 factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST,\r
                         BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1,\r
                         0x05,\r
-                        (uint8_t *)buf1,\r
-                        5);\r
+                        (uint8_t *)runtime->cat1_runtime.opera,\r
+                        strlen(runtime->cat1_runtime.opera));\r
             } else if(testitem == 0x06)\r
             {\r
                 //拨打电话\r
index 208226f..366c2a0 100755 (executable)
@@ -42,7 +42,8 @@
 #include "power_display_service.h"
 #include "bletest.h"
 //#include "TraingCardPresenter.h"
-
+#include "custom_runtime.h"
+#include "producttest/include/testcat1.h"
 //#include "Systemupgrade.h"
 namespace OHOS {
 
@@ -607,84 +608,39 @@ void MsgCenterNotifyCat1CallEndedProc(const Topic topic, Request* req)
 
 
 }
+
+
 void MsgCenterNotifyCat1SignalUpdateProc(const Topic topic, Request* req)
 {
     unused(topic);
     unused(req);
+    // if (req->data == NULL) return ;
+    // runtime_status_t *runtime = get_device_runtime_status();
+    // OHOS::testcat1View *pview = OHOS::testcat1View::GetInstance();
+    // if (strcmp((const char*)req->data,"verupdate") == 0)
+    // {
+    //    OHOS::testcat1View::cat1_Ver msgver={0};
+    //     msgver.cat1appver = runtime->cat1_runtime.pyVer;
+    //     msgver.modem_version = runtime->cat1_runtime.modemVer;
+    //     if(pview !=NULL)
+    //     {
+    //         pview->setcat1vermsg(msgver);
+    //     }
+
+    // }else if (strcmp((const char*)req->data,"netupdate") == 0)
+    // {
+        
+    //     OHOS::testcat1View::cat1_msg msg={0};
+    //     msg.imei = runtime->cat1_runtime.imei;
+    //     msg.sim = runtime->cat1_runtime.sim;
+    //     msg.signal = runtime->cat1_runtime.signal;
+    //     msg.oper = runtime->cat1_runtime.opera;
+    //     if (pview!=NULL)
+    //     {
+    //         pview->setcat1msg(msg);
+    //     }
+    // }
     
-    char* str= (char *)req->data;
-    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",str);
-    char *tokbuf=NULL;
-    tokbuf=strtok(str,":");
-    if(strcmp(tokbuf,"imei")==0)
-    {
-        testcat1View ::cat1_msg cat1_msg_T;
-        tokbuf=strtok(NULL,",");
-        cat1_msg_T.imei=(char*)malloc(strlen(tokbuf));
-        strcpy( cat1_msg_T.imei,tokbuf);
-        ConfigModel::GetInstance()->Setimei(cat1_msg_T.imei);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",cat1_msg_T.imei);
-        tokbuf=strtok(NULL,":");
-        tokbuf=strtok(NULL,",");
-        cat1_msg_T.sim=atoi(tokbuf);
-        //strcpy( cat1_msg_T.imei,tokbuf);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d",cat1_msg_T.sim);
-        tokbuf=strtok(NULL,"(");
-        tokbuf=strtok(NULL,")");
-        cat1_msg_T.oper=(char*)malloc(strlen(tokbuf));
-        strcpy( cat1_msg_T.oper,tokbuf);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",cat1_msg_T.oper);
-        tokbuf=strtok(NULL,":");
-        tokbuf=strtok(NULL,",");
-        cat1_msg_T.signal=atoi(tokbuf);
-        WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%d",cat1_msg_T.signal);
-        testcat1View* t=testcat1View::GetInstance();
-        if(t!=NULL)
-        t->setcat1msg(cat1_msg_T);
-
-        free(cat1_msg_T.imei);
-        free(cat1_msg_T.oper);
-    }
-    else if(strcmp(tokbuf,"pyVer")==0)
-    {
-        testcat1View ::cat1_Ver cat1_ver_T;
-        tokbuf=strtok(NULL,",");
-        cat1_ver_T.cat1appver=(char*)malloc(strlen(tokbuf));
-        strcpy( cat1_ver_T.cat1appver,tokbuf);
-        ConfigModel::GetInstance()->SetpyVer(tokbuf);
-        tokbuf=strtok(NULL,",");
-        tokbuf=strtok(NULL,",");
-        cat1_ver_T.modem_version=(char*)malloc(strlen(tokbuf));
-        strcpy( cat1_ver_T.modem_version,tokbuf);
-        ConfigModel::GetInstance()->SetmoderVer(tokbuf);
-    
-        testcat1View* t=testcat1View::GetInstance();
-        if(t!=NULL)
-        t->setcat1vermsg(cat1_ver_T);
-
-        free(cat1_ver_T.cat1appver);
-        free(cat1_ver_T.modem_version);
-
-    } //"BOOTUP,pyVer,PY_SRV_V4,modemVer,EG810MCNLAR06A01M08_VOLTE_OCPU_QPY_BETA0312"
-    else if(strcmp(tokbuf,"BOOTUP")==0)
-    {
-        //testcat1View ::cat1_Ver cat1_ver_T;
-        tokbuf=strtok(NULL,",");
-        if(strcmp(tokbuf,"pyVer")==0)
-        {
-            tokbuf=strtok(NULL,",");
-            ConfigModel::GetInstance()->SetpyVer(tokbuf);
-        }
-        tokbuf=strtok(NULL,",");
-        if(strcmp(tokbuf,"modemVer")==0)
-        {
-            tokbuf=strtok(NULL,"\0");
-            ConfigModel::GetInstance()->SetmoderVer(tokbuf);
-        } 
-        // SystemupgradeView* t=SystemupgradeView::GetInstance();
-        // if(t!=NULL)
-        // t->cat1_up_success();
-    }
     
 }
 void MsgCenterNotifyCat1PowerOffProc(const Topic topic, Request* req)
index 768a6ea..24b0234 100644 (file)
@@ -103,6 +103,7 @@ extern void restart_sleep_cat1_timer(void);
 void cat1_ring_isr_callback(pin_t pin, uintptr_t param)
 {
     WEARABLE_LOGW(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1_ring_isr_callback %d 0x%X\n",pin,param);
+    uapi_gpio_clear_interrupt(pin);
     do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_ADD_CAT1VOTE,NULL,0);
 }
 
index 84c10be..dd8ed02 100644 (file)
@@ -26,8 +26,9 @@
 
 
 #include "config/include/ConfigModelC.h"
-
+#include "config/include/ConfigModel.h"
 #include "wearable_log.h"
+#include "custom_runtime.h"
 
 // #include "graphic_service.h"
 
@@ -172,7 +173,162 @@ void udp_send_msg_toCat1(char cmd,char *content)
      uapi_cat1_wakeup_cat1(0);
 }
 
+#define BOOTMSG_HEADER_STR "BOOTUP:"
+#define BOOTMSG_HEADER_STR_LEN strlen(BOOTMSG_HEADER_STR)
+#define NETSTAT_HEADER_STR "imei:"
+#define NETSTAT_HEADER_STR_LEN strlen(NETSTAT_HEADER_STR)
+#define VERMSG_HEADER_STR "pyVer,"
+#define VERMSG_HEADER_STR_LEN strlen(VERMSG_HEADER_STR)
+#define MSG_SPLIT_CHAR ","
+
+
+static int decodeVersion(char* msg)
+{
+    if (strlen(msg) < 50)
+    {
+        PRINT("msg len is too short !\r\n");
+        return  -1;
+    }
+    char buf[200] = {0};
+    if (strncmp(msg,BOOTMSG_HEADER_STR,BOOTMSG_HEADER_STR_LEN) ==0)
+    {
+        strcpy(buf,msg+BOOTMSG_HEADER_STR_LEN);
+        // PRINT("BOOTMSG =============\r\n");
+    }
+    else if (strncmp(msg,VERMSG_HEADER_STR,VERMSG_HEADER_STR_LEN) ==0)
+    {
+        strcpy(buf,msg);
+        // PRINT("version =============\r\n");
+    }else{
+        return -2;
+    }
+    char* p = MSG_SPLIT_CHAR;
+    char* s = NULL;
+    char *pbuf[4] = {0};
+    int  i = 0;
+    int update = 0;
+    runtime_status_t * runtime = get_device_runtime_status();
+    for (s = strtok(buf,p); s!=NULL;s=strtok(NULL,p))
+    {
+        pbuf[i] = s;
+        if(i==1) 
+        {
+            // PRINT("pyVer= %s\r\n",pbuf[i]);
+            if (strncmp(pbuf[i],"PY_",3) == 0 || strcmp(runtime->cat1_runtime.pyVer,pbuf[i])==0 )
+            {
+                update++;
+            }
+            memset(runtime->cat1_runtime.pyVer,0,sizeof(runtime->cat1_runtime.pyVer));
+            strcpy_s(runtime->cat1_runtime.pyVer,sizeof(runtime->cat1_runtime.pyVer),pbuf[i]);
+        }
+        else if (i==3)
+        {
+            // PRINT("modemVer= %s\r\n",pbuf[i]);
+            if (strncmp(pbuf[i],"EG810M",6) == 0 || strcmp(runtime->cat1_runtime.modemVer,pbuf[i]) == 0)
+            {
+                update++;
+            }
+            memset(runtime->cat1_runtime.modemVer,0,sizeof(runtime->cat1_runtime.modemVer));
+            strcpy_s(runtime->cat1_runtime.modemVer,sizeof(runtime->cat1_runtime.modemVer),pbuf[i]);
+        }
+        i++;
+    }
+    if (update > 0)
+        return 0;
+    else 
+        return -3;
+}
+
+
+static int decodeNetStat(char* msg)
+{
+    if (strlen(msg) < 50)
+    {
+        PRINT("msg len is too short !\r\n");
+        return  -1;
+    }
+    char buf[200] = {0};
+    if (strncmp(msg,NETSTAT_HEADER_STR,NETSTAT_HEADER_STR_LEN) ==0)
+    {
+        strcpy(buf,msg);
+        // PRINT("net stat  =============\r\n");
+    }else{
+        return -2;
+    }
+    char* p = MSG_SPLIT_CHAR;
+    char* s = NULL;
+    char *pbuf[6] = {0};
+    char *ppbuf ;
+    int  i = 0;
+    int update = 0;
+    runtime_status_t * runtime = get_device_runtime_status();
+    for (s = strtok(buf,p); s!=NULL;s=strtok(NULL,p))
+    {
+        pbuf[i] = s;
+        if(strncmp(pbuf[i],"imei:",5) == 0)
+        {
+            ppbuf=pbuf[i]+5;
+            PRINT("=== imei = %s\r\n",ppbuf);
+            if ( strcmp(runtime->cat1_runtime.imei,ppbuf)==0 )
+            {
+                 update++;
+            }   
+            memset(runtime->cat1_runtime.imei,0,sizeof(runtime->cat1_runtime.imei));
+            strcpy_s(runtime->cat1_runtime.imei,sizeof(runtime->cat1_runtime.imei),ppbuf);
+            i++;
+            continue;
+        } 
+        if(strncmp(pbuf[i],"sim:",4) == 0)
+        {
+            ppbuf=pbuf[i]+4;
+            int simstat = atoi(ppbuf);
+            PRINT("=== sim = %d\r\n",simstat);
+            if ( runtime->cat1_runtime.sim != simstat)
+            {
+                update++;
+            }  
+            runtime->cat1_runtime.sim = simstat;
+            i++;
+            continue;
+        }   
+        if(strncmp(pbuf[i],"oper:",5) == 0)
+        {
 
+            if( *(pbuf[i]+5) == '(' )
+                ppbuf=pbuf[i]+6;
+            else 
+                ppbuf=pbuf[i]+5;
+        
+            PRINT("=== opera = %s\r\n",ppbuf);
+            if ( strcmp(runtime->cat1_runtime.opera,ppbuf)==0 )
+            {
+                 update++;
+            } 
+            memset(runtime->cat1_runtime.opera,0,sizeof(runtime->cat1_runtime.opera));
+            strcpy_s(runtime->cat1_runtime.opera,sizeof(runtime->cat1_runtime.opera),ppbuf);
+            i++;
+            continue;
+        }
+        if(strncmp(pbuf[i],"signal:",7) == 0)
+        {
+            ppbuf=pbuf[i]+7;
+            int signals = atoi(ppbuf);
+            PRINT("=== signal = %d\r\n",signals);
+            if ( runtime->cat1_runtime.signal != signals)
+            {
+                update++;
+            }  
+            runtime->cat1_runtime.signal = signals;
+            i++;
+            continue;
+        }  
+        if (i>=4) break;
+    }
+    if (update > 0)
+        return 0;
+    else 
+        return -3;
+}
 void cat1_call_hungup(void)
 {
     udp_send_msg_toCat1(UDP_CMD_HUNGUP,"0");
@@ -263,34 +419,37 @@ void test_call_incomming(void)
     cat1_handle_call_incomming(&msg);
 }
 
-char networkmsg[124]={0};
 int cat1_handle_networ_msg(struct tcp_msg_t *msg)
 {
-    memset(networkmsg,0,124);
-    strcpy(networkmsg,msg->buffer);
-    if(msg->head[1]=='0')
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",msg->buffer);
+    if(decodeNetStat(msg->buffer) == 0)
     {
-        networkmsg[5]=':';
-    } //"pyVer:PY_OTA_V3,modemVer,EG810MCNLAR06A01M08_VOLTE_OCPU_QPY_BETA0312"
-    WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",networkmsg);
-    cat1_msg_event_sendmsg_toUI(networkmsg);
+        runtime_status_t * runtime = get_device_runtime_status();
+        OHOS::ConfigModel::GetInstance()->Setimei(runtime->cat1_runtime.imei);
+        cat1_msg_event_sendmsg_toUI("netupdate");
+    }
     //显示UI 信号
     return 1;
 }
 
-static char BOOTUP_msg[124]={0};
 int cat1_handle_version_msg(struct tcp_msg_t *msg)
 {
-    memset(BOOTUP_msg,0,124);
-    strcpy(BOOTUP_msg,msg->buffer);
-    if(msg->head[1]=='F')
+   
+    WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",msg->buffer);
+   
+
+// BOOTUP:pyVer,PY_SRV_V4,modemVer,EG810MCNLAR06A01M08_VOLTE_OCPU_QPY_BETA0312
+// pyVer,PY_SRV_V4,modemVer,EG810MCNLAR06A01M08_VOLTE_OCPU_QPY_BETA0312
+// imei:860132060352796,sim:0,oper:-1,signal:99,net:([99, 0, 0, 0], [0, 0, 0, 0, 0])
+
+    if(decodeVersion(msg->buffer) == 0)
     {
-        BOOTUP_msg[6]=':';
+        runtime_status_t * runtime = get_device_runtime_status();
+        OHOS::ConfigModel::GetInstance()->SetpyVer(runtime->cat1_runtime.pyVer);
+        OHOS::ConfigModel::GetInstance()->SetmoderVer(runtime->cat1_runtime.modemVer);
+        cat1_msg_event_sendmsg_toUI("verupdate");
     }
-    WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",msg->buffer);
-    WEARABLE_LOGI(WEARABLE_LOG_MODULE_MAIN_SERVICE,"cat1 cat1_handle_networ_msg %s\n",BOOTUP_msg);
-    cat1_msg_event_sendmsg_toUI(BOOTUP_msg);
-    //显示UI 信号
+
     return 1;
 }
 
@@ -456,7 +615,7 @@ static int udp_packet_parse(char *rx_buffer, int len)
                
                 break;
              case UDP_CMD_GET_CAT1VER:
-                index = cat1_handle_networ_msg(msg);
+                index = cat1_handle_version_msg(msg);
                 break;
                    default:
                            PRINT("error message: %s\n", rx_buffer);
index f672f39..3032a0b 100644 (file)
@@ -30,8 +30,6 @@ void cat1_reset_network(void);
 
 errcode_t cat1_server_init(void);
 
-extern char networkmsg[124];
-
 #ifdef __cplusplus
 #if __cplusplus
 }
index 1867dbd..e19271f 100644 (file)
@@ -8,6 +8,7 @@ set(SOURCES
     ${CMAKE_CURRENT_SOURCE_DIR}/custom_utils.c
     ${CMAKE_CURRENT_SOURCE_DIR}/custom_utils_at_cmd.c
     ${CMAKE_CURRENT_SOURCE_DIR}/custom_cmd_service.c
+    ${CMAKE_CURRENT_SOURCE_DIR}/custom_runtime.c
 )
 
 set(PUBLIC_HEADER
diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.c b/code/sdk/drivers/peripheral/utils/custom_runtime.c
new file mode 100644 (file)
index 0000000..1bb0e6d
--- /dev/null
@@ -0,0 +1,8 @@
+#include "custom_runtime.h"
+
+static runtime_status_t g_runtime={0};
+runtime_status_t * get_device_runtime_status(void)
+{
+    return &g_runtime;
+}
+
diff --git a/code/sdk/drivers/peripheral/utils/custom_runtime.h b/code/sdk/drivers/peripheral/utils/custom_runtime.h
new file mode 100644 (file)
index 0000000..da896fb
--- /dev/null
@@ -0,0 +1,65 @@
+/**
+ * Copyright (c) @CompanyNameMagicTag 2022-2022. All rights reserved. \n
+ *
+ * Description: Provides at cmd register func \n
+ * Author: @CompanyNameTag \n
+ * History: \n
+ * 2022-07-20, Create file. \n
+ */
+#ifndef CUSTOM_RUNTIME_H
+#define CUSTOM_RUNTIME_H
+
+#include <stdint.h>
+#include <stdio.h>
+#include "errcode.h"
+#include "soc_osal.h"
+
+#ifdef __cplusplus
+#if __cplusplus
+extern "C" {
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+typedef enum{
+    CAT1_2G,
+    CAT1_3G,
+    CAT1_4G,
+    CAT1_5G
+} cat1_network_type_t;
+
+typedef struct 
+{
+    uint8_t cat1_powerOn;
+    uint8_t volte ;
+    uint8_t network_on ;
+    uint8_t cat1_network_type ;
+    int sim ;
+    int signal ;
+    char opera[20] ;
+    char imei[20] ;
+    char pyVer[20] ;
+    char modemVer[64] ;
+}cat1_runtime_status_t;
+
+
+typedef struct 
+{
+    uint8_t in_silent_mode;
+    uint8_t in_lowpower_mode;
+    uint8_t stepcount;
+    uint8_t bt_powerOn;
+    uint8_t bt_connected;
+
+    cat1_runtime_status_t cat1_runtime;
+
+} runtime_status_t;
+
+runtime_status_t * get_device_runtime_status(void);
+
+#ifdef __cplusplus
+#if __cplusplus
+}
+#endif /* __cplusplus */
+#endif /* __cplusplus */
+
+#endif
index 726d609..4eaa271 100644 (file)
@@ -59,6 +59,12 @@ errcode_t uapi_create_osThread_custom(app_task_definition_t *task_cfg)
     return ERRCODE_SUCC;
 }
 
+errcode_t uapi_terminate_thread(void* thread_id)
+{
+    osStatus_t ret = osThreadTerminate((osThreadId_t)thread_id);
+    return ret;
+}
+
 uint32_t zh_get_sn(uint8_t *buf_sn, uint32_t *len_sn)
 {
 
index 6333167..18449d2 100644 (file)
@@ -75,6 +75,7 @@ errcode_t init_btaddr_btname(void);
 errcode_t disable_bt_service(void);
 
 errcode_t uapi_create_osThread_custom(app_task_definition_t *task_cfg);
+errcode_t uapi_terminate_thread(void* thread_id);
 
 errcode_t uapi_get_buildversion(uint8_t *para, uint32_t para_len);
 /**