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? 

Reply
  • 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? 

Children
  • 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 think there is a misunderstanding of what "advertising packet" is. What you showed in the screenshots are the attribute table, not the advertising packet(s). 

    So what you are doing is fine. But I'm seeing multiple different UUID bases in your screenshot. When in your code all of the base are BLE_UUID_TYPE_VENDOR_BEGIN. Please double check. 

  • Thank you for the response.

    So what you are doing is fine. But I'm seeing multiple different UUID bases in your screenshot. When in your code all of the base are BLE_UUID_TYPE_VENDOR_BEGIN. Please double check. 

    These are the UUID's Iam passing through array.

    static ble_uuid_t m_adv_uuids[] = {
    {BLE_UUID_CURRENT_TIME_SERVICE, BLE_UUID_TYPE_BLE},
    {BLE_UUID_BATTERY_SERVICE, BLE_UUID_TYPE_BLE},
    {BLE_UUID_TEMP_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    {BLE_Notif_UUID_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    {BLE_UUID_RTC_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    {BLE_UUID_HEATER_SERVICE, BLE_UUID_TYPE_VENDOR_BEGIN},
    };

    I think there is a misunderstanding of what "advertising packet" is. What you showed in the screenshots are the attribute table, not the advertising packet(s). 

    May I know what would be the best way to capture advertising packet(s)?

    Thanks & Regards,

    Swathi P

  • Hi,

    Please Suggest me on my last reply.

    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. 

Related