From: penglei <1624952103@qq.com> Date: Sat, 27 Jul 2024 05:36:46 +0000 (+0800) Subject: 添加a5133底层接收与UI对接 X-Git-Tag: release_V1.2.70_20241020_135402~737^2~2 X-Git-Url: http://git.snicker.com.cn/css/static/gitweb.css?a=commitdiff_plain;h=49d17955448515a7a5fd5f3eecb1e3ea8f65fe7c;p=mirrors%2FFD230.git 添加a5133底层接收与UI对接 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageView.cpp b/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageView.cpp index 795e454c0..cd13b6613 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageView.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageView.cpp @@ -1,14 +1,14 @@ /* * @Author: luozheng 1732036298@qq.com * @Date: 2024-05-07 11:25:58 - * @LastEditors: luozheng 1732036298@qq.com - * @LastEditTime: 2024-07-27 12:36:48 - * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/OBUMessage/src/OBUMessageView.cpp + * @LastEditors: penglei 1624952103@qq.com + * @LastEditTime: 2024-07-27 13:29:31 + * @FilePath: /FD230/code/sdk/application/wearable/fd230app/nativeui/obumessage/src/OBUMessageView.cpp */ #include "obumessage/include/OBUMessagePresenter.h" #include "obumessage/include/OBUMessageView.h" #include "wearable_log.h" - +#include "custom_utils.h" namespace OHOS { @@ -216,7 +216,26 @@ namespace OHOS void OBUMessageView::UpdateOBUMessageViewDisplayData(void) { WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "OBUMessageView::UpdateOBUMessageViewDisplayDate"); - displayTimeLabel->SetText("");/*时间更新:时:分:秒*/ - obuMessageLabel->SetText("");/*数据更新*/ + std::string labelTimeStr; + std::string rxdataStr; + if (uapi_get_a5133_update_state()) + { + uint8_t rxdata[80] = {0}; + uint32_t rxdata_timestamp = 0; + uapi_get_a5133_rxdata(rxdata, 80); + rxdataStr = std::string((char *)rxdata); + uapi_get_a5133_rxdata_timestamp(&rxdata_timestamp); + char labelTime[20] = {0}; + if (uapi_get_TIME_STR(rxdata_timestamp, labelTime, '.', ':', DATE_H_M_S) != ERRCODE_SUCC) + { + labelTimeStr = std::string("--"); + } + else + { + labelTimeStr = std::string(labelTime); + } + } + displayTimeLabel->SetText(labelTimeStr.c_str()); /*时间更新:时:分:秒*/ + obuMessageLabel->SetText(rxdataStr.c_str()); /*数据更新*/ } } \ No newline at end of file diff --git a/code/sdk/build/config/target_config/brandy/config.py b/code/sdk/build/config/target_config/brandy/config.py index 4ee757321..b8fe5b281 100755 --- a/code/sdk/build/config/target_config/brandy/config.py +++ b/code/sdk/build/config/target_config/brandy/config.py @@ -210,8 +210,8 @@ target = { 'brandy-native-js-lt22': { 'base_target_name': 'brandy-native-js', 'defines': ['SUPPORT_A5133_SERVICE' - ,'A5133_DEMO_SERVER' - # ,'A5133_DEMO_CLIENT' + #,'A5133_DEMO_SERVER' + ,'A5133_DEMO_CLIENT' ,'DISABLE_ENCODER' ,'SUPPORT_A5133_SERVICE_BLE_PAIR' ,'-:ENABLE_CYWEE' diff --git a/code/sdk/drivers/peripheral/a5133/A5133Main.c b/code/sdk/drivers/peripheral/a5133/A5133Main.c index 41eaca9de..eb988cd61 100644 --- a/code/sdk/drivers/peripheral/a5133/A5133Main.c +++ b/code/sdk/drivers/peripheral/a5133/A5133Main.c @@ -95,6 +95,7 @@ const Uint8 PN9_Tab[]= static uint8_t send_data[2][64] = {0}; static uint8_t send_data_index = 0; static bool update_flag = false; +static uint32_t history_timestamp = 0; errcode_t a5133_set_send_data(uint8_t *senddata,uint8_t datalen) { // total(64) , header(4), timestamp(4), len(1), data(n-11) , crc(2) @@ -254,7 +255,6 @@ void a5133_main(Uint8 Flag_MASTER,uint8_t channel) LOS_Msleep(10); }; RxPacket(); - update_flag = true; RF_FIFOWrite(PN9_Tab,64); if(RF_LVR_Check())/* check if BOD reset has occurred */ break;/* exit loop & re-RF init */ @@ -538,6 +538,11 @@ void a5133_get_rxdata(uint8_t *databuf,uint8_t len) update_flag = false; } +void a5133_get_rxdata_timestamp(uint32_t *timestamp) +{ + *timestamp = tmpbuf_rx_timestamp; +} + /********************************************************************* ** RxPacket *********************************************************************/ @@ -581,6 +586,11 @@ void RxPacket(void) { tmpbuf_len = datalen; tmpbuf_rx_timestamp = msg_timestamp; + if(history_timestamp != tmpbuf_rx_timestamp) + { + history_timestamp = tmpbuf_rx_timestamp; + update_flag = true; + } memset(tmpbuf_rx, 0 ,sizeof(tmpbuf_rx)); memcpy(tmpbuf_rx, &tmpbuf[1+4+4],datalen); } diff --git a/code/sdk/drivers/peripheral/a5133/A5133main.h b/code/sdk/drivers/peripheral/a5133/A5133main.h index 9e9c267b6..1674ee21f 100644 --- a/code/sdk/drivers/peripheral/a5133/A5133main.h +++ b/code/sdk/drivers/peripheral/a5133/A5133main.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-26 14:41:31 + * @LastEditTime: 2024-07-27 13:07:06 * @FilePath: /FD230/code/sdk/drivers/peripheral/a5133/A5133main.h * @Description: * @@ -76,5 +76,5 @@ void a5133_main(Uint8 Flag_MASTER,uint8_t channel); void a5133_get_rxdata(uint8_t *databuf,uint8_t len); errcode_t a5133_set_send_data(uint8_t *senddata,uint8_t datalen); bool a5133_get_update_state(void); - +void a5133_get_rxdata_timestamp(uint32_t *timestamp); #endif \ No newline at end of file diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.c b/code/sdk/drivers/peripheral/utils/custom_utils.c index 1953c1259..74ad4d185 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.c +++ b/code/sdk/drivers/peripheral/utils/custom_utils.c @@ -2611,5 +2611,11 @@ bool uapi_get_a5133_update_state(void) #else return false; #endif +} -} \ No newline at end of file +void uapi_get_a5133_rxdata_timestamp(uint32_t *timestamp) +{ +#ifdef SUPPORT_A5133_SERVICE + a5133_get_rxdata_timestamp(timestamp); +#endif +} diff --git a/code/sdk/drivers/peripheral/utils/custom_utils.h b/code/sdk/drivers/peripheral/utils/custom_utils.h index bd7f3dbbe..44aca45cb 100644 --- a/code/sdk/drivers/peripheral/utils/custom_utils.h +++ b/code/sdk/drivers/peripheral/utils/custom_utils.h @@ -242,6 +242,8 @@ void uapi_get_a5133_rxdata(uint8_t *databuf,uint8_t len); uint16_t CRC16_XMODEM(uint8_t *bytes,uint16_t length); errcode_t uapi_a5133_set_send_data(uint8_t *senddata,uint8_t datalen); void a5133_demo_msg_change_callback(void); +void uapi_get_a5133_rxdata_timestamp(uint32_t *timestamp); +bool uapi_get_a5133_update_state(void); #include "custom_utilscpp.h"