This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts
This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

FULLY Custom Advertisement Data

hi everyone. we are migrating to nordic nrf51 series (before we used ble modules from another vendor blugiga which depends on cc2541 chip) so I m pretty new at nordic nrf51 series.

we had a working solution with that modules based on fully custom advertisement data and scan response data (31 of 31 byte for both of data types) because BGScript allows this ,and now we want to apply same solution model but with nrf51822 chip. in forum there are some question about with this topic but they are not same at exactly my situation.

can anyone share example code for this?. if there needs to make configuration on the api, how can i configure ? my best regards.

Parents
  • Hi there,

    Just to clarify some points:

    1. The SoftDevice does not verify if the advertising flags are present or not, you can have advertising data and scan response data without any flags at all
    2. The only aspect of the advertising data that is strictly enforced is the "triplet" format. You need to comply with the [size, type, ] format that is described in the spec

    This means that if you want to take all 31 bytes, you won't be able to, but you can easily use 29 of them for whatever you want:

      uint8_t adata[31];
      memset(adata, 0x00, sizeof(adata));
      adata[0] = 30;
      adata[1] = BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA;
      // now fill the 29 bytes with whatever you want
      for(i = 2; i < sizeof(adata); i++)
        adata[i] = i;
    
      retv = sd_ble_gap_adv_data_set(adata, sizeof(adata), NULL, 0);
    
Reply
  • Hi there,

    Just to clarify some points:

    1. The SoftDevice does not verify if the advertising flags are present or not, you can have advertising data and scan response data without any flags at all
    2. The only aspect of the advertising data that is strictly enforced is the "triplet" format. You need to comply with the [size, type, ] format that is described in the spec

    This means that if you want to take all 31 bytes, you won't be able to, but you can easily use 29 of them for whatever you want:

      uint8_t adata[31];
      memset(adata, 0x00, sizeof(adata));
      adata[0] = 30;
      adata[1] = BLE_GAP_AD_TYPE_MANUFACTURER_SPECIFIC_DATA;
      // now fill the 29 bytes with whatever you want
      for(i = 2; i < sizeof(adata); i++)
        adata[i] = i;
    
      retv = sd_ble_gap_adv_data_set(adata, sizeof(adata), NULL, 0);
    
Children
No Data
Related