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.
嗨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 \
制造商_specific_data.
In case you want to remove the Device Information 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 \
制造商_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.
谢谢pm_dialog.
谢谢回复。
我目前无法使用任何代码块,因为他们返回了错误。实际上,整个项目中没有“adv_type_manufacturer_specific_data_length”和“制造商_specific_data”。
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)
制造商_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)
谢谢。
嗨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.
谢谢pm_dialog.