漏光测试
authortimekeeper <1624952103@qq.com>
Sat, 16 Mar 2024 07:55:52 +0000 (15:55 +0800)
committertimekeeper <1624952103@qq.com>
Sat, 16 Mar 2024 07:55:52 +0000 (15:55 +0800)
code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c
code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp
code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c
code/sdk/drivers/peripheral/ppg/service/ppg_at_cmd.cpp
code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp

index 15731c6..b41c00f 100755 (executable)
@@ -33,6 +33,7 @@ static const TopicToCore topicToCoreArray[] = {
     {TOPIC_EVENT_START_SPO2_MONITORING, A_CORE_MASK, 1},
     {TOPIC_EVENT_STOP_SPO2_MONITORING, A_CORE_MASK, 1},
     {TOPIC_EVENT_GRAYCARD_UPDATA, A_CORE_MASK, 1},
+    {TOPIC_EVENT_LEAKLIGHT_UPDATA, A_CORE_MASK, 1},
 #endif
     {TOPIC_EVENT_HFP_INCOMMING, A_CORE_MASK, 1},
     {TOPIC_EVENT_HFP_PHONE_ACTIVE, A_CORE_MASK, 1},
index 6887ad5..90b610b 100755 (executable)
@@ -70,6 +70,7 @@ const PriorityMapper g_pri_mapper[] = {
     {TOPIC_EVENT_START_SPO2_MONITORING, PRIORITY_TWO},
     {TOPIC_EVENT_STOP_SPO2_MONITORING, PRIORITY_TWO},
     {TOPIC_EVENT_GRAYCARD_UPDATA, PRIORITY_TWO},
+    {TOPIC_EVENT_LEAKLIGHT_UPDATA, PRIORITY_TWO},
 #endif
 };
 
@@ -113,6 +114,7 @@ void MsgCenterSubscribe()
     MsgCenterSubscribeTopic(TOPIC_EVENT_START_SPO2_MONITORING);
     MsgCenterSubscribeTopic(TOPIC_EVENT_STOP_SPO2_MONITORING);
     MsgCenterSubscribeTopic(TOPIC_EVENT_GRAYCARD_UPDATA);
+    MsgCenterSubscribeTopic(TOPIC_EVENT_LEAKLIGHT_UPDATA);
 #endif
 #ifdef SUPPORT_CAT1_MODEM
     MsgCenterSubscribeTopic(TOPIC_EVENT_CAT1_INCOMMING);
@@ -251,6 +253,19 @@ void MsgCenterNotifyCardhProc(const Topic topic, Request* req)
     //     BloodOxygenModel::GetInstance()->UpSPO2data(sp02);
     // }
 }
+
+void MsgCenterNotifyleaklighthProc(const Topic topic, Request* req)
+{
+    unused(topic);
+    unused(req);
+    // if (topic == TOPIC_EVENT_SPO2_UPDATE && req != nullptr && req->data != nullptr)
+    // {
+    //     u_int8_t sp02 = *((u_int8_t*)(req->data)); // 进行类型转换
+    //     DialModelSPO2::GetInstance()->UpdateSPO2(sp02);
+    //     BloodOxygenModel::GetInstance()->UpSPO2data(sp02);
+    // }
+}
+
 //穿戴状态
 void MsgCenterNotifyWearStateProc(const Topic topic, Request* req)
 {
@@ -457,6 +472,7 @@ static msg_center_notify_table_t g_msg_center_notify_table[] = {
     {TOPIC_EVENT_START_SPO2_MONITORING, MsgCenterNotifyStartSPO2MonitoringProc},
     {TOPIC_EVENT_STOP_SPO2_MONITORING,  MsgCenterNotifyStopSPO2MonitoringProc},
     {TOPIC_EVENT_GRAYCARD_UPDATA,       MsgCenterNotifyCardhProc},
+    {TOPIC_EVENT_LEAKLIGHT_UPDATA,      MsgCenterNotifyleaklighthProc},
 #endif
 #ifdef SUPPORT_CAT1_MODEM
     {TOPIC_EVENT_CAT1_INCOMMING,        MsgCenterNotifyCatIncomingCallProc},
index c22003b..cad40dd 100644 (file)
@@ -2222,7 +2222,7 @@ void hx3695_check_touch_init(void) //
 // 初始化调用入口函数\r
 bool hx3695_init(WORK_MODE_T mode)\r
 {\r
-\r
+  hx3695_msg_callback_t func;\r
        TYHX_LOG(" hx3695_init mode : %d \n", mode);\r
        \r
     work_mode_flag = mode;\r
@@ -2306,7 +2306,15 @@ bool hx3695_init(WORK_MODE_T mode)
             AGC_LOG("hx3695 check id failed!\r\n");\r
             return false;\r
         }\r
+        TYHX_LOG(" hx3695_init mode : LEAK_LIGHT_MODE \n");\r
         hx3695_factroy_test(LEAK_LIGHT_TEST);\r
+\r
+        func =  hx3695_get_send_msg_callback_func();\r
+        if(func != NULL)\r
+        {\r
+          func(HX3695_MSG_TYPE_LEAKLIGHT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t));\r
+        }\r
+        break;\r
         return true;\r
 \r
         break;\r
@@ -2320,7 +2328,7 @@ bool hx3695_init(WORK_MODE_T mode)
         TYHX_LOG(" hx3695_init mode : GRAY_CARD_MODE \n");\r
         hx3695_factroy_test(GRAY_CARD_TEST);\r
 \r
-        hx3695_msg_callback_t func =  hx3695_get_send_msg_callback_func();\r
+        func =  hx3695_get_send_msg_callback_func();\r
         if(func != NULL)\r
         {\r
           func(HX3695_MSG_TYPE_GRAYCARD_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t));\r
index 822406b..afb4007 100644 (file)
@@ -95,18 +95,11 @@ static uint32_t ppg_do_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
     return ERRCODE_SUCC;
 }
 
