Hi. My application is scanning ble beacons for 1 sec every minute, and I want to store this data in an array to be sent every 10 min. I am getting the data in BLE_GAP_EVT_ADV_REPORT in p_ble_evt->header.evt_id, then I am printing to verify what I have received, and then I am storing the data using the following
for (int i=0;i<p_gap_evt->params.adv_report.data.len;i++)
{
devices[k++]=p_gap_evt->params.adv_report.data.p_data[i];
}
Then in repeated timer handler, I am sending the devices array that should contain all the beacons 30 byte data. At this time I have 5 beacons, so I declared array of size 200. In timer handler, I am doing this.
static void repeated_timer_handler(void * p_context)
{
for (int i=0;i<sizeof(devices);i++)
{
app_uart_put(devices[i]);
}
}
My main function looks like
int main(void)
{
// Initialize.
log_init();
uart_init();
power_management_init();
ble_stack_init();
scan_init();
app_timer_init();
create_timers();
scan_start();
app_timer_start(m_repeated_timer_id, APP_TIMER_TICKS(15000), NULL);
// Enter main loop.
for (;;)
{
idle_state_handle();
}
}
But I am not getting anything on console, and if change my first snippet like this
for (int i=0;i<p_gap_evt->params.adv_report.data.len;i++)
{
devices[i]=p_gap_evt->params.adv_report.data.p_data[i];
}
devices [k++] to devices[i], then in timer handler I get data in devices array but the last data that is stored, not all the data. I want to store the data for 10 scanning instances (1 sec scan every 1 min), then the timer handler will be executed every 10 min to send the data, and the process repeats.
Kindly suggest suitable way to achieve this.
I appreciate your suggestions.
Regards,