/**
  * Initializes the scan queue, and start a scan using the WICED wifi scan api.
  *
  */
 int process() {
     int result = wiced_rtos_init_queue(&queue_, NULL, sizeof(ScanEntry), 5);
     if (!result) {
         result = wiced_wifi_scan_networks(scan_handler, this);
         if (result)
             wiced_rtos_deinit_queue(&queue_);
     }
     return result;
 }
wiced_result_t wiced_rtos_create_worker_thread( wiced_worker_thread_t* worker_thread, uint8_t priority, uint32_t stack_size, uint32_t event_queue_size )
{
    memset( worker_thread, 0, sizeof( *worker_thread ) );

    if ( wiced_rtos_init_queue( &worker_thread->event_queue, "worker queue", sizeof(wiced_event_message_t), event_queue_size ) != WICED_SUCCESS )
    {
        return WICED_ERROR;
    }

    if ( wiced_rtos_create_thread( &worker_thread->thread, WICED_PRIORITY_TO_NATIVE_PRIORITY( priority ), "worker thread", worker_thread_main, stack_size, (void*) worker_thread ) != WICED_SUCCESS )
    {
        wiced_rtos_deinit_queue( &worker_thread->event_queue );
        return WICED_ERROR;
    }

    return WICED_SUCCESS;
}