cancel
Showing results for 
Search instead for 
Did you mean: 

Setting the maximum number of advertisements for non-extended advertisements

BettleBerry
Associate II

I am trying to set the maximum number of times I send out an advertisement, I managed to do it with the extended advertisement quite easily. I did this using the "adv_set_param[i].adv_set.Max_Extended_Advertising_Events = 8;"

However now I want to do the same using the non-extended feature. Does anyone know how I can do this?

 

/* Functions Definition ------------------------------------------------------*/

uint8_t ADV_EXT_Config(void)

{

uint16_t data_cpt;

uint8_t i;

 

/* Extended NO SCANNABLE-NO CONNECTABLE */

data_cpt = 0;

memcpy(&a_extended_buff[data_cpt], &serial_number[0], sizeof(serial_number));

data_cpt += sizeof(serial_number);

 

memcpy(&a_extended_buff[data_cpt], &payload_data[0], sizeof(payload_data));

data_cpt += sizeof(payload_data);

 

i = 0;

adv_set_param[i].enable = 1;

adv_set_param[i].data = &a_extended_buff[0];

adv_set_param[i].data_len = data_cpt;

strcpy(adv_set_param[i].username, "MHE");

adv_set_param[i].sid = i;

adv_set_param[i].interval_min = 1000;

adv_set_param[i].interval_max = 1300;

adv_set_param[i].tx_power = CFG_BLE_MAX_TX_POWER;

adv_set_param[i].adv_channels = ADV_CH_37 | ADV_CH_38 | ADV_CH_39;

adv_set_param[i].property = 0x00;

adv_set_param[i].address_type = GAP_PUBLIC_ADDR;

adv_set_param[i].peer_address_type = GAP_PUBLIC_ADDR;

adv_set_param[i].p_peer_address = NULL;

adv_set_param[i].adv_set.Advertising_Handle = i;

adv_set_param[i].adv_set.Duration = 0;

adv_set_param[i].adv_set.Max_Extended_Advertising_Events = 8;

 

return 0;

}

1 REPLY 1
BettleBerry
Associate II

By the looks of it, you can only create a timer to then set a task that will call the Adv_cancel in order to stop the advertising. Should you wish to start the advertising again you just call the Adv_request function again.