Beispiel #1
0
void
WifiInstance::InternalPostMessage( picojson::value v )
{
    syslog( LOG_DEBUG, "WifiInstance::InternalPostMessage entry" );
    if ( !is_js_context_initialized_ )
    {
        msg_queue_.push_back( v );
        return;
    }

    FlushPendingMessages();
    PostMessage( v.serialize().c_str() );
    syslog( LOG_DEBUG, "WifiInstance::InternalPostMessage exit" );
}
Beispiel #2
0
void
WifiInstance::InternalSetSyncReply( picojson::value v )
{
    SendSyncReply( v.serialize().c_str() );
    FlushPendingMessages();
}
void json_error_response(const std::string& error_message, picojson::value& id) {
  picojson::ext response;
  response.initByJson(std::string("{\"result\":null,\"error\":\"") + error_message + "\",\"id\":" + id.serialize() + "}");
  std::cout << "Content-type: application/json; charset=utf-8\n";
  std::cout << "Access-control-allow-origin: *\n\n";
  std::cout << response.toJson();
}