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

Discovering problem for different 128-bit service and characteristic uuid as a central device

Hello;

I am using NRF51822 with SDK12.3 as a central device. I want to discover and connect a peripheral bluetooth device by using my NRF51822 central device.

If the service and characteristic is the same, for example service uuid is "00002234-b38d-4985-720e-0f993a68ee41" and characteristic uuid is "00002235-b38d-4985-720e-0f993a68ee41" , I can enable the notification of the characteristic and NRF51 get data from this peripheral device by using this characteristic.

However, If the service and characteristic is the different, for example service uuid is "680c21d9-c946-4c1f-9c11-baa1c21329e7" and characteristic uuid is "003bbdf2-c634-4b3d-ab56-7ec889b89a37", I can connect to this device but NRF51 discovers all characteristics as 0x00 and cannot enable the notification.

Is there a way to handle this problem?

Thanks.

Parents Reply Children
  • Thanks for response, tesc. Also, sorry for late response.

    I must use NRF51822 device, so I am using SDK 12.3.0. In this SDK, I am using "ble_app_uart_c" central example. I registered my 128-bit service UUID. However, In this example, this central example discovers  the characteristic of this service by using 16-bit UUID address. For example;

    Service: "00002234-b38d-4985-720e-0f993a68ee41" (This service is added inside the central code.)

    Characteristic of this service: "00002235-b38d-4985-720e-0f993a68ee41" (0x2235 adress is added inside the central code.)

    In this situation, there is no problem. Because, the central example code only uses the 16-bit UUID address(0x2235) to discover the characteristics. However;

    Service: "680c21d9-c946-4c1f-9c11-baa1c21329e7"

    Characteristic of this service: "003bbdf2-c634-4b3d-ab56-7ec889b89a37"

    In this situation, I can discover the service correctly. There is no problem. But, I cannot discover characteristics of this service because they have different 128-bit UUID address. The problem arises in this case.

    ....
    
    ble_gatt_db_char_t * p_chars = p_evt->params.discovered_db.charateristics;
    if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE){
    			
    	printf("SERVICE: %d\r\n", p_evt->params.discovered_db.srv_uuid.type);
    }
    
    if (p_evt->evt_type == BLE_DB_DISCOVERY_COMPLETE &&
            p_evt->params.discovered_db.srv_uuid.uuid == BLE_UUID_SENSOR_SERVICE &&
            p_evt->params.discovered_db.srv_uuid.type == p_ble_sensor_c->uuid_type)
        {
    		printf("CHAR SIZE: %d\r\n", p_evt->params.discovered_db.char_count);
    
            for (i = 0; i < p_evt->params.discovered_db.char_count; i++)
            {
    			printf("UUID: %d\r\n", p_chars[i].characteristic.uuid.uuid);
                switch (p_chars[i].characteristic.uuid.uuid)
                {
                    case BLE_UUID_SENSOR_CHARACTERISTIC:
                        sensor_c_evt.handles.sensor_rx_handle = p_chars[i].characteristic.handle_value;
                        sensor_c_evt.handles.sensor_rx_cccd_handle = p_chars[i].cccd_handle;
                        break;
                    
                    ...    
                } 
        ...
    }    

    This is my code and the output is like this.

    For first situation; the log outputs are like this.

    SERVICE: 00002234-b38d-4985-720e-0f993a68ee41

    CHAR_SIZE: 2

    UUID: 0x2435

    UUID: 0x2436

    For second situation; the log outputs are like this.

    SERVICE: 680c21d9-c946-4c1f-9c11-baa1c21329e7

    CHAR_SIZE: 5

    UUID: 0x0

    UUID: 0x0

    ....

    My question is how to get 128-bit characteristic UUID by using central example. Thanks for your help and sorry for my bad english. 

    Thanks.

  • Sorry for the delayed response. May I first ask why you want to have a different base UUID for your service & your characteristic? If you do want to use a different base UUID for your service & the service's characteristic, you can do this. Take a look at this devzone case for more info, as well as the S130 v2.0.1 softdevice API documentation.

Related