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
  • Thank you for reply, very helpful. Just to be on the same page. There is no requirement for the fixed list of primary services. Client always needs to know the temperature in my example. The combine temperature is different for different devices and depends upon number and location of sensors. This configuration may be requested only if needed.So, does it make sense to have various primary services if in majority cases the combine temperature is sufficient. I don't have enough experience to decide and hope that you do. Thanks again.

  • @Michurin: You would need to let me know more detail on your central device. Do you have control over the stack of the central device ? or it's common central such as a phone/tablet ? As mentioned before, I don't see any draw back to declare all of your service as primary service except for the longer discovery time. If you have control over the central stack, you can reduce this discovery time by stop discovery when you has found the primary service you want.

    Please be noted that not all central stack have full support to automatically discovery secondary services (e.g S120 stack).

    So, still, my suggestion is to declare all of your services as primary services.

Reply
  • @Michurin: You would need to let me know more detail on your central device. Do you have control over the stack of the central device ? or it's common central such as a phone/tablet ? As mentioned before, I don't see any draw back to declare all of your service as primary service except for the longer discovery time. If you have control over the central stack, you can reduce this discovery time by stop discovery when you has found the primary service you want.

    Please be noted that not all central stack have full support to automatically discovery secondary services (e.g S120 stack).

    So, still, my suggestion is to declare all of your services as primary services.

Children
No Data
Related