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

Advertise two services at the same time?

EDIT: I have added the battery data in percentage to scan response manufacturer specific data. Is that the only possible way?

Hello,

I am working on a beacon application that updates the advertisement every second.

I have a "time counter", so to say, that is stored in the manufacturer specific data. Additionally, I have a "temperature" or "rotation speed" service. It depends on the hardware of the node.

I would like to advertise a second service for seeing the battery percentage status but cannot figure out how to do it. I tried to do this but obviously it seems I just overwrite first temperature advdata with battery data and then I advertise only battery service. I would like to see both temperature and battery data on the nRF Connect app.

uint8_t rotation_data[] = {value_0,value_1,value_2,value_3};
rotation.data.p_data = rotation_data;
rotation.data.size = sizeof(rotation_data);
rotation.service_uuid = 0x1815; //Official SIG temperature service
init.advdata.p_service_data_array = &rotation;
    
uint8_t battery_data[] = {percentage_batt_lvl};
battery.data.p_data = battery_data;
battery.data.size = sizeof(battery_data);
battery.service_uuid = 0x180F; //official SIG battery service
init.advdata.p_service_data_array = &battery;

Parents Reply Children
No Data
Related