static wiced_result_t scan_handler(wiced_scan_handler_result_t* malloced_scan_result) { ScanAPCommand& cmd = *(ScanAPCommand*)malloced_scan_result->user_data; malloc_transfer_to_curr_thread( malloced_scan_result ); ScanEntry& entry = cmd.write_; memset(&entry, 0, sizeof(entry)); if (malloced_scan_result->status == WICED_SCAN_INCOMPLETE) { wiced_scan_result_t& ap_details = malloced_scan_result->ap_details; unsigned ssid_len = ap_details.SSID.length > 32 ? 32 : ap_details.SSID.length; memcpy(entry.ssid, ap_details.SSID.value, ssid_len); entry.ssid[ssid_len] = 0; entry.rssi = ap_details.signal_strength; entry.security = ap_details.security; entry.channel = ap_details.channel; entry.max_data_rate = ap_details.max_data_rate; } else { entry.done = 1; } wiced_rtos_push_to_queue(&cmd.queue_, &entry, WICED_WAIT_FOREVER); free(malloced_scan_result); return WICED_SUCCESS; }
wiced_result_t wiced_rtos_send_asynchronous_event( wiced_worker_thread_t* worker_thread, event_handler_t function, void* arg ) { wiced_event_message_t message; message.function = function; message.arg = arg; return wiced_rtos_push_to_queue( &worker_thread->event_queue, &message, WICED_NO_WAIT ); }
static void timed_event_handler( void* arg ) { wiced_timed_event_t* event_object = (wiced_timed_event_t*) arg; wiced_event_message_t message; message.function = event_object->function; message.arg = event_object->arg; wiced_rtos_push_to_queue( &event_object->thread->event_queue, &message, WICED_NO_WAIT ); }