gboolean MiracBroker::receive_cb (gint fd, GIOCondition condition) { std::string msg; try { if (connection_->Receive(msg)) { WDS_VLOG("Received RTSP message:\n%s", msg.c_str()); got_message (msg); } } catch (const MiracConnectionLostException &exception) { on_connection_failure(CONNECTION_LOST); return G_SOURCE_REMOVE; } return G_SOURCE_CONTINUE; }
// DISABLE INTERRUPT?! void get_message(uart_message * message){ cli(); message->length = 0; if(got_message() && buffer[0] == '#'){ //#COMMAND:ATTR1:ATTRN; int i; int start = 1; for(i = start; i < buffer_size; ++i){ if(buffer[i] == ':' || buffer[i] == ';'){ create_attribute(buffer, start, i, &message->data[message->length++]); start = i + 1; }else if(buffer[i-1] == ';'){ break; } } buffer_size = 0; sei(); } sei(); }