This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Why can't modify the service uuid in the example of ble_app_uart?

Hi , I am using nRF51 SDK with S130 soft device lib, and it is running well when downloading the example of ble_app_uart. But when I want to modify the service UUID from custom UUID to SIG based UUID, after downloading the program do not work with the led not flashing. I just comment the sd_ble_uuid_vs_add calling and add a line that assigning the BLE_UUID_TYPE_BLE to ble_uuid_t.type , the codes I modified showing blow:

// Add a custom base UUID.

// err_code = sd_ble_uuid_vs_add(&nus_base_uuid, &p_nus->uuid_type);

// VERIFY_SUCCESS(err_code);

// ble_uuid.type = p_nus->uuid_type; // Comment above three lines.

p_nus->uuid_type = ble_uuid.type = BLE_UUID_TYPE_BLE; // Add this line

ble_uuid.uuid = BLE_UUID_NUS_SERVICE;

I think maybe there is something I am not aware of about adding a service. Because I used the same way to add another service successfully , but in this project it did not work. Forget to mention that when I just uncomment the line of sd_ble_uuid_vs_add and other lines don't change , it could work. So I wonder that if I don't want create a custom service uuid why I should call the function of sd_ble_uuid_vs_add , I think it is not meaningful before I assign the BLE_UUID_TYPE_BLE type.

Greetings.

Evan

Parents
  • I finally found the problem solution. when I check the function of advertising_init(), I found the p_uuid of the 'advdata' variable must be assigned with an array of UUID of services which we want to advertise. So when I change the UUID of service , advdata can not find the original UUID because I did not add it to the stack.So the solution is to change the original UUID to the new UUID in the definition of variable of 'm_adv_uuids', then it works.

Reply
  • I finally found the problem solution. when I check the function of advertising_init(), I found the p_uuid of the 'advdata' variable must be assigned with an array of UUID of services which we want to advertise. So when I change the UUID of service , advdata can not find the original UUID because I did not add it to the stack.So the solution is to change the original UUID to the new UUID in the definition of variable of 'm_adv_uuids', then it works.

Children
No Data
Related