Unable to change attribute uuid at running

⚠️
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
Last seen:1 month 3 weeks ago
加入:2018-12-24 02:24
Unable to change attribute uuid at running

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

I'm doing the following

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

Please tell me how do I change exist service uuid and attribute uuid by which function after running

Is there any other way to change attribute uuid ?

Device:
PM_Dialog
Offline
Last seen:1 day 2 hours ago
工作人员
加入: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); //Apply the change to the array of the included characteristics of the service

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);

Thanks, PM_Dialog

chenpenglai
Offline
Last seen:1 month 3 weeks ago
加入:2018-12-24 02:24
I'm tried to execute above

I'm tried to execute above code in the app_custs1_create_db() function, as follows

空白app_custs1_create_db {struct custs1_cr(无效)eate_db_req *req = KE_MSG_ALLOC(CUSTS1_CREATE_DB_REQ, TASK_CUSTS1, TASK_APP, custs1_create_db_req); uint8_t i = 0; /****************** Added *********************/ 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[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

I want to change it at runtime, do not reboot

I tried change array_test_svc[] value and called app_custs1_create_db() function after device started, but I couldn't change the service uuid

chenpenglai
Offline
Last seen:1 month 3 weeks ago
加入:2018-12-24 02:24
Hello PM_Dialog

Hello PM_Dialog

I need your help

PM_Dialog
Offline
Last seen:1 day 2 hours ago
工作人员
加入: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?

Thanks, PM_Dialog

chenpenglai
Offline
Last seen:1 month 3 weeks ago
加入:2018-12-24 02:24
I'm working in ble_app

I'm working in ble_app_peripheral

PM_Dialog
Offline
Last seen:1 day 2 hours ago
工作人员
加入: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"
空白app_custs1_create_db {struct custs1_cr(无效)eate_db_req *req = KE_MSG_ALLOC(CUSTS1_CREATE_DB_REQ, TASK_CUSTS1, TASK_APP, custs1_create_db_req); uint8_t i = 0; /****************** Added *********************/ 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[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); /****************** 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); }

Since, I am not able to replicate the issue, please try to debug your code. Additionally, what do you mean that is not working? Is the device advertising? Are you able to connect? Did you run it in debug mode?

Thanks, PM_Dialog