コード例 #1
0
ファイル: softap.cpp プロジェクト: elcojacobs/brewpi-firmware
 void produce_response(Writer& out, const int result) {
     out.write("{\"scans\":[");
     bool first = true;
     ScanEntry& entry = read_;
     while (!result && !wiced_rtos_pop_from_queue(&queue_, &entry, WICED_NEVER_TIMEOUT)) {
         if (entry.done)
             break;
         if (!*entry.ssid)
             continue;
         if (first)
             first = false;
         else
             write_char(out, ',');
         write_char(out, '{');
         write_json_string(out, "ssid", entry.ssid);
         write_char(out, ',');
         write_json_int(out, "rssi", entry.rssi);
         write_char(out, ',');
         write_json_int(out, "sec", entry.security);
         write_char(out, ',');
         write_json_int(out, "ch", entry.channel);
         write_char(out, ',');
         write_json_int(out, "mdr", entry.max_data_rate);
         write_char(out, '}');
     }
     out.write("]}");
     wiced_rtos_deinit_queue(&queue_);
 }
コード例 #2
0
static void worker_thread_main( uint32_t arg )
{
    wiced_worker_thread_t* worker_thread = (wiced_worker_thread_t*) arg;

    while ( 1 )
    {
        wiced_event_message_t message;

        if ( wiced_rtos_pop_from_queue( &worker_thread->event_queue, &message, WICED_WAIT_FOREVER ) == WICED_SUCCESS )
        {
            message.function( message.arg );
        }
    }
}