From e208c82ed32586a1f22739d886d03f122007b389 Mon Sep 17 00:00:00 2001 From: penglei <1624952103@qq.com> Date: Thu, 25 Jul 2024 18:46:21 +0800 Subject: [PATCH] =?utf8?q?=E4=BC=98=E5=8C=96=E8=93=9D=E7=89=99=E4=BA=A7?= =?utf8?q?=E6=B5=8B=EF=BC=8C=E6=B7=BB=E5=8A=A0=E8=80=81=E5=8C=96=E6=B5=8B?= =?utf8?q?=E8=AF=95=EF=BC=8C=E4=BC=98=E5=8C=96=E5=BF=83=E7=8E=87=E8=AE=A1?= =?utf8?q?=E7=AE=97=EF=BC=8C=E6=B7=BB=E5=8A=A0=E9=9D=99=E6=81=AF=E5=BF=83?= =?utf8?q?=E7=8E=87=EF=BC=8C=E4=BC=98=E5=8C=96a5133=E9=A9=B1=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../battery/service/battery_service.cpp | 10 +- .../nativeui/alarm/src/AlarmClockModel.cpp | 2 +- .../producttest/include/testmicrophoneC.h | 4 +- .../nativeui/producttest/src/testLCD.cpp | 3 +- .../producttest/src/testmicrophone.cpp | 24 +-- .../broadcast/include/broadcast_feature.h | 1 + .../broadcast/src/broadcast_implement.c | 1 + .../factorytest_protocol.c | 4 +- .../include/notify/findwatch_notification.h | 12 +- .../msg_center/src/msg_center_customer.cpp | 11 +- .../src/notify/findwatch_notification.cpp | 43 ++--- .../brandy_evb/board_config/board_evb.h | 4 +- code/sdk/drivers/peripheral/a5133/A5133Main.c | 2 +- code/sdk/drivers/peripheral/a5133/A5133Uti.c | 27 ++- code/sdk/drivers/peripheral/a5133/A5133Uti.h | 4 +- .../a5133/service/a5133_service.cpp | 34 ++-- .../peripheral/acc/service/acc_service.c | 2 +- .../drivers/peripheral/cywee/Inc/cywee_hal.h | 2 +- .../drivers/peripheral/cywee/src/main_dml.c | 11 +- .../drivers/peripheral/ppg/hx3695/hx3695.c | 51 +++++- .../peripheral/ppg/hx3695/hx3695_hal.h | 11 ++ .../peripheral/ppg/service/ppg_service.cpp | 19 ++- .../peripheral/utils/custom_cmd_service.c | 1 + .../drivers/peripheral/utils/custom_utils.c | 155 +++++++++++++++++- .../drivers/peripheral/utils/custom_utils.h | 5 +- .../peripheral/utils/custom_utils_at_cmd.c | 40 ++++- .../vibrator/service/vibrator_service.cpp | 2 +- 27 files changed, 400 insertions(+), 85 deletions(-) diff --git a/code/sdk/application/battery/service/battery_service.cpp b/code/sdk/application/battery/service/battery_service.cpp index 771686b77..2c645d4c2 100644 --- a/code/sdk/application/battery/service/battery_service.cpp +++ b/code/sdk/application/battery/service/battery_service.cpp @@ -203,14 +203,14 @@ static void battery_check_chargement(void) { PRINT("%d >= 90 percent , enable low current charge !\r\n",percent); enable_charge(); - enable_02c(); + //enable_02c(); g_chargestatus = 1; } else { PRINT("%d < 90 percent , enable normal current charge !\r\n",percent); enable_charge(); - disable_02c(); + //disable_02c(); g_chargestatus = 2; } // PRINT("%d\r\n",BATTERY_VOLTAGE_DEBOUNCE); @@ -243,13 +243,13 @@ static void battery_check_chargement(void) if(percent >=90) { PRINT("%d >= 90 percent , enable low current charge !\r\n",percent); - enable_02c(); + //enable_02c(); g_chargestatus = 1; } else { PRINT("%d < 90 percent , enable normal current charge !\r\n",percent); - disable_02c(); + //disable_02c(); g_chargestatus = 2; } // PRINT("%d\r\n",BATTERY_VOLTAGE_DEBOUNCE); @@ -260,7 +260,7 @@ static void battery_check_chargement(void) PRINT("charger not plugged ,disable charge !\r\n"); enable_charge(); //防漏电 - enable_02c(); //防漏电 + //enable_02c(); //防漏电 g_chargestatus = 0; /** diff --git a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp index 05fb0715f..1dd336c76 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/alarm/src/AlarmClockModel.cpp @@ -746,7 +746,7 @@ int AlarmClockModel::AlarmPlayerStat() return OHOS_FAILURE; } playerCtr->SetAudioSessionId(sessionId); - playerCtr->SetVolume(amIntance.GetMaxVolume(AUDIO_STREAM_ALARM_CLOCK),amIntance.GetMaxVolume(AUDIO_STREAM_ALARM_CLOCK)); + playerCtr->SetVolume(amIntance.GetMaxVolume(AUDIO_STREAM_MUSIC),amIntance.GetMaxVolume(AUDIO_STREAM_MUSIC)); // 播放 playerCtr->Play(); return OHOS_SUCCESS; diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophoneC.h b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophoneC.h index d7bf6e0ea..81c4cc03f 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophoneC.h +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophoneC.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-06-07 11:18:25 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-06-08 17:28:26 + * @LastEditTime: 2024-07-24 11:56:54 * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/producttest/include/testmicrophoneC.h * @Description: * @@ -17,7 +17,7 @@ extern "C" { #endif #endif - void microhone_switch(bool isopen); + int32_t microhone_switch(bool isopen); void check_spk(bool isopen); #ifdef __cplusplus #if __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp index ec816a70b..123eb54e8 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testLCD.cpp @@ -209,7 +209,8 @@ extern "C" void factorytest_hide_test_lcd_button(void) { testLCDView::GetInstance()->LCDHideNextButton(); - osTimerStop(MG_TEST_timer); + if(MG_TEST_timer) + osTimerStop(MG_TEST_timer); } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp index e0183392d..2dcbb2f46 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/producttest/src/testmicrophone.cpp @@ -6,6 +6,7 @@ #include "cmsis_os2.h" #include "audio_capture_wrapper.h" #include "producttest/include/testView.h" +#include "findwatch_notification.h" #ifdef __cplusplus #if __cplusplus extern "C" @@ -241,7 +242,7 @@ extern "C" #endif /* __cplusplus */ #endif /* __cplusplus */ - void microhone_switch(bool isopen) + int32_t microhone_switch(bool isopen) { char *args[6] = {0}; const char *defaultArgs[6] = {"01", "mp3", "16000", "1", "16","/user/userdata/microphone.mp3"}; // 默认参数数组 @@ -256,26 +257,27 @@ extern "C" args[i] = (char *)malloc(64); sprintf(args[i], "%s", defaultArgs[i]); } - AudioCaptureSample(6, (const char **)args); + return AudioCaptureSample(6, (const char **)args); } else { - AudioCaptureSample(argc, (const char **)&argv); - FILE *file =fopen("/user/userdata/microphone.mp3","rb"); - if(file==NULL) - { - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "ffffffffffffffffsssssss"); - } - fclose(file); + return AudioCaptureSample(argc, (const char **)&argv); } } void check_spk(bool isopen) { if(isopen) - AlarmClockModel::GetInstance()->testPlayerStart("/user/userdata/microphone.mp3"); + { + // AlarmClockModel::GetInstance()->testPlayerStart("/user/userdata/microphone.mp3"); + FindWatchViewEventListener::GetInstance().PopInterPlayMusic("/user/userdata/microphone.mp3"); + } else - AlarmClockModel::GetInstance()->AlarmPlayerStop(); + { + // AlarmClockModel::GetInstance()->AlarmPlayerStop(); + FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); + } + } #ifdef __cplusplus diff --git a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h index 1fdfd5249..79371f8b8 100644 --- a/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h +++ b/code/sdk/application/wearable/service/broadcast/include/broadcast_feature.h @@ -41,6 +41,7 @@ typedef enum { TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, TOPIC_EVENT_SHUTDOWN, TOPIC_EVENT_HEARTRATE_UPDATA, + TOPIC_EVENT_STATIC_HEARTRATE_UPDATA, TOPIC_EVENT_HFP_INCOMMING, TOPIC_EVENT_HFP_PHONE_ACTIVE, TOPIC_EVENT_HFP_WATCH_ACTIVE, diff --git a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c index d39d9077a..0e1b01109 100644 --- a/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c +++ b/code/sdk/application/wearable/service/broadcast/src/broadcast_implement.c @@ -28,6 +28,7 @@ static const TopicToCore topicToCoreArray[] = { {TOPIC_EVENT_AR_ALERT_TYPE_UPDATE, A_CORE_MASK, 1}, {TOPIC_EVENT_SHUTDOWN, A_CORE_MASK, 1}, {TOPIC_EVENT_HEARTRATE_UPDATA, A_CORE_MASK, 1}, + {TOPIC_EVENT_STATIC_HEARTRATE_UPDATA, A_CORE_MASK, 1}, #ifdef CYWEE_SPORT {TOPIC_EVENT_ACTIVITY_UPDATE, A_CORE_MASK, 1}, {TOPIC_EVENT_ACTIVITY_EXTRA_INFO_UPDATE, A_CORE_MASK, 1}, diff --git a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c index fc1c54a28..81a20fa43 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-06-17 14:31:08 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-07-19 14:21:43 + * @LastEditTime: 2024-07-24 09:39:01 * @FilePath: /FD230/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c * @Description: * @@ -718,7 +718,7 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint //退出表冠测试界面 uint8_t send_data = 0; uint8_t cmd = 0; - do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CROWN_TEST,&cmd,sizeof(cmd)); + //do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_CROWN_TEST,&cmd,sizeof(cmd)); factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, BLE_TEST_CMD_SOFT_TEST_SUB_MODE_KEY, 0x07, diff --git a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h index c946c5726..3411969cf 100644 --- a/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h +++ b/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:31:19 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-03-26 18:03:13 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-07-24 11:16:31 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/include/notify/findwatch_notification.h */ #ifndef FIND_WATCH_NOTIFICATION_H @@ -67,10 +67,10 @@ namespace OHOS public: static FindWatchViewEventListener &GetInstance(void); void PopInterCancelMusic(void); - void PopInterPlayMusic(void); + void PopInterPlayMusic(const char *path); int FindWatchRingPlayStop(void); - int FindWatchRingPlayStart(void); - int FindWatchRingPlayerInit(char *RingMusicName); + int FindWatchRingPlayStart(const char *path); + int FindWatchRingPlayerInit(const char* path); int FindWatchRingPlayerStat(void); bool GetFindWatchNotifyFlag(void); void SetFindWatchNotifyFlag(bool flag); @@ -89,7 +89,7 @@ namespace OHOS std::shared_ptr playerInterruptListener{nullptr}; AudioSession sessionId; AudioInterrupt interrupt; - char *RingMusicName = "findwatch.mp3"; + const char *RingMusicName = "/music/ring/findwatch.mp3"; bool FindWatchNotifyFlag{false}; // 判断是查找手表, 由notify生成界面 }; } diff --git a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp index 62cb6a4d2..22c993415 100644 --- a/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/msg_center_customer.cpp @@ -101,6 +101,7 @@ const PriorityMapper PRI_MAPPER[] = { #ifdef SUPPORT_SPO2_NOTIFICATION {TOPIC_EVENT_SPO2_UPDATE, PRIORITY_TWO}, {TOPIC_EVENT_HEARTRATE_UPDATA, PRIORITY_TWO}, + {TOPIC_EVENT_STATIC_HEARTRATE_UPDATA,PRIORITY_TWO}, {TOPIC_EVENT_GRAYCARD_UPDATA, PRIORITY_TWO}, {TOPIC_EVENT_LEAKLIGHT_UPDATA, PRIORITY_TWO}, #endif @@ -164,6 +165,7 @@ void MsgCenterSubscribe() #ifdef SUPPORT_SPO2_NOTIFICATION_TEST MsgCenterSubscribeTopic(TOPIC_EVENT_SPO2_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_HEARTRATE_UPDATA); + MsgCenterSubscribeTopic(TOPIC_EVENT_STATIC_HEARTRATE_UPDATA); MsgCenterSubscribeTopic(TOPIC_EVENT_WEARSTATE_UPDATE); MsgCenterSubscribeTopic(TOPIC_EVENT_GRAYCARD_UPDATA); MsgCenterSubscribeTopic(TOPIC_EVENT_LEAKLIGHT_UPDATA); @@ -658,6 +660,12 @@ void MsgCenterNotifyHeartRateProc(const Topic topic, Request* req) } } +//静息心率 +void MsgCenterNotifyStaticHeartRateProc(const Topic topic, Request* req) +{ + unused(topic); + unused(req); +} //消息通知 void MsgCenterNotifyMessageProc(const Topic topic, Request* req) @@ -951,7 +959,7 @@ void MsgCenterNotifyFindWatchProc(const Topic topic, Request* req) unused(req); WEARABLE_LOGI(WEARABLE_LOG_MODULE_APP, "MsgCenterNotifyFindWatchProc !"); FindWatchViewEventListener::GetInstance().SetFindWatchNotifyFlag(true); - FindWatchViewEventListener::GetInstance().PopInterPlayMusic();//播放铃声 + FindWatchViewEventListener::GetInstance().PopInterPlayMusic(nullptr);//播放铃声 NotificationManager::GetInstance()->SetNotifyPriority(PRIORITY_TWO); NotificationManager::GetInstance()->ShowNotify(showFindWatchNotify, (uint16_t)topic, true); } @@ -1249,6 +1257,7 @@ static MsgCenterNotifyTable g_msgCenterNotifyTable[] = { {TOPIC_EVENT_SPO2_UPDATE, MsgCenterNotifySPO2hProc}, {TOPIC_EVENT_WEARSTATE_UPDATE, MsgCenterNotifyWearStateProc}, {TOPIC_EVENT_HEARTRATE_UPDATA, MsgCenterNotifyHeartRateProc}, + {TOPIC_EVENT_STATIC_HEARTRATE_UPDATA, MsgCenterNotifyStaticHeartRateProc}, {TOPIC_EVENT_GRAYCARD_UPDATA, MsgCenterNotifyCardProc}, {TOPIC_EVENT_LEAKLIGHT_UPDATA, MsgCenterNotifyleaklightProc}, #endif diff --git a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp index 19bdd1002..944420330 100644 --- a/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp +++ b/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp @@ -1,8 +1,8 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-03-25 17:33:47 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-06-22 11:35:48 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-07-24 11:27:11 * @FilePath: /FD230/code/sdk/application/wearable/service/msg_center/src/notify/findwatch_notification.cpp * @details:实现查找手表的功能一般需要手表和智能手机之间的配合,通常是通过手机上的应用(App)或其他设备发送指令给手表,触发手表的查找功能。 * 以下是基本的实现步骤: @@ -58,9 +58,9 @@ namespace OHOS UNUSED(event); if (&view == FindWatchButton) // 手表已找到 { - #ifdef SUPPORT_BLE_SERVICE - setFindWatchFlag(2);//表示已找到手表 - #endif +#ifdef SUPPORT_BLE_SERVICE + setFindWatchFlag(2); // 表示已找到手表 +#endif FindWatchRingPlayStop(); NotificationManager::GetInstance()->StopNotify(); SetFindWatchNotifyFlag(false); @@ -83,14 +83,15 @@ namespace OHOS * @brief 初始化查找手表播放铃声的播放器 * @param {char*} RingMusicName 铃声文件 */ - int FindWatchViewEventListener::FindWatchRingPlayerInit(char *RingMusicName) + int FindWatchViewEventListener::FindWatchRingPlayerInit(const char *path) { // 本地播放文件路径和状态 - WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RingPlayerInit start!"); - std::string strSrcMusic("/music/ring"); - std::string tempStr("/"); - std::string strName = RingMusicName; - uri = strSrcMusic + tempStr + strName; + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "RingPlayerInit start!,%s",path); + // std::string strSrcMusic("/music/ring"); + // std::string tempStr("/"); + // std::string strName = RingMusicName; + // uri = strSrcMusic + tempStr + strName; + uri = path; // 创建 AM playerCtr = std::make_shared(); if (playerCtr.get() == nullptr) @@ -134,7 +135,7 @@ namespace OHOS WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "FindWatchRing Player url:%s", uri.c_str()); playerCtr->SetSource(*source); /* --------------------------------- 4.配置播放器 -------------------------------- */ - playerCtr->SetAudioStreamType(AUDIO_STREAM_ALARM_CLOCK); // 设置播放器的音频流类型为闹钟音乐。 + playerCtr->SetAudioStreamType(AUDIO_STREAM_MUSIC); // 设置播放器的音频流类型为闹钟音乐。 playerCtr->Prepare(); // 准备播放器对象以播放音频。 /* -------------------------------- 5.请求音频焦点 -------------------------------- */ AudioManager &amIntance = AudioManager::GetInstance(); @@ -152,14 +153,14 @@ namespace OHOS return OHOS_FAILURE; } playerInterruptListener->SetOwner(playerCtr); - interrupt = {AUDIO_STREAM_ALARM_CLOCK, sessionId, playerInterruptListener}; + interrupt = {AUDIO_STREAM_MUSIC, sessionId, playerInterruptListener}; // 激活音频中断 5s超时 if (amIntance.ActivateAudioInterrupt(interrupt) == INTERRUPT_FAILED) { WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "ActivateAudioInterrupt faild"); return OHOS_FAILURE; } - // playerCtr->SetVolume(50, 50); // 将左声道和右声道音量都设置为50 + playerCtr->SetVolume(300, 300); // 将左声道和右声道音量都设置为50 playerCtr->SetAudioSessionId(sessionId); // 播放 playerCtr->Play(); @@ -192,9 +193,9 @@ namespace OHOS /* * @brief 开启查找手表铃声 */ - int FindWatchViewEventListener::FindWatchRingPlayStart(void) + int FindWatchViewEventListener::FindWatchRingPlayStart(const char *path) { - FindWatchRingPlayerInit(RingMusicName); + FindWatchRingPlayerInit(((path == nullptr) ? RingMusicName : path)); FindWatchRingPlayerStat(); return OHOS_SUCCESS; } @@ -204,7 +205,7 @@ namespace OHOS */ void FindWatchViewEventListener::PopInterCancelMusic(void) { - SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, NULL, 0); + SendMsgToUIService(SCREEN_TURN_OFF_TO_UI, 0, nullptr, 0); GraphicService::GetInstance()->PostGraphicEvent( std::bind(&FindWatchViewEventListener::FindWatchRingPlayStop, &FindWatchViewEventListener::GetInstance())); } @@ -212,13 +213,13 @@ namespace OHOS /* * @brief 开始铃声播放的事件 */ - void FindWatchViewEventListener::PopInterPlayMusic(void) + void FindWatchViewEventListener::PopInterPlayMusic(const char *path) { int32_t timeout = -1; SendMsgToUIService(SCREEN_TURN_ON_TO_UI, 0, &timeout, sizeof(int32_t)); // 亮屏操作 // 将"开启查找手表铃声"任务发布到异步线程 GraphicService::GetInstance()->PostGraphicEvent( - std::bind(&FindWatchViewEventListener::FindWatchRingPlayStart, &FindWatchViewEventListener::GetInstance())); + std::bind(&FindWatchViewEventListener::FindWatchRingPlayStart, &FindWatchViewEventListener::GetInstance(), path)); } /* @@ -321,7 +322,7 @@ namespace OHOS static void Start(void) { - FindWatchViewEventListener::GetInstance().PopInterPlayMusic(); + FindWatchViewEventListener::GetInstance().PopInterPlayMusic(nullptr); } static void Stop(void) @@ -368,7 +369,7 @@ namespace OHOS { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OnPlaybackComplete"); FindWatchViewEventListener::GetInstance().PopInterCancelMusic(); - FindWatchViewEventListener::GetInstance().PopInterPlayMusic(); + FindWatchViewEventListener::GetInstance().PopInterPlayMusic(nullptr); } void FindWatchRingPlayerCallbackImpl::OnError(int32_t errorType, int32_t errorCode) diff --git a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h index 7c95dc601..d28642a76 100755 --- a/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h +++ b/code/sdk/drivers/boards/brandy_evb/board_config/board_evb.h @@ -182,7 +182,7 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = { { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_AGPIO_L19 G_INT2 //暂时不用 - { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L20 0.2C_CHRG + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_UP, HAL_PIO_IE_DISABLE }, // S_AGPIO_L20 0.2C_CHRG { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L21 NTC_VDD_ON 给低打开 NTC上拉电源 #ifdef QSPI_DISPLAY { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L22 QSPI TE @@ -197,7 +197,7 @@ const hal_pio_config_t g_pio_function_config[PIN_MAX_NUMBER] = { { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L28 CAT_1复位 CAT1_RESET_N 拉低有效 { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L29 charge done info 检测是否充满电 { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_L30 KP_MKIN1 唤醒 CAT1 ,输出 - { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_ENBALE }, // S_AGPIO_L31 KP_MKOUIT1 唤醒 蓝牙 ,输入 + { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L31 KP_MKOUIT1 唤醒 蓝牙 ,输入 { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_DOWN, HAL_PIO_IE_DISABLE }, // S_AGPIO_L32 NC { HAL_PIO_FUNC_GPIO, HAL_PIO_DRIVE_MAX, HAL_PIO_PULL_MAX, HAL_PIO_IE_DISABLE }, // S_AGPIO_R0 PRG_LED_POWER ON 心率等电源控制脚 diff --git a/code/sdk/drivers/peripheral/a5133/A5133Main.c b/code/sdk/drivers/peripheral/a5133/A5133Main.c index 72e529fc3..0286212b0 100644 --- a/code/sdk/drivers/peripheral/a5133/A5133Main.c +++ b/code/sdk/drivers/peripheral/a5133/A5133Main.c @@ -93,7 +93,7 @@ const Uint8 code PN9_Tab[]= *********************************************************************/ void a5133_main(Uint8 Flag_MASTER,uint8_t channel) { - + a5133_power_on(); if(RF_Init())/* init RF */ { // Err_State(); diff --git a/code/sdk/drivers/peripheral/a5133/A5133Uti.c b/code/sdk/drivers/peripheral/a5133/A5133Uti.c index 5aa6bb062..d52c7a6a9 100644 --- a/code/sdk/drivers/peripheral/a5133/A5133Uti.c +++ b/code/sdk/drivers/peripheral/a5133/A5133Uti.c @@ -264,15 +264,36 @@ errcode_t a5133_gpio_init(void) if (ret != ERRCODE_SUCC) { return ERRCODE_FAIL; } +#endif + return ret; +} - ret = a5133_gpio_set_direction(S_AGPIO_L30,1); +errcode_t a5133_power_on(void) +{ + errcode_t ret = 0; + ret = uapi_pin_set_mode(S_AGPIO_L31, HAL_PIO_FUNC_GPIO); + if (ret != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } + ret = a5133_gpio_set_direction(S_AGPIO_L31,1); if (ret != ERRCODE_SUCC) { return ERRCODE_FAIL; } -#endif - return ret; + ret = uapi_gpio_set_val(S_AGPIO_L31, GPIO_LEVEL_HIGH); + if (ret != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } + return ERRCODE_SUCC; } +errcode_t a5133_power_off(void) +{ + errcode_t ret = uapi_gpio_set_val(S_AGPIO_L31, GPIO_LEVEL_LOW); + if (ret != ERRCODE_SUCC) { + return ERRCODE_FAIL; + } + return ERRCODE_SUCC; +} // int test_gpio_toggle(pin_t pin, int level) // { diff --git a/code/sdk/drivers/peripheral/a5133/A5133Uti.h b/code/sdk/drivers/peripheral/a5133/A5133Uti.h index 6bf40d582..e72a82022 100644 --- a/code/sdk/drivers/peripheral/a5133/A5133Uti.h +++ b/code/sdk/drivers/peripheral/a5133/A5133Uti.h @@ -2,7 +2,7 @@ * @Author: penglei 1624952103@qq.com * @Date: 2024-07-20 10:36:21 * @LastEditors: penglei 1624952103@qq.com - * @LastEditTime: 2024-07-22 15:38:16 + * @LastEditTime: 2024-07-25 10:00:59 * @FilePath: /FD230/code/sdk/drivers/peripheral/a5133/A5133Uti.h * @Description: * @@ -25,6 +25,8 @@ void Delay10us(Uint8); void Delay100us(Uint8); void Delay1ms(Uint8); void Delay10ms(Uint8); +errcode_t a5133_power_on(void); +errcode_t a5133_power_off(void); errcode_t a5133_gpio_init(void); uint8_t a5133_gpio_get_value(pin_t pin); errcode_t a5133_gpio_set_value(pin_t pin,uint8_t value); diff --git a/code/sdk/drivers/peripheral/a5133/service/a5133_service.cpp b/code/sdk/drivers/peripheral/a5133/service/a5133_service.cpp index 5c8700908..4829f95fe 100644 --- a/code/sdk/drivers/peripheral/a5133/service/a5133_service.cpp +++ b/code/sdk/drivers/peripheral/a5133/service/a5133_service.cpp @@ -117,7 +117,7 @@ void send_a5133_cmd_msg(int cmd) ret = osal_msg_queue_write_copy(g_app_queue, (void *)&mail, sizeof(A5133_CMD_TYPE_T), 0); if (ret != OSAL_SUCCESS) { - PRINT_ERR("Error mag Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); + PRINT_ERR("Error a5133 Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); } } @@ -140,26 +140,26 @@ static void a5133_service_check_task(void *arg) continue; } - PRINT("A5133_SERVICE_CMD_TYPE_RUN \n"); - a5133_service_timer_start_check(50); - a5133_main(SLAVE,mail); + // PRINT("A5133_SERVICE_CMD_TYPE_RUN \n"); + // a5133_service_timer_start_check(50); + // a5133_main(SLAVE,mail); - // if (mail == A5133_SERVICE_CMD_TYPE_RUN_MASTER) - // { - // PRINT("A5133_SERVICE_CMD_TYPE_RUN_MASTER \n"); - // a5133_service_timer_start_check(50); - // a5133_main(MASTER); - // }else if (mail == A5133_SERVICE_CMD_TYPE_RUN_SLAVE) - // { + if (mail == A5133_SERVICE_CMD_TYPE_RUN_MASTER) + { + PRINT("A5133_SERVICE_CMD_TYPE_RUN_MASTER \n"); + a5133_service_timer_start_check(50); + a5133_main(MASTER,80); + }else if (mail == A5133_SERVICE_CMD_TYPE_RUN_SLAVE) + { - // PRINT("A5133_SERVICE_CMD_TYPE_RUN_SLAVE \n"); - // a5133_service_timer_start_check(50); - // a5133_main(SLAVE); - // }else if (mail == A5133_SERVICE_CMD_TYPE_TIMER_CHECK) - // { + PRINT("A5133_SERVICE_CMD_TYPE_RUN_SLAVE \n"); + a5133_service_timer_start_check(50); + a5133_main(SLAVE,80); + }else if (mail == A5133_SERVICE_CMD_TYPE_TIMER_CHECK) + { - // } + } } a5133_server_break_flag = 0; a5133_service_running_stat = false; diff --git a/code/sdk/drivers/peripheral/acc/service/acc_service.c b/code/sdk/drivers/peripheral/acc/service/acc_service.c index a9449c2a7..25a5d214b 100644 --- a/code/sdk/drivers/peripheral/acc/service/acc_service.c +++ b/code/sdk/drivers/peripheral/acc/service/acc_service.c @@ -98,7 +98,7 @@ void do_acc_service_check_msg(int cmd) ret = osal_msg_queue_write_copy(g_app_queue, (void *)&mail, sizeof(common_notify_mail_t), 0); if (ret != OSAL_SUCCESS) { - PRINT("Error mag Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); + PRINT("Error acc Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); } } diff --git a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h index 743aa2759..aa30c6a66 100644 --- a/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h +++ b/code/sdk/drivers/peripheral/cywee/Inc/cywee_hal.h @@ -561,7 +561,7 @@ void cywee_set_sedentary_switch(int cmd); void cywee_get_acc_switch(int cmd); void cywee_stop(void); uint8_t cywee_get_active_state(void); - +uint8_t cywee_get_static_state(void); extern uint8_t hrs_mode_state; #pragma pack() diff --git a/code/sdk/drivers/peripheral/cywee/src/main_dml.c b/code/sdk/drivers/peripheral/cywee/src/main_dml.c index 0890994ef..aaddbdeb6 100644 --- a/code/sdk/drivers/peripheral/cywee/src/main_dml.c +++ b/code/sdk/drivers/peripheral/cywee/src/main_dml.c @@ -74,9 +74,16 @@ static int cywee_switch = 0; #endif static uint8_t cywee_is_active = 0; +static uint8_t is_static_state = 0; + int cm__hs1__init(void); int cm__hs1__deinit(void); +uint8_t cywee_get_static_state(void) +{ + return is_static_state; +} + uint8_t cywee_get_active_state(void) { return cywee_is_active; @@ -793,6 +800,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { } break; case IDX_ALGO_ACTIVITY_OUTPUT: + is_static_state = 0; cywee_func = cywee_get_send_msg_callback_func(); if((int)sensorEVT->fData[0] == 100) { @@ -850,6 +858,7 @@ void CWM_AP_SensorListen(pSensorEVT_t sensorEVT) { break; case IDX_ALGO_NO_MOTION: + is_static_state = 1; CWM_OS_dbgPrintf("IDX_ALGO_NO_MOTION\n"); break; case IDX_ALGO_FALLING: @@ -1146,7 +1155,7 @@ int cywee_main_dml(void) CWM_Sensor_Enable(IDX_ACCEL); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); // CWM_Sensor_Enable(IDX_GYRO); - //CWM_Sensor_Enable(IDX_ALGO_NO_MOTION); + CWM_Sensor_Enable(IDX_ALGO_NO_MOTION); //CWM_OS_dbgPrintf("[DBG] %s %d\n", __func__,__LINE__); // CWM_Sensor_Enable(IDX_ALGO_ANY_MOTIOIN); //CWM_Sensor_Enable(IDX_ALGO_ABSOLUTE_STATIC); diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c index 362bff869..e6647d45c 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695.c @@ -2667,6 +2667,50 @@ void hx3695_ppg_Int_handle(void) #endif } +static uint8_t hrs_num = 0; +static int32_t sum_hrs = 0; +static int32_t hrs_data[7] = {0}; +static uint8_t left = 0; +static uint8_t right = 0; +static int32_t min_hrs = 0; +static int32_t max_hrs = 0; + +static void get_avg_hrs(int32_t hrs) +{ + if(hrs_num == 7) + { + sum_hrs -= hrs_data[left]; + hrs_data[left] = 0; + left++; + left = left % 7; + hrs_num--; + } + if(hrs_num == 0) + { + min_hrs = hrs; + max_hrs = hrs; + } + else + { + if (min_hrs > hrs) + min_hrs = hrs; + if (max_hrs < hrs) + max_hrs = hrs; + } + hrs_num++; + right++; + right = right % 7; + hrs_data[right] = hrs; + sum_hrs += hrs_data[right]; + if(hrs_num > 0) + { + if(hrs_num > 2) + hrs = (sum_hrs - max_hrs - min_hrs) / (hrs_num - 2); + else + hrs = sum_hrs / hrs_num; + } + PRINT("sum_hrs[%d], max_hrs[%d], min_hrs[%d], avg_hrs[%d] \n",sum_hrs,max_hrs,min_hrs,hrs); +} #ifdef HRS_ALG_LIB @@ -2806,7 +2850,8 @@ void hx3695_hrs_ppg_Int_handle(void) hrsresult.hr_living = alg_results.living_status; hrsresult.hr_living_qu = alg_results.hr_result_qual; hrsresult.hr_living_std = alg_results.hr_result_std; - + if(hrsresult.lastesthrs > 50) + get_avg_hrs((hrsresult.lastesthrs)); //PRINT("hx3695 data_cnt: %d, hr_living: %d, hr_living_qu: %d, hr_living_std: %d, hr_result:%d \r\n", //alg_results.data_cnt, hrsresult.hr_living, hrsresult.hr_living_qu, hrsresult.hr_living_std, hrsresult.lastesthrs); @@ -2895,6 +2940,10 @@ void hx3695_hrs_ppg_Int_handle(void) hrsresult.wearstatus = hrs_wear_status; func(HX3695_MSG_TYPE_WEARSTAT_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); func(HX3695_MSG_TYPE_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + if(uapi_get_cywee_static_state()) + { + func(HX3695_MSG_TYPE_STATIC_HRS_UPDATE,&hrsresult,sizeof(FT_CUSTOM_RESULTS_t)); + } } #if HANKCREAT_APK diff --git a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.h b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.h index fffa641fe..0f614273a 100644 --- a/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.h +++ b/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.h @@ -1,3 +1,13 @@ +/* + * @Author: penglei 1624952103@qq.com + * @Date: 2024-06-07 11:18:26 + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-07-25 18:14:12 + * @FilePath: /FD230/code/sdk/drivers/peripheral/ppg/hx3695/hx3695_hal.h + * @Description: + * + * Copyright (c) 2024 by ${git_name_email}, All Rights Reserved. + */ #ifndef HX_3695_H__ #define HX_3695_H__ #ifdef __cplusplus @@ -18,6 +28,7 @@ typedef enum{ HX3695_MSG_TYPE_LEAKLIGHT_UPDATE, HX3695_MSG_TYPE_GRAYCARD_UPDATE, HX3695_MSG_TYPE_WEARSTAT_UPDATE, + HX3695_MSG_TYPE_STATIC_HRS_UPDATE, } hx3695_msg_type_t; diff --git a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp index 9f7b9e3a7..202688d74 100644 --- a/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp +++ b/code/sdk/drivers/peripheral/ppg/service/ppg_service.cpp @@ -146,6 +146,19 @@ errcode_t update_wearstatus_event_sendmsg_toUI(int32_t wearstatus) return ERRCODE_SUCC; } +//静息心率 +errcode_t update_static_hrs_event_notify(int32_t hrs) +{ + CustomEventPublish(TOPIC_EVENT_STATIC_HEARTRATE_UPDATA,(uint8_t*)&hrs,sizeof(hrs)); + return 0; +} +errcode_t update_static_hrs_event_sendmsg_toUI(int32_t hrs) +{ + /**通过UI事件发送Notify*/ + GraphicService::GetInstance()->PostGraphicEvent(std::bind(update_static_hrs_event_notify, hrs)); + return ERRCODE_SUCC; +} + #include "hx3695_hal.h" #include "hx3695.h" void hx3695_msg_callback(uint8_t msg_type, uint8_t *msg_data, int32_t msg_datalen) @@ -195,6 +208,10 @@ void hx3695_msg_callback(uint8_t msg_type, uint8_t *msg_data, int32_t msg_datale WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_WEARSTATUS_UPDATE = %d", sensor_data.wearstatus); update_wearstatus_event_sendmsg_toUI(sensor_data.wearstatus); break; + case HX3695_MSG_TYPE_STATIC_HRS_UPDATE: + WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "HX3695_MSG_TYPE_STATIC_HRS_UPDATE = %d", sensor_data.lastesthrs); + update_static_hrs_event_sendmsg_toUI(sensor_data.lastesthrs); + break; default: WEARABLE_LOGD(WEARABLE_LOG_MODULE_APP, "Unknown sensor message type"); break; @@ -227,7 +244,7 @@ void send_ppg_cmd_msg(int cmd) ret = osal_msg_queue_write_copy(g_app_queue, (void *)&mail, sizeof(PPG_CMD_TYPE_T), 0); if (ret != OSAL_SUCCESS) { - PRINT_ERR("Error mag Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); + PRINT_ERR("Error ppg Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); } } diff --git a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c index 5618ec9ac..8353b9b94 100644 --- a/code/sdk/drivers/peripheral/utils/custom_cmd_service.c +++ b/code/sdk/drivers/peripheral/utils/custom_cmd_service.c @@ -132,6 +132,7 @@ static void custom_cmd_service_check_task(void const *arg) case CUSTOM_CMD_MSG_TYPE_LCD_TEST: if(mail.data[0] == 1) { + uapi_setScreenBrightness(255); uapi_set_screen_on_api(); uapi_factorytest_enter_test_view(1); uapi_factorytest_enter_test_lcd_view(); diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index dd5d7aee5..9fb293e16 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -58,6 +58,7 @@ #include "cywee_service.h" #include "microtar.h" #include "mag_service.h" +#include "ppg_service.h" errcode_t uapi_create_osThread_custom(app_task_definition_t *task_cfg) { @@ -164,9 +165,19 @@ void uapi_reboot_device(void) mcu_os_sys_reset(NULL,NULL); } -void shutdown_reboot_prejobs_task(void) + +void uapi_save_time_of_day(void) { + time_t rawtime; + struct tm* timeinfo; + time(&rawtime); + timeinfo = localtime(&rawtime); + uapi_save_file_data("user/userdata/timestamp_of_day.bin",&timeinfo->tm_mday,1); +} +void shutdown_reboot_prejobs_task(void) +{ + uapi_save_time_of_day(); //保存步数 do_cywee_service_check_msg(CYWEE_SERVICE_CMD_SAVE_DATA,NULL); @@ -290,6 +301,10 @@ bool stop_alipay_ble_service(void) } void startup_post_init_task(void) { + uint8_t day = 0; + time_t rawtime; + struct tm* timeinfo; + PRINT("startup_post_init_task !\r\n"); uapi_calendar_recover_date(); @@ -331,6 +346,14 @@ void startup_post_init_task(void) uapi_set4GCapability(false); } uapi_gei_btmac_and_chipinfo(); + + uapi_get_file_data("user/userdata/timestamp_of_day.bin",&day,1); + time(&rawtime); + timeinfo = localtime(&rawtime); + if(day > 0 && day != timeinfo->tm_mday) + { + do_cywee_service_check_msg(CYWEE_SERVICE_CMD_RESET_DAILY_DATA,NULL); + } } void startup_post_init(void) @@ -2245,10 +2268,10 @@ int custom_exit_lpm(void) } #endif -void uapi_microhone_switch(bool isopen) +int32_t uapi_microhone_switch(bool isopen) { #ifdef FD230 - microhone_switch(isopen); + return microhone_switch(isopen); #endif } @@ -2384,3 +2407,129 @@ uint8_t uapi_get_cywee_active_state(void) { return cywee_get_active_state(); } + +void uapi_get_file_data(char *path,uint8_t *data,uint8_t len) +{ + FILE * fp = fopen(path,"rb"); + if(fp==NULL) + { + PRINT("open %s failed\n",path); + return; + } + int ret = fread(data,1,len,fp); + if(ret != len) + { + PRINT("fread failed %d\n",ret); + } + fclose(fp); +} + +void uapi_save_file_data(char *path,uint8_t *data,uint8_t len) +{ + FILE * fp = fopen(path,"wb"); + if(fp==NULL) + { + PRINT("open %s failed\n",path); + return; + } + int ret = fwrite(data,1,len,fp); + if(ret != len) + { + PRINT("fwrite failed %d\n",ret); + } + fclose(fp); +} + +void uapi_aging_test(uint32_t test_time) +{ + int32_t ret = 0; + uint32_t enter_age_time = 0; + uint32_t age_time = 0; + uint32_t display_error = 0; + uint32_t fail_num = 0; + uint32_t ppg_error = 0; + uint8_t ppg_id = 0; + uint32_t microhone_error = 0; + uint32_t msc = 0; + uint8_t cmd = 1; + uint32_t lcd_id = 0; + uint8_t aging_test_data[4] = {0}; + uint32_t aging_time = test_time; + while(aging_time) + { + uapi_get_timestampe_ss(&msc); + enter_age_time = msc; + + lcd_getid(&lcd_id); + if(lcd_id != 0x1133) + { + display_error++; + fail_num++; + } + PRINT("display_error[%d],fail_num[%d]\n",display_error,fail_num); + uapi_setScreenBrightness(255); + cmd = 1; + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_TEST,&cmd,sizeof(cmd)); + for(cmd = 1; cmd < 6 ; cmd++) + { + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_COLOR_TEST,&cmd,sizeof(cmd)); + LOS_Msleep(1000); + } + + for(cmd = 0; cmd < 6 ; cmd++) + { + uapi_vibrationModeSet(3); + LOS_Msleep(1000); + } + + ret = uapi_microhone_switch(1); + if(ret != 0) + { + microhone_error++; + fail_num++; + } + LOS_Msleep(6000); + ret = uapi_microhone_switch(0); + if(ret != 0) + { + microhone_error++; + fail_num++; + } + uapi_check_spk(1); + LOS_Msleep(6000); + uapi_check_spk(0); + + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_DO_PPG_TEST); + LOS_Msleep(6000); + send_ppg_cmd_msg(PPG_SERVICE_CMD_TYPE_STOP_PPG_TEST); + uapi_ppg_get_id(&ppg_id); + //if(ft_result.gr_data_final < 10000 || ft_result.red_data_final < 10000 || ft_result.ir_data_final < 10000) + if(ppg_id != 0x65) + { + ppg_error++; + fail_num++; + } + + uapi_get_timestampe_ss(&msc); + age_time = msc; + aging_time -= (age_time - enter_age_time); + PRINT("aging_time[%d]\n",aging_time); + if(aging_time <= 10) + { + cmd = 0; + do_custom_cmd_service_check_msg(CUSTOM_CMD_MSG_TYPE_LCD_TEST,&cmd,sizeof(cmd)); + aging_test_data[0] = fail_num; + aging_test_data[1] = display_error; + aging_test_data[2] = microhone_error; + aging_test_data[3] = ppg_error; + + uapi_save_file_data("user/userdata/aging_test.bin",aging_test_data,3); + return; + } + } +} + +uint8_t uapi_get_cywee_static_state(void) +{ + return cywee_get_static_state(); +} \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index 53c7e5929..e9e5809e1 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -222,7 +222,7 @@ void uapi_cywee_get_chipinfo(char *databuf,uint8_t len); void uapi_ppg_get_id(uint8_t *chip_id); -void uapi_microhone_switch(bool isopen); +int32_t uapi_microhone_switch(bool isopen); void uapi_check_spk(bool isopen); void uapi_factorytest_set_lcd_color(int color); void uapi_factorytest_enter_test_view(int cmd); @@ -235,6 +235,9 @@ void uapi_efuse_test_write(uint8_t *data,uint32_t byte_number,uint8_t len); void uapi_efuse_test_read(uint32_t byte_number,uint8_t len); void uapi_gei_btmac_and_chipinfo(void); uint8_t uapi_get_cywee_active_state(void); +void uapi_get_file_data(char *path,uint8_t *data,uint8_t len); +void uapi_save_file_data(char *path,uint8_t *data,uint8_t len); +uint8_t uapi_get_cywee_static_state(void); #include "custom_utilscpp.h" diff --git a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c index 24a66f25a..21b44e965 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils_at_cmd.c @@ -796,6 +796,43 @@ static uint32_t custom_get_cywee_active_state(uint8_t *para, uint32_t paraLen, c wstp_print("cywee is not active !!!\n"); return ERRCODE_SUCC; } + + +static uint32_t custom_aging_test(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + + uint8_t argv[CUSTOM_UTILS_MAX_ARGC][CUSTOM_UTILS_MAX_ARGV_LEN] = { 0 }; + uint32_t argc = 0; + + int ret = ConvertCmdToParam(para, paraLen, argv, &argc); + if (ret != CUSTOM_UTILS_SUCCESS) { + wstp_print("CUSTOM_UTILSTEST ATCMD Convert Command Failed\n"); + return ERRCODE_FAIL; + } + + if (argc != 1) { + wstp_print("CUSTOM_UTILSTEST power_test ATCMD Set Parameter Failed argc %d\r\n"); + return ERRCODE_FAIL; + } + uint8_t aging_time = atol((char*)argv[0]); + + uapi_aging_test(aging_time * 60 * 60); + + return ERRCODE_SUCC; +} + +static uint32_t custom_get_aging_data(uint8_t *para, uint32_t paraLen, char *strCommonCmd) +{ + UNUSED(strCommonCmd); + + uint8_t aging_data[4] = {0}; + uapi_get_file_data("user/userdata/aging_test.bin",aging_data,4); + wstp_print("aging_test fail_num[%d], display_error_num[%d] ,microhone_error_num[%d] ,ppg_error_num[%d] \n",aging_data[0],aging_data[1],aging_data[2],aging_data[3]); + return ERRCODE_SUCC; +} + + #ifdef SUPPORT_A5133_SERVICE @@ -893,10 +930,11 @@ static const at_cmd_table_t g_custom_utils_cmd[] = { {(char *)"AT^GETIMEI", custom_get_imei, (char *)" "}, {(char *)"AT^GETCHIPINFO", custom_get_cywee_chip_info, (char *)" "}, {(char *)"AT^GETCYWEEACTIVE", custom_get_cywee_active_state, (char *)" "}, + {(char *)"AT^AGINGTEST", custom_aging_test, (char *)" "}, + {(char *)"AT^GETAGING", custom_get_aging_data, (char *)" "}, #ifdef SUPPORT_A5133_SERVICE {(char *)"AT^A5133SENDDATA", custom_a5133_send_msg, (char *)" "}, {(char *)"AT^A5133RSSI", custom_a5133_rssi, (char *)" "}, - #endif }; diff --git a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp index ec03994b7..09974b433 100644 --- a/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp +++ b/code/sdk/drivers/peripheral/vibrator/service/vibrator_service.cpp @@ -123,7 +123,7 @@ void do_vibrator_cmd(vibrator_cmd_t cmd) ret = osal_msg_queue_write_copy(g_app_queue, (void *)&mail, sizeof(vibrator_cmd_t), 0); if (ret != OSAL_SUCCESS) { - PRINT("Error mag Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); + PRINT("Error vibrator Check MSG 0x%02X send failed! err=0x%x! \r\n",cmd, ret); } } -- 2.17.1