I am starting with this tutorial. I want to program the nrf52840 with a sensor. After I retrieve the data, I hope that I can place the data into the data field.
But how do I update the data field? Should I just change the value of the manuf_data in the for loop in the main function?
Hence, and I would like to ask how do I change the advertisement packet from connectable to non-connectable?
Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
static void advertising_init(void)
{
ret_code_t err_code;
ble_advertising_init_t init; // Struct containing advertising parameters
// Build advertising data struct to pass into @ref ble_advertising_init.
memset(&init, 0, sizeof(init));
ble_advdata_manuf_data_t manuf_data; //Variable to hold manufacturer specific data
uint8_t data[] = "SomeData!"; //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_FULL_NAME; // Use a shortened name
init.advdata.short_name_len = 6; // Advertise only first 6 letters of name
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;