From: penglei <1624952103@qq.com> Date: Thu, 18 Apr 2024 07:42:35 +0000 (+0800) Subject: 添加蓝牙产测通讯录功能 X-Git-Tag: release_V1.2.70_20241020_135402~1172^2~1 X-Git-Url: http://git.snicker.com.cn/?a=commitdiff_plain;h=refs%2Fchanges%2F44%2F1;p=mirrors%2FFD230.git 添加蓝牙产测通讯录功能 --- diff --git a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp index 420a57ae8..722bb88b5 100644 --- a/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp +++ b/code/sdk/application/wearable/fd230app/nativeui/phone/src/phoneaddressmodel.cpp @@ -245,6 +245,7 @@ namespace OHOS // =(char *)malloc(strlen(data->phone_number_t[i].number)); memset(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number,0,NUMBER_LEN); strcpy(addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number,data->phone_number_t[i].number); + WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "%s",addressbook_t.Contact_t[addressbook_t.num].phone_number_t[i].number); } else { @@ -296,7 +297,7 @@ namespace OHOS data.sex=0; strcpy(data.name,name); - data.phone_num=2; + data.phone_num=1; // =phone; strcpy(data.phone_number_t[0].number,phone); @@ -308,6 +309,10 @@ namespace OHOS // data.phone_number_t[1].number=NULL; // data.phone_number_t[1].affiliating_area=NULL; // data.phone_number_t[1].operator_t=NULL; + memset(data.phone_number_t[1].number,0,NAME_LEN); + memset(data.phone_number_t[1].affiliating_area,0,AREA_LEN); + + memset(data.phone_number_t[1].affiliating_area,0,OPERATOR_LEN); WEARABLE_LOGE(WEARABLE_LOG_MODULE_APP, "phoneaddressbook::phoneaddressbook"); diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp index 713397a29..7c6e4272f 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.cpp @@ -48,6 +48,18 @@ extern "C" { #include "bleService.h" +void add_addressbookToRead(char *data)//转化用于·c文件 +{ + char *name=NULL; + char *phone=NULL; + name=strtok(data,","); + phone=strtok(NULL,NULL);//data+strlen(name); + PRINT("phone : %s \r\n",phone); + OHOS::add_addressbook_by_AT(name,phone); + return; +} + + void set_languaage(uint32_t id) diff --git a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h index 49bf3e6ee..26067d983 100644 --- a/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h +++ b/code/sdk/application/wearable/service/ble_service/blemoder/bletest.h @@ -46,7 +46,7 @@ uint8_t ble_is_connect_ready(void); char *addressbook(void); void addressbookToRead(void); const char *get_health_data_path(void); - +void add_addressbookToRead(char *data); #ifdef __cplusplus #if __cplusplus } 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 2d9edcd25..e54d7e971 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.c @@ -24,6 +24,7 @@ #include "nandflash_config.h" #include "string.h" #include "custom_utils.h" +#include "bletest.h" #pragma pack(1) typedef struct factorytest_cmd_header_t { @@ -701,7 +702,6 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint case BLE_TEST_CMD_SOFT_TEST_SUB_MODE_AGING_TEST: if(testitem == 0x01) { - PRINT("111\r\n"); //进入老化命令 uint8_t send_data = 0x00; aging_time = (*data) * 60 * 60; @@ -713,7 +713,6 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint 1); } else if(testitem == 0x02) { - PRINT("222\r\n"); //停止老化 uint8_t send_data = 0x00; @@ -1248,7 +1247,6 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint 1); } else if(testitem == 0x03) { - PRINT("111\r\n"); //查看sim卡插入状态 uint8_t send_data[2] = {0}; uint16_t len = sizeof(send_data); @@ -1375,6 +1373,21 @@ void factorytest_protocol_soft_test_decode(uint8_t submode,uint8_t testitem,uint break; + case BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CONTACTS: + if(testitem == 0x01) + { + //通讯录 + uint8_t send_data = 0x00; + + add_addressbookToRead((char *)data); + + factorytest_protocol_replymsg(BLE_TEST_CMD_MODE_SOFT_TEST, + BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CONTACTS, + 0x01, + &send_data, + 1); + } + break; default: printf(""); break; diff --git a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.h b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.h index 5d9c098e6..380921662 100644 --- a/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.h +++ b/code/sdk/application/wearable/service/factorytest_service/factorytest_protocol.h @@ -91,6 +91,8 @@ extern "C" { #define BLE_TEST_CMD_SOFT_TEST_SUB_MODE_EXTRAM 0x19 //软件测试 子模式ID CAT1 #define BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CAT1 0x1A +//软件测试 子模式ID 通讯录 +#define BLE_TEST_CMD_SOFT_TEST_SUB_MODE_CONTACTS 0x30 /** * * encode cmd msg string and send to ble