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

User/custom data in advertising packets?

The BTLE specification does allow user/custom data to be added to the advertising packets. Which field in the advertising data structure is the right place for adding such data? I'd like to avoid hacks, so prefer to do it only where appropriate.

Parents
  • Does it make any sense if I want to output some value via advertising package to use manufacturer specific data? if so, then

    typedef union {
        uint8_t  adv_manuf_data_data[1];
        int16_t  val;
    } actual_data_u;
       /*****/
    static void advertising_init(uint8_t adv_flags, int16_t val) 
    {
        actual_data_u my_data;
      /****/  
       actual_data.val = val;
       adv_manuf_data_array.p_data = my_data.adv_manuf_data_data;
       adv_manuf_data_array.size = sizeof(adv_manuf_data_data); 
       /****/
    }
    

    When I need to change then I'll call this function again.

    Thank you.

Reply
  • Does it make any sense if I want to output some value via advertising package to use manufacturer specific data? if so, then

    typedef union {
        uint8_t  adv_manuf_data_data[1];
        int16_t  val;
    } actual_data_u;
       /*****/
    static void advertising_init(uint8_t adv_flags, int16_t val) 
    {
        actual_data_u my_data;
      /****/  
       actual_data.val = val;
       adv_manuf_data_array.p_data = my_data.adv_manuf_data_data;
       adv_manuf_data_array.size = sizeof(adv_manuf_data_data); 
       /****/
    }
    

    When I need to change then I'll call this function again.

    Thank you.

Children
Related