无法在运行时更改属性UUID

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
7 posts / 0 new
Last post
chenpenglai
Offline
最后一次露面:1 month 3 weeks ago
加入:2018-12-24 02:24
无法在运行时更改属性UUID

I'm working in sdk 5.0.4

I want to change the exist service uuid and attribute uuid at runtime, because the attribute uuid is configured by the customer at run time through the serial port

I'm developing an AT instruction bluetooth module

我正在做以下

uint8_t new_uuid_arr[16]={1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1}; //a new uuid struct att_char128_desc *p1 = (struct att_char128_desc *)cust_prf_funcs->att_db[CUST1_IDX_SERVER_TX_CHAR].value; memcpy(p1->attr_type, new_uuid_arr, 16);

My expectation is that uuid change after the above code execution

But it doesn't work

请告诉我如何在运行后通过哪个函数更改存在uuid和属性UUID

是否有任何其他方法可以更改属性UUID?

Device:
PM_DIALOG.
Offline
最后一次露面:1天20小时前
工作人员
加入:2018-02-08 11:03
嗨chenpenglai,

嗨chenpenglai,

Did you try the following steps in the app_custs1_create_db() function? ? If yes, in which example of the SDK? How you would like to change the UUI?

uint8_t array_test_svc[] = {0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03}; uint8_t array_test_long_char[] = {0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04,0x04}; memcpy(cust_prf_funcs[i].att_db[CUST1_IDX_SVC].value, array_test_svc, 16); //This will do the change on the service

For changing the characteristics value you will have to apply the change in two places:

memcpy(cust_prf_funcs [i] .att_db [cust1_idx_svc] .value +(16 * 7),array_test_long_char,16);//将更改应用于该服务的包含包含特征的数组

Now apply the change to the characteristic itself :

memcpy(cust_prf_funcs[i].att_db[CUST1_IDX_LONG_VALUE_CHAR].value + 3, array_test_long_char, 16);

谢谢,PM_DIALOG.

chenpenglai
Offline
最后一次露面:1 month 3 weeks ago
加入:2018-12-24 02:24
I'm tried to execute above

我试图在app_custs1_create_db()函数中执行上面的代码,如下所示

void app_custs1_create_db(void){struct custs1_create_db_req * req * req = ke_msg_alloc(custs1_create_db_req,task_custs1,task_app,custs1_create_db_req);uint8_t i = 0;/ ******************添加********************* / uint8_t array_test_svc [] = {0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x0x03};uint8_t array_test_long_char [] = {0x04,0x04,0x0x04,0x04,0x0x04,0x04,0x04,0x04,0x0x04,0x04,0x04,0x04,0x04,0x04,0x0x04,0x04};memcpy(cust_prf_funcs [0] .att_db [cust1_idx_svc] .value,array_test_svc,16);memcpy(cust_prf_funcs [0] .att_db [cust1_idx_svc] .value +(16 * 7),array_test_long_char,16);memcpy(cust_prf_funcs[0].att_db[CUST1_IDX_SERVER_TX_CHAR].value + 3, array_test_long_char, 16); /****************** Added *********************/ while(cust_prf_funcs[i].task_id != TASK_NONE) { if(cust_prf_funcs[i].task_id == TASK_CUSTS1) { req->max_nb_att = cust_prf_funcs[i].max_nb_att; break; } else i++; } // Attribute table. In case the handle offset needs to be saved req->att_tbl = NULL; req->cfg_flag = 0; req->features = 0; // Send the message ke_msg_send(req); }

But the app_custs1_create_db() function can only change service uuid when the device startup

我想在运行时更改它,不要重启

在设备启动后,我尝试了更改array_test_svc []值并调用app_custs1_create_db()函数,但我无法更改服务uuid

chenpenglai
Offline
最后一次露面:1 month 3 weeks ago
加入:2018-12-24 02:24
Hello PM_Dialog

Hello PM_Dialog

我需要你的帮助

PM_DIALOG.
Offline
最后一次露面:1天20小时前
工作人员
加入:2018-02-08 11:03
嗨chenpenglai,

嗨chenpenglai,

My apologies for the delay. I’m working on that and I’ll try o get back to you as soon as possible. Which SDK example are you using?

谢谢,PM_DIALOG.

chenpenglai
Offline
最后一次露面:1 month 3 weeks ago
加入:2018-12-24 02:24
I'm working in ble_app

我在ble_app_peripheral工作

PM_DIALOG.
Offline
最后一次露面:1天20小时前
工作人员
加入:2018-02-08 11:03
嗨chenpenglai,

嗨chenpenglai,

I used the following code snippet and I am not able to replicate you issue. I used the ble_app_peripheral example of SDK5.0.4. The only change is CUST1_IDX_LONG_VALUE_CHAR instead of CUST1_IDX_SERVER_TX_CHAR. I assume that you have created a “Server Tx” characteristic.

#include“user_custs1_def.h”
void app_custs1_create_db(void){struct custs1_create_db_req * req * req = ke_msg_alloc(custs1_create_db_req,task_custs1,task_app,custs1_create_db_req);uint8_t i = 0;/ ******************添加********************* / uint8_t array_test_svc [] = {0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x03,0x0x03};uint8_t array_test_long_char [] = {0x04,0x04,0x0x04,0x04,0x0x04,0x04,0x04,0x04,0x0x04,0x04,0x04,0x04,0x04,0x04,0x0x04,0x04};memcpy(cust_prf_funcs [0] .att_db [cust1_idx_svc] .value,array_test_svc,16);memcpy(cust_prf_funcs [0] .att_db [cust1_idx_svc] .value +(16 * 7),array_test_long_char,16);memcpy(cust_prf_funcs [0] .att_db [cust1_idx_long_value_char] .value + 3,array_test_long_char,16);/ ******************添加了********************* / whis(cust_prf_funcs [i] .task_id!= task_none){if(cust_prf_funcs [i] .task_id == task_custs1){req-> max_nb_att = cust_prf_funcs [i] .max_nb_att;休息; } else i++; } // Attribute table. In case the handle offset needs to be saved req->att_tbl = NULL; req->cfg_flag = 0; req->features = 0; // Send the message ke_msg_send(req); }

因为,我无法复制这个问题,请尝试调试代码。另外,你的意思是什么不起作用?是设备广告吗?你能连接吗?你用调试模式运行它吗?

谢谢,PM_DIALOG.