enable getRanged in websocketsource. causes segfault in the websocket sink end currently
authorKevron Rees <kevron_m_rees@linux.intel.com>
Fri, 17 May 2013 21:28:50 +0000 (14:28 -0700)
committerKevron Rees <kevron_m_rees@linux.intel.com>
Fri, 17 May 2013 21:28:50 +0000 (14:28 -0700)
plugins/websocketsink/protocol
plugins/websocketsourceplugin/websocketsource.cpp

index 5b836a8..ea37448 100644 (file)
@@ -21,4 +21,5 @@ Subscribe to data:
 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"}
index 0574314..8addf05 100644 (file)
@@ -126,7 +126,7 @@ void WebSocketSource::setConfiguration(map<string, string> config)
        
 
 }
-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);
@@ -139,14 +139,15 @@ bool gioPollingFunc(GIOChannel *source,GIOCondition condition,gpointer data)
        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;
 
@@ -522,7 +523,7 @@ PropertyList WebSocketSource::supported()
 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()
@@ -586,6 +587,7 @@ void WebSocketSource::getRangePropertyAsync(AsyncRangePropertyReply *reply)
        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 << "\",";