2022-10-17 12:30 AM
uint8_t adv_bag1[] = {0x02,0x01,0x06,0x10,0x09,'M','i','n','e','w','-','B','L','E','-','T','e','s','t','1'};
uint8_t adv_bag2[] = {0x02,0x01,0x06,0x10,0x09,'M','i','n','e','w','-','B','L','E','-','T','e','s','t','2'};
uint8_t adv_bag3[] = {0x02,0x01,0x06,0x10,0x09,'M','i','n','e','w','-','B','L','E','-','T','e','s','t','3'};
uint8_t adv_bag4[] = {0x02,0x01,0x06,0x10,0x09,'M','i','n','e','w','-','B','L','E','-','T','e','s','t','4'};
uint8_t adv_bag5[] = {0x02,0x01,0x06,0x10,0x09,'M','i','n','e','w','-','B','L','E','-','T','e','s','t','5'};
uint8_t adv_bag6[] = {0x02,0x01,0x06,0x10,0x09,'M','i','n','e','w','-','B','L','E','-','T','e','s','t','6'};
uint8_t * adv_bag[] = {adv_bag1,adv_bag2,adv_bag3,adv_bag4,adv_bag5,adv_bag6};
uint16_t adv_interval[] = {500,900,1000,2000,2000,300};
uint16_t adv_timeout[] = {30000,30000,20000,60000,60000,40000};
void adv_test(void){
uint8_t status;
status = aci_hal_set_tx_power_level(0, 24);
if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_hal_set_tx_power_level() failed:0x%02x\r\n", status);
}
for(uint8_t i=0;i<6;i++){
/* adv paraments setting */
status = aci_gap_set_advertising_configuration(
i,
GAP_MODE_GENERAL_DISCOVERABLE,
ADV_PROP_CONNECTABLE | ADV_PROP_SCANNABLE | ADV_PROP_LEGACY,
MSEC_TO_UNITS(adv_interval[i], UNIT_0_625_MS),
MSEC_TO_UNITS(adv_interval[i], UNIT_0_625_MS),
ADV_CH_ALL,
0,
NULL,
ADV_NO_WHITE_LIST_USE,
0, /* 0 dBm */
LE_1M_PHY, /* Primary advertising PHY */
0, /* 0 skips */
LE_1M_PHY, /* Secondary advertising PHY. Not used with legacy advertising. */
0, /* SID */
0 /* No scan request notifications */);
if (status != BLE_STATUS_SUCCESS) {
PRINTF("Error in aci_gap_set_advertising_configuration 0x%02x\r\n", status);
} else {
PRINTF("aci_gap_set_advertising_configuration() --> SUCCESS\r\n");
}
status = aci_gap_set_advertising_data(i, ADV_COMPLETE_DATA, sizeof(adv_bag1), adv_bag[i]);
if (status != BLE_STATUS_SUCCESS) {
PRINTF("Error in aci_gap_set_advertising_data 0x%02x\r\n", status);
}
adv_paraments[i].Advertising_Handle = i;
adv_paraments[i].Duration = 0;
adv_paraments[i].Max_Extended_Advertising_Events = 0;
}
status = aci_gap_set_advertising_enable(ENABLE, 6, adv_paraments);
if (status != BLE_STATUS_SUCCESS) {
PRINTF("aci_gap_set_advertising_enable(NO_WHITE_LIST_USE) failed:0x%02x\r\n", status);
}
}