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

How to send the 128-bit base UUID

Hello,

I am developing on the nRF51 and soft device version 8.0.0.

I have created a new service that has a 128-bit UUID that is based on the base UUID: 00000000-0000-1000-8000-00805f9b34fb

I am trying to make the service discoverable with the full 128-bit service UUID, but it always just shows the 16-bit UUID.  Is there a way to show the whole UUID?  Here is my initialization code:

  const ble_uuid128_t service_uuid128 = {
    {
      0xFB, 0x34, 0x9B, 0x5F, 0x80, 0x00, 0x00, 0x80,
      0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00
    }
  };

  BLE_UUID_BLE_ASSIGN(service_uuid, BLE_MY_GATT_SERVICE_UUID);

  err_code = sd_ble_uuid_vs_add(&service_uuid128, &(service_uuid.type));
  if (err_code != NRF_SUCCESS) {
      return err_code;
  }

  err_code = sd_ble_gatts_service_add(BLE_GATTS_SRVC_TYPE_PRIMARY,
                                      &service_uuid,
                                      &(p_my_service->service_handle));
  if (err_code != NRF_SUCCESS) {
    return err_code;
  }
 

Thanks

Parents Reply Children
  • Sure,

    When I connect to my device using a BLE sniffer (e.g. BlueSee), I only see a 16-bit Service UUID (In this example the UUID is 0xDEAD):

    09:10:30.8920: connected in underlying BLE layer.
    09:10:30.8930: discovered services: (
        DEAD,
        "Device Information"
    )
    09:10:31.0390: discovered characteristics for service 180A: (
        "Manufacturer Name String",
        "Model Number String",
        "Serial Number String",
        "Hardware Revision String",
        "Firmware Revision String",
        "Software Revision String"
    )
    09:10:31.2480: discovered characteristics for service DEAD: (
        "0000FFF1-1212-0CAA-142F-C9B16EC683AB",
        "0000FFF2-1212-0CAA-142F-C9B16EC683AB",
        "0000FFF3-1212-0CAA-142F-C9B16EC683AB",
        "0000FFF4-1212-0CAA-142F-C9B16EC683AB"
    )
    

    If I use a debugger to look at the resulting type id from sd_ble_uuid_vs_add(), it is 0x1 (BLE_UUID_TYPE_BLE)

    If I use a different UUID, for example, changing one bit in the 128-bit UUID (00000000-0000-1000-8000-00805f9b34fc) the sniffer sees this:

    09:10:30.8920: connected in underlying BLE layer.
    09:10:30.8930: discovered services: (
        "0000DEAD-0000-1000-8000-00805F9B34FC",
        DEAD,
        "Device Information"
    )
    09:10:31.0390: discovered characteristics for service 180A: (
        "Manufacturer Name String",
        "Model Number String",
        "Serial Number String",
        "Hardware Revision String",
        "Firmware Revision String",
        "Software Revision String"
    )
    09:10:31.2480: discovered characteristics for service 0000DEAD-0000-1000-8000-00805F9B34FC: (
        "0000FFF1-1212-0CAA-142F-C9B16EC683AB",
        "0000FFF2-1212-0CAA-142F-C9B16EC683AB",
        "0000FFF3-1212-0CAA-142F-C9B16EC683AB",
        "0000FFF4-1212-0CAA-142F-C9B16EC683AB"
    )
    

    Note that DEAD now has the 128-bit Service UUID.

    Is there some filtering done for base UUIDs?

Related