Hello,
I want to change the channel mask of the advertising channels like this
m_advertising.adv_params.channel_mask[4] = 0xC0; // only Channel 37
and sniff it.
I can compile and flash the code but on sniffer the advertiser still send on the three advertising channels. Is there another place where I have to change the mask?
Software: nRF5_SDK_15.0.0 with + S140
Hardware: nRF52840-DK
Code of the advertising init.
static void advertising_init(void) { ret_code_t err_code; ble_advertising_init_t init; memset(&init, 0, sizeof(init)); ble_advdata_manuf_data_t manuf_data; //Variable to hold manufacturer specific data memset(&manuf_data, 0, sizeof(manuf_data)); uint8_t data[] = "Test"; //Our data to advertise manuf_data.company_identifier = 0x0059; //Nordics company ID manuf_data.data.p_data = data; manuf_data.data.size = sizeof(data); init.advdata.p_manuf_specific_data = &manuf_data; init.advdata.name_type = BLE_ADVDATA_SHORT_NAME; init.advdata.short_name_len = 6; init.advdata.include_appearance = true; init.advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE; init.advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]); init.advdata.uuids_complete.p_uuids = m_adv_uuids; init.config.ble_adv_fast_enabled = true; init.config.ble_adv_fast_interval = APP_ADV_INTERVAL; init.config.ble_adv_fast_timeout = APP_ADV_DURATION; init.evt_handler = on_adv_evt; m_advertising.adv_params.channel_mask[4] = 0xC0; //Channel 37 NRF_LOG_INFO("duration: %d", m_advertising.adv_params.duration); err_code = ble_advertising_init(&m_advertising, &init); if(err_code != 0) NRF_LOG_INFO("Errorcode advertising_init: %d", err_code); APP_ERROR_CHECK(err_code); ble_advertising_conn_cfg_tag_set(&m_advertising, APP_BLE_CONN_CFG_TAG); }
The m_advertising is an BLE_ADVERTISING_DEF(m_advertising); instance.
Thanks