Changing user_advertise_data to send manufacture data

⚠️
Hi there.. thanks for coming to the forums. Exciting news! we’re now in the process of moving to our new forum platform that will offer better functionality and is contained within the main Dialog website. All posts and accounts have been migrated. We’re now accepting traffic on the new forum only - please POST any new threads at//www.wsdof.com/support. We’ll be fixing bugs / optimising the searching and tagging over the coming days.
4 posts / 0 new
Last post
TMiranda
Offline
Last seen:2 years 6 months ago
加入:2017-11-16 18:00
Changing user_advertise_data to send manufacture data

Hi guys.
Currently I'm doing a prototype using the DA14585 chip. I'm trying to do a beacon-type prototype, so I only need to work with the advertise data for now.

My goal is to send the manufacture data on the advertising content this way, so I can access it with another device.
Currently, this is what my USER_ADVERTISE_DATA definition looks like:

#define USER_ADVERTISE_DATA "\x03"\
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
ADV_UUID_DEVICE_INFORMATION_SERVICE

我想发送马努facturer data as well, so I've changed it to

#define USER_ADVERTISE_DATA "\x03"\
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
"\xFF"\
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\

The problem is that my output on the Blue Gecko APP is not what I was expecting. It returns me an
0xFFFF
Unknown Service

Instead of
0x1234
Manufacturer Data

But the Blue Gecko APP doesn't recognize it as manufacture data. I've uploaded the Blue Gecko output on the attachment sessions so you can see what's happening.

EDIT:

If I try to change the USER_ADVERTISE_DATA to
#define USER_ADVERTISE_DATA "\xFF"\
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA

I get an error and my code doesn't run.

My current manufacturer specific data looks like this:
#define APP_AD_MSD_COMPANY_ID (0x1111)
#define APP_AD_MSD_COMPANY_ID_LEN (2)
#define APP_AD_MSD_DATA_LEN (sizeof(uint16_t))

So I'm trying to show 0x1111 on the advertising contents with the tag manufacturer data.

Attachment:
Device:
PM_Dialog
Offline
Last seen:3 days 15 hours ago
Staff
加入:2018-02-08 11:03
嗨TMiranda,

嗨TMiranda,

The advertising string should have a specific format, like . The manufacturer specific data is a flag that you can include your advertising data, but it should have this specific format. So, in case you want to include the Device Information Service and the manufacturer data, I would suggest you to use the following block of code:
#define USER_ADVERTISE_DATA "\x03"\
ADV_TYPE_COMPLETE_LIST_16BIT_SERVICE_IDS\
ADV_UUID_DEVICE_INFORMATION_SERVICE\
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA_LENGTH
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\
MANUFACTURER_SPECIFIC_DATA

如果你想要删除设备信息Service, I would suggest you to use the following block of code:
#define USER_ADVERTISE_DATA ADV_TYPE_MANUFACTURER_SPECIFIC_DATA_LENGTH
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA\
MANUFACTURER_SPECIFIC_DATA

In the block of code that you have posted, 0xFFFF is an expected result because in the USER_ADVERTISE_DATA you have included the 0xFF double. The ADV_TYPE_MANUFACTURER_SPECIFIC_DATA flag is by default defined in the app_adv_data.h and its value is 0xFF.

Thanks PM_dialog

TMiranda
Offline
Last seen:2 years 6 months ago
加入:2017-11-16 18:00
Thanks for the reply.

Thanks for the reply.

I'm currently unable to use any of the blocks of codes because they're returning me errors. Actually, there's no "ADV_TYPE_MANUFACTURER_SPECIFIC_DATA_LENGTH" and "MANUFACTURER_SPECIFIC_DATA" in the whole project.

I'm trying to change them this way:
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA_LENGTH = number of bytes that my manufacturer data contains ("\x02" for 2 bytes, for example)
MANUFACTURER_SPECIFIC_DATA = APP_AD_MSD_COMPANY_ID

But I'm still receiving errors. Also, since I'm changing the company_id dinamically on my project (by changing the mnf_data.company_id structure), how should I point this on the USER_ADVERTISE_DATA definition?

Another example:
I'm trying to send a hardcoded manufacturer data but I'm not able to receive it on the mobile app. This is the code:

#define USER_ADVERTISE_DATA "\x03"\ (length)
ADV_TYPE_MANUFACTURER_SPECIFIC_DATA
"\x07\x13" (hardcoded manufacture data)

Thanks.

PM_Dialog
Offline
Last seen:3 days 15 hours ago
Staff
加入:2018-02-08 11:03
嗨TMiranda,

嗨TMiranda,

Could you please classify in which project are you working on? These blocks of code are as an example in order to explain you how you can include the manufacturer data into the advertising string. Both of them are implemented in the ble_app_barebone project of the SDK. It is expected to be unable to use any of them, because you haven’t the correct definitions.
If you want to send hardcoded manufacturer data, as your second block of code, you should comment out the app_add_ad_struct() which is in the user_app_adv_start() function of the user_barebone.c file. This struct appends an extra 0xFF into the advertising string, so you get invalid data. In your block of code, you have forgotten to fill a “\” after the ADV_TYPE_MANUFACTURER_SPECIFIC_DATA
The ble_app_barebone project changes the advertising data dynamically. The advertising message is created in app_easy_gap_undirected_advertise_start_create_msg() function and then is saved in the cmd stracture when the app_easy_gap_undirected_advertise_get_active() function is invoked. This function returns the app_easy_gap_undirected_advertise_start_create_msg(). So, in case you want to change the company_id dynamically, you should append it in the correct member of the cmd struct.

Thanks PM_dialog