-static uint32_t ppg_my_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd)
-{
-    UNUSED(strCommonCmd);
-    printf("PPG MY TEST\n");
-    return ERRCODE_SUCC;
-}
-
 
 static const at_cmd_table_t g_ppg_cmd[] = {
     { (char *)"AT^PPGTEST",      ppg_do_test, (char *)"hrs enable" },
     { (char *)"AT^PPGTEST",      ppg_do_test, (char *)"graycard enable"},
-    { (char *)"AT^LEAKLGIHTTEST",      ppg_do_test, (char *)"leaklight enable"},
+    { (char *)"AT^PPGTEST",      ppg_do_test, (char *)"leaklight enable"},
 };
 
 at_cmd_table_t *get_ppg_cmd_table(uint32_t *cmd_count)
index d484249..56fc388 100644 (file)
@@ -47,8 +47,8 @@ extern "C" {
 
 static bool g_ppg_service_initialled = false;
 
-uint8_t databuf[64] = {0};
-
+uint8_t card_databuf[64] = {0};
+uint8_t light_databuf[64] = {0};
 /***
  * 其他cmd在Header里定义,对外开放
 */
@@ -109,7 +109,22 @@ void CustomEventPublish(uint16_t topic, uint8_t *data , uint32_t size)
 
     return;
 }
+//漏光测试
+errcode_t update_leaklight_event_notify(uint8_t *data)
+{
+    WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "send lightdata to ui %s",data);
+    CustomEventPublish(TOPIC_EVENT_LEAKLIGHT_UPDATA,(uint8_t*)&data,sizeof(data));
+    return 0;
+}
+errcode_t update_leaklight_event_sendmsg_toUI(uint8_t *data)
+{
+    /**通过UI事件发送Notify*/
+    GraphicService::GetInstance()->PostGraphicEvent(std::bind(update_leaklight_event_notify, data));
+    return ERRCODE_SUCC;
+}
+
 
+//灰卡测试
 errcode_t update_graycard_event_notify(uint8_t *data)
 {
     WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "send carddata to ui %s",data);
@@ -192,21 +207,22 @@ void hx3695_msg_callback(uint8_t msg_type, uint8_t *msg_data, int32_t msg_datale
             update_spo2_event_sendmsg_toUI(sensor_data.lastestspo2);
             break;
         case HX3695_MSG_TYPE_LEAKLIGHT_UPDATE:
-            // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_leak_green_UPDATE = %d", sensor_data.leak_green);
-            // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_leak_green_UPDATE = %d", sensor_data.leak_red);
-            // WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_leak_green_UPDATE = %d", sensor_data.leak_ir);
-            // update_spo2_event_sendmsg_toUI(sensor_data.leak_green);
-            // update_spo2_event_sendmsg_toUI(sensor_data.leak_red);
-            // update_spo2_event_sendmsg_toUI(sensor_data.leak_ir);
+            memset_s(light_databuf,64,0,64);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "LEAKLIGHT_UPDATE");
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_leak_green_UPDATE = %d", sensor_data.leak_green);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_leak_red_UPDATE = %d", sensor_data.leak_red);
+            WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_leak_ir_UPDATE = %d", sensor_data.leak_ir);
+            sprintf((char *)light_databuf,"%d,%d,%d",sensor_data.leak_green,sensor_data.leak_red,sensor_data.leak_ir);
+            update_leaklight_event_sendmsg_toUI(light_databuf);
             break;
         case HX3695_MSG_TYPE_GRAYCARD_UPDATE:
-            memset_s(databuf,64,0,64);
+            memset_s(card_databuf,64,0,64);
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "GRAYCARD_UPDATE");
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_card_green_UPDATE = %d", sensor_data.card_green);
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_card_red_UPDATE = %d", sensor_data.card_red);
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_card_ir_UPDATE = %d", sensor_data.card_ir);
-            sprintf((char *)databuf,"%d,%d,%d",sensor_data.card_green,sensor_data.card_red,sensor_data.card_ir);
-            update_graycard_event_sendmsg_toUI(databuf);
+            sprintf((char *)card_databuf,"%d,%d,%d",sensor_data.card_green,sensor_data.card_red,sensor_data.card_ir);
+            update_graycard_event_sendmsg_toUI(card_databuf);
             break;
         case HX3695_MSG_TYPE_WEARSTAT_UPDATE:
             WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_WEARSTATUS_UPDATE = %d", sensor_data.wearstatus);