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
  • Hi, 


    Could you show a screenshot on what you have in the advertising packet when you advertise with all services ? What's the advertising data you can see on the phone ? 
    You may know that when you don't use AE , the advertising packet size is limited to 31 bytes for advertising packet and 31 bytes for scan response packet. 

    Each 128 bit UUID is 16 bytes. How can you fit them into advertising packet ? There are many overhead needed as well. 

    But we have to go back to the question, why do you need to advertise all the services in your advertising packet ? 

    If you need to tell the phone which service the device has, can you do that with a coded/proprietary text? For example if you advertise it with A B C D E, meaning it has 5 services A B C D and E. It's anyway proprietary`service/protocol, isn't it? 

  • Hi,

    Thank you for the response.

    Could you show a screenshot on what you have in the advertising packet when you advertise with all services ? What's the advertising data you can see on the phone ? 

    But we have to go back to the question, why do you need to advertise all the services in your advertising packet ? 

    Because I Should make all services available to user to operate.

    If you need to tell the phone which service the device has, can you do that with a coded/proprietary text? For example if you advertise it with A B C D E, meaning it has 5 services A B C D and E. It's anyway proprietary`service/protocol, isn't it? 

    But How can user can access those services by implementing such way?

    Thanks & Regards,

    Swathi P

  • Hi Swathi, 
    I'm sorry for late response, I was on vacation. 

    The advertising packet data is what you see in the Scanner panel, not when you connected to the device. 

    For example here: 

    And here raw data



    You can find that the device advertising with one 128 bit UUID service and the device name Seos

    Please try capture the same with your device, in the Scanner panel. 

  • Hi,

    The below are the attachments.

    I can understand from those captures that only one Service is getting advertising.Is that right?If So,How Am I able to operate 6 services after getting connected?

    Thanks & Regards,

    Swathi P

  • Hi Sawthi, 


    Yes it's correct. You advertise with one service. 

    But you still can have 6 services in the attribute table when in connection. No problem with that.

    Why do you need to advertise with all 6 services ? 

  • The reason is I want to make all 6 services available to user at a time.

  • 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. 

Reply Children
  • 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: 

  • Hi Hung Bui,

    I am totally confused.How did you get that UUID displayed?Have you created a service and tested?Or you got the UUID mentioned in above screenshot from my side?

    Thanks & Regards,

    Swathi P

Related