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

Advertising multiple Services.

Hi,

I have Six services in my project to be advertised and make available to the user at a time.

  • first I have faced problem while advertising two vendor UUID's.I solved that issue by adverting one in advertising packet and the other in scan response packet.
  • Next I tried advertising three vendor UUID's.I was unable to advertise and then I was suggested by nRF Engineer to use EA as done in  ble_app_rscs example.
  • I did the same but I was able to advertise services but unable to scan services on nRF Connect for mobile.And it is same with ble_app_rscs.Then after going through several posts with similar issues I understood  that  it is most likely due to the Phone not supporting AE.
  • And then I was suggested that If I am unable to use AE, there is no way to advertise more than two vendor UUIDs simultaniously.The only way to implement is to advertise a vendor UUID, stop advertising, update your advertising packet with another UUID and start advertising again.

The link is my previous post https://devzone.nordicsemi.com/f/nordic-q-a/62153/advertising-services related to adverising services.

Before starting the procedure mentioned in last point.

when I kept on trying to advertise multiple services.In one way I was able do it.i.e I simply added services to m_adv_uuids and set appropriate value for NRF_SDH_BLE_VS_UUID_COUNT

and changed ram start location and ram maximum size.I found that five services that I have added in globally declared array i.e m_adv_uuid are able to advertise and scan on nRF Connect for mobile.

Then when I was rechecking the code I found that there is also locally declared m_adv_uuid with one service in it.I just commented it out and then tested again application then I was stuck with an error12.Again if I remove comment and check its working status then again it is able to advertise all the services which were declared globally.The below are the code snippets.

This is the globally declared array.

In below image If I remove highlighted statement it is displaying error12.If I run by including that statement then I am able to advertise all declared services.

Can you please let me know if the approach that I have implemented is correct or not?In this way I am able to make services available at a time to the user.But unable to understand what that locally declared variable is doing internally.

I even tried by changing solicitated variable with uuids_complete and uuids_mre_avaiable.I was getting same Error12.

Thanks & Regards,

Swathi P.

Parents Reply Children
  • I really don't understand you. The user can access all 6 services when they connect. 

    Why do you need to have the service to be advertised ? 


    When it's not in the advertising packet what would be the problem ? 


    You can build your app to detect your device when there is for example matched name, or matched data in advertising packet. 

  • Hi,

    Final output is I am making services available to the user on connection.

    But,My question is weather the way I have implemented is right or not?

    On android I am able to discover all services on connection.When I try testing on iOS only the service which is in advertising packet is available on connection.

    I want this to implement on both iOS and Android.

    If this approach is right what might be the reason that only one service is available on connection.If approach is wrong then what might be the right way to implement for making all the services available to user at a time.

    Thanks & Regards,

    Swathi P

  • There is no connection between the advertising data and the actual attribute table (available in connection). The advertising data can have one or some of the services that available in the attribute table but it's not obligatory. If you have an issue with iOS you need to describe it, I don't see that in your question. 
    Please pay attention on the UUID declaration you have. From the screenshot I saw, they look very strange. Please write down here the UUID list of your service and characteristic, would it match with what you see on Android ? 
    Which app did you use on iOS to test it ?

    Please post the code where you declare your service and characteristic. 

  • Which app did you use on iOS to test it ?

    nRF Connect.

    Please pay attention on the UUID declaration you have. From the screenshot I saw, they look very strange. Please write down here the UUID list of your service and characteristic, would it match with what you see on Android ? 

    The UUID present in array is

    #define BLE_UUID_TEMPSERV_BASE_UUID {0x86,0x42,0x0e,0x57,0xce,0xfd,0xb3,0x96,0x47,0x4f,0x11,0x8c,0x00,0x00,0x95,0x82}

    UUID generated is

    8295923d-8c11-4f47-96b3-fdce570e4286

  • Hi Swathi, 

    Thanks for the UUID but you mentioned you have 6 services how do you define them, which UUID they have? in the screenshot you provided I don't see the UUID 8295923d-8c11-4f47-96b3-fdce570e4286 being used.

    For example: 

Related