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

Creation of a secondary service?

I'm trying to write a test service on a PCA10001 that transmits a single scalar value that is computed from a few different sensor readings. I would like this service to send a notification when the scalar is outside a set range. The set/combination of sensors can vary from device to device, but I'd like the code to be as generic as possible.

My design approach would be to advertise the combined scalar as a primary service and each individual sensor reading as a secondary service.

My question is if there are any examples in the application notes, support material that show how to implement a server that provides a similar combination of services.

Parents
  • Sorry for the late response. If it's the requirement form your peer device (the client) that you must have a fixed list of primary services. Then it makes sense to have your unique services as secondary services. But for most use cases we know of, we can simply set all of the services as primary services. There maybe one use case, I can think of, is when you want to reduce the time needed for service discovery, so that only primary service is discovered and leave the secondary to be discovered later if needed. We do have secondary service supported with our S110 stack. When you add a service you would need to set the service type as BLE_GATTS_SRVC_TYPE_SECONDARY when calling sd_ble_gatts_service_add() and have to refer to that service from a primary service using sd_ble_gatts_include_add(). Unfortunately, we haven't got an example for that, we will try to make one.

  • Thanks so much for the response! That was helpful.

Reply Children
No Data
Related