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

Advertising data

hi. I refer at the example find here link text.

i want to transmit with Advertising, as the temperature is transmitted in the example, data from some sensors . But in the example i can transmit only a uint8_t data.

    uint8_t battery_data = battery_level_get();
uint32_t temperature_data = temperature_data_get();

service_data[0].service_uuid = BLE_UUID_BATTERY_SERVICE;
service_data[0].data.size    = sizeof(battery_data);
service_data[0].data.p_data  = &battery_data;

service_data[1].service_uuid = BLE_UUID_HEALTH_THERMOMETER_SERVICE;
service_data[1].data.size    = sizeof(temperature_data);
service_data[1].data.p_data  = (uint8_t *) &temperature_data;

I want to transmit a float variable or uint32_t or uint16_t.

Is it possible?

How can i do this?

Thank you for your attention

Parents
  • Hi

    Actually, the example code is transmitting uint32_t temperature_data. You can try to define

    uint32_t temperature_data = 0x12345678;
    

    instead of

    uint32_t temperature_data = temperature_data_get();
    

    to see how the uint32_t data appears on your central device. Then you just need to assemble your custom uint32_t data the right way on the central side.

    Update 19.1.2014 To advertise any custom data, use "Manufacturer Specific Data" advertising type. This thread and this thread describe it pretty well it seems. To advertise service data with UUID defined by Bluetooth SIG, use "Service Data" advertising type.

Reply
  • Hi

    Actually, the example code is transmitting uint32_t temperature_data. You can try to define

    uint32_t temperature_data = 0x12345678;
    

    instead of

    uint32_t temperature_data = temperature_data_get();
    

    to see how the uint32_t data appears on your central device. Then you just need to assemble your custom uint32_t data the right way on the central side.

    Update 19.1.2014 To advertise any custom data, use "Manufacturer Specific Data" advertising type. This thread and this thread describe it pretty well it seems. To advertise service data with UUID defined by Bluetooth SIG, use "Service Data" advertising type.

Children
No Data
Related