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

Looking for way to get central to match service UUID pattern

I am trying to provide a custom peripheral service with a 128-bit UUID in an nRF51822. I would like to use two bytes of the UUID to encode a piece of information unique to each device, but the service is the same in all devices, and the characteristic UUID are all the same. I need to connect to each peripheral with a central (S130) softdevice, but the only way I see to do this is to register a separate service for every expected UUID with ble_db_discovery_evt_register. This is impractical for any more than a few values. Is there any way to have the discovery process treat the UUID as a pattern, producing a match for only part of it? Or is there some way to update the discovery db with the appropriate service UUID each time before connecting to a peripheral? Thanks in advance for any suggestions.

Parents
  • Several options. Don't use the discovery manager, write your own discovery code directly using the softdevice events.

    Alternatively the discovery manager code is pretty simple, start with it and modify it to discover all services and match the UUID you want instead of registering for exact service matches.

    Or before you call the discovery manager code, do your own initial query of all the services on the device, handle the callbacks, find the service you want, then put its actual UUID in the discovery db and run it from there. Bit wasteful but not very.

    .. adding another .. put the two bytes in some custom manufacturer data in the advertisement or scan response data so you know what the full service will be before you go discover it .. or don't even then bother to change the service uuid, just use the bytes you got during scanning

  • I would definately consider custom manufacturer data, or perhaps add the required information to service data. According to the latest BLE Core Specification Supplement the Service UUID in service data is optionally followed by additional service data. I have not looked into what exactly is the purpose of this additional data or if this is easily done through the SDK, though.

Reply
  • I would definately consider custom manufacturer data, or perhaps add the required information to service data. According to the latest BLE Core Specification Supplement the Service UUID in service data is optionally followed by additional service data. I have not looked into what exactly is the purpose of this additional data or if this is easily done through the SDK, though.

Children
No Data
Related