Subscribe to data reply:
{"type":"methodReply","name":"subscribe","data":["EngineSpeed"],"transactionid":"d293f670-f0b3-11e1-aff1-0800200c9a66"}
-
+Get History request:
+{"type":"method","name":"getRange","data": {"timeBegin":"1368825008.35948","timeEnd":"1368825018.35948","sequenceBegin":"-1","sequenceEnd":"-1"},"transactionid":"b07589ba-417c-4604-80c6-01c0dcbd524d"}
}
-bool gioPollingFunc(GIOChannel *source,GIOCondition condition,gpointer data)
+bool gioPollingFunc(GIOChannel *source, GIOCondition condition, gpointer data)
{
//This is the polling function. If it return false, glib will stop polling this FD.
//printf("Polling...%i\n",condition);
pollstruct.events = condition;
pollstruct.revents = condition;
libwebsocket_service_fd(context,&pollstruct);
- if (condition == G_IO_HUP)
+ if (condition & G_IO_HUP)
{
//Hang up. Returning false closes out the GIOChannel.
//printf("Callback on G_IO_HUP\n");
return false;
}
- if (condition == G_IO_IN)
+ if (condition & G_IO_IN)
{
+
}
DebugOut() << "gioPollingFunc" << condition;
int WebSocketSource::supportedOperations()
{
/// TODO: need to do this correctly based on what the host supports.
- return Get | Set;
+ return Get | Set | GetRanged;
}
string WebSocketSource::uuid()
uuidRangedReplyMap[uuid] = reply;
uuidTimeoutMap[uuid] = amb::currentTime() + 60; ///TODO: 60 second timeout, make this configurable?
stringstream s;
+ s.precision(15);
s << "{\"type\":\"method\",\"name\":\"getRange\",\"data\": {";
s << "\"timeBegin\":\"" << reply->timeBegin << "\",";
s << "\"timeEnd\":\"" << reply->timeEnd << "\",";