Hello, Second time in here, thank you so much for all the support so far!
I'm developing a Beacon BLE, I wanna be able to send data over Advertising or Scan response.
So I've developed the function bellow and I'm calling it in a timer timeout handler.
void updateAdvertising() {
/* Declaration of Error Code */
ret_code_t err_code;
ble_advdata_t advdata;
uint8_t testData[8] = {0x11, 0x22, 0x33, 0x44, 0x55, 0x66, 0x11, 0x22};
uint8_array_t data_array; // Array for Service Data structure.
data_array.p_data = (uint8_t *)testData; // Pointer to the data to advertise.
data_array.size = sizeof(testData); // Size of the data to advertise.
ble_advdata_service_data_t service_data; // Structure to hold Service Data.
service_data.service_uuid = CUSTOM_SERVICE_UUID;
service_data.data = data_array; // Array for service advertisement data.
memset(&advdata, 0, sizeof(advdata));
advdata.name_type = BLE_ADVDATA_NO_NAME;
advdata.include_appearance = false;
advdata.flags = BLE_GAP_ADV_FLAGS_LE_ONLY_GENERAL_DISC_MODE;
advdata.uuids_complete.uuid_cnt = sizeof(m_adv_uuids) / sizeof(m_adv_uuids[0]);
advdata.uuids_complete.p_uuids = &m_adv_uuids[0];
advdata.p_service_data_array = &service_data; // Pointer to Service Data structure.
advdata.service_data_count = 1;
//sd_ble_gap_adv_stop(m_adv_handle);
err_code = ble_advertising_advdata_update(&m_advertising, &advdata, NULL);
APP_ERROR_CHECK(err_code);
}
Problem is:
<error> app: ERROR 8 [NRF_ERROR_INVALID_STATE] at ../../../Advertising.c:143
PC at: 0x0002BC2F
it returns me that, I tried to pause the Advertisement and same result, I didn't try to pause the scan, but I believe it wont do much of a difference.