From 24728c206aff0e4c77edea8eb42a396e6799486c Mon Sep 17 00:00:00 2001 From: hcj <1224667075@qq.com> Date: Sat, 22 Jun 2024 15:01:02 +0800 Subject: [PATCH] =?utf8?q?=E7=9F=AD=E4=BF=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- .../wearable/service/ble_service/bleservice/bleEvent.c | 6 ++++++ .../wearable/service/ble_service/bleservice/bleEvent.h | 5 +++++ .../drivers/peripheral/slip/cat1Service/cat1_server.cpp | 9 +++++++++ .../drivers/peripheral/slip/cat1Service/cat1_server.h | 2 ++ code/sdk/drivers/peripheral/utils/pdu.c | 5 +++++ 5 files changed, 27 insertions(+) diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c index 394ef20d6..ae3665fdc 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.c @@ -5139,6 +5139,12 @@ void ancsDataShowCmd(uint16_t cmd,uint8_t *data,uint16_t len,uint8_t *totalData, sendBleData(value,19); } } + +void CustomEventPublish_TOPIC_EVENT_MESSAGENOTE(void) +{ + CustomEventPublish(TOPIC_EVENT_MESSAGENOTE,NULL,0); +} + void type2AE1Data(uint8_t *buf_cmd,uint8_t *data,uint16_t datalen,uint8_t *totalData,uint8_t crcvalue) { uint16_t typeID = buf_cmd[1]*256+buf_cmd[2]; diff --git a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h index 04fc9920f..280ac824f 100644 --- a/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h +++ b/code/sdk/application/wearable/service/ble_service/bleservice/bleEvent.h @@ -765,6 +765,11 @@ bool Read_tar_file_buf_send_Data(uint16_t pack_size,uint8_t id); uint8_t get_crc_from_lrc(uint8_t lrcValue); uint8_t calculate_lrc_file(char *file_path); + +void message_data(int uid,int appid,char *title,char *msg,int hasCode); + +void CustomEventPublish_TOPIC_EVENT_MESSAGENOTE(void); + #ifdef __cplusplus } #endif diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp index 07d16600a..f15e418ea 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.cpp @@ -92,6 +92,13 @@ enum UDP_COMMAND_HEAD { }; static uint8_t g_msg_format_type = 0;// 0: old format , 1: new format +static char ble_buffer[20] = {0}; + +void ble_get_cat1_at_msg(char *buffer,uint8_t len) +{ + memcpy_s(buffer,len,ble_buffer,strlen(ble_buffer)); +} + static uint8_t get_int8_from_ascii_char( uint8_t ascii) { @@ -1232,6 +1239,8 @@ static int udp_packet_parse(char *rx_buffer, int len) index = cat1_handle_version_msg(msg_buffer); break; case UDP_CMD_MSG_ATCMD: + memset_s(ble_buffer,20,0,20); + memcpy_s(ble_buffer,20,msg_buffer,strlen(msg_buffer)); if (strlen(msg_buffer) == 0) { PRINT("ATCMD reply len(0): OK\n"); diff --git a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h index 0ac8edd84..128cc9b25 100644 --- a/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h +++ b/code/sdk/drivers/peripheral/slip/cat1Service/cat1_server.h @@ -36,6 +36,8 @@ void set_telecom_dmp_switch_to_cat1(uint8_t on);//设置电信入库功能开关 void save_regist_time_to_ble(char *msg);//保存注册的时间戳 void get_regist_time_toCat1(void); +void ble_get_cat1_at_msg(char *buffer,uint8_t len); + #ifdef __cplusplus #if __cplusplus } diff --git a/code/sdk/drivers/peripheral/utils/pdu.c b/code/sdk/drivers/peripheral/utils/pdu.c index 81df84adc..21f261615 100644 --- a/code/sdk/drivers/peripheral/utils/pdu.c +++ b/code/sdk/drivers/peripheral/utils/pdu.c @@ -10,6 +10,7 @@ #include #include #include +#include enum { BITMASK_7BITS = 0x7F, @@ -320,6 +321,10 @@ int pdu_decode_example(const char *inpdustr ) timenow->tm_hour, timenow->tm_min, timenow->tm_sec); + + message_data(0,0,phone_number,text,0); + CustomEventPublish_TOPIC_EVENT_MESSAGENOTE(); + } return ret; } -- 2.17.1