diff options
author | Michael Carpenter <malcom2073@gmail.com> | 2012-08-28 20:13:20 -0400 |
---|---|---|
committer | Michael Carpenter <malcom2073@gmail.com> | 2012-08-28 20:13:20 -0400 |
commit | 1aad5d5f13460968fb232139fd75e7a4b18e4719 (patch) | |
tree | 5aa570521b4d5350117e304f3612a57c714c9b4f | |
parent | 19f4890c4ae8cb123337442ffbf0079dabe9759f (diff) | |
download | automotive-message-broker-1aad5d5f13460968fb232139fd75e7a4b18e4719.tar.gz |
Fixes for new AbstractPropertyType
-rw-r--r-- | plugins/websocketsink/websocketsink.cpp | 6 | ||||
-rw-r--r-- | plugins/websocketsink/websocketsinkmanager.cpp | 6 | ||||
-rw-r--r-- | plugins/websocketsourceplugin/websocketsource.cpp | 7 |
3 files changed, 12 insertions, 7 deletions
diff --git a/plugins/websocketsink/websocketsink.cpp b/plugins/websocketsink/websocketsink.cpp index 495d2d1e..8e0ce419 100644 --- a/plugins/websocketsink/websocketsink.cpp +++ b/plugins/websocketsink/websocketsink.cpp @@ -48,7 +48,9 @@ string WebSocketSink::uuid() void WebSocketSink::propertyChanged(VehicleProperty::Property property, AbstractPropertyType value, string uuid) { //printf("Got property:%i\n",boost::any_cast<uint16_t>(reply->value)); - uint16_t velocity = boost::any_cast<uint16_t>(value); + //uint16_t velocity = boost::any_cast<uint16_t>(value); + //m_re->updateProperty(name,VehicleProperty::getPropertyTypeForPropertyNameValue(name,data.front())); + stringstream s; //TODO: Dirty hack hardcoded stuff, jsut to make it work. @@ -63,7 +65,7 @@ void WebSocketSink::propertyChanged(VehicleProperty::Property property, Abstract } - s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":\"" << velocity << "\",\"transactionid\":\"" << m_uuid << "\"}"; + s << "{\"type\":\"valuechanged\",\"name\":\"" << tmpstr << "\",\"data\":\"" << value.toString() << "\",\"transactionid\":\"" << m_uuid << "\"}"; string replystr = s.str(); printf("Reply: %s\n",replystr.c_str()); diff --git a/plugins/websocketsink/websocketsinkmanager.cpp b/plugins/websocketsink/websocketsinkmanager.cpp index 426936e0..e69e5b91 100644 --- a/plugins/websocketsink/websocketsinkmanager.cpp +++ b/plugins/websocketsink/websocketsinkmanager.cpp @@ -86,8 +86,8 @@ void WebSocketSinkManager::addSingleShotSink(libwebsocket* socket, VehicleProper } velocityRequest.completed = [socket,id,property](AsyncPropertyReply* reply) { - printf("Got property:%i\n",boost::any_cast<uint16_t>(reply->value)); - uint16_t velocity = boost::any_cast<uint16_t>(reply->value); + printf("Got property:%s\n",reply->value.toString().c_str()); + //uint16_t velocity = boost::any_cast<uint16_t>(reply->value); stringstream s; //TODO: Dirty hack hardcoded stuff, jsut to make it work. @@ -121,7 +121,7 @@ void WebSocketSinkManager::addSingleShotSink(libwebsocket* socket, VehicleProper //} }*/ tmpstr = property; - s << "{\"type\":\"methodReply\",\"name\":\"get\",\"data\":[{\"name\":\"" << tmpstr << "\",\"value\":\"" << velocity << "\"}],\"transactionid\":\"" << id << "\"}"; + s << "{\"type\":\"methodReply\",\"name\":\"get\",\"data\":[{\"name\":\"" << tmpstr << "\",\"value\":\"" << reply->value.toString() << "\"}],\"transactionid\":\"" << id << "\"}"; string replystr = s.str(); printf("Reply: %s\n",replystr.c_str()); diff --git a/plugins/websocketsourceplugin/websocketsource.cpp b/plugins/websocketsourceplugin/websocketsource.cpp index 50f1869c..827bc2df 100644 --- a/plugins/websocketsourceplugin/websocketsource.cpp +++ b/plugins/websocketsourceplugin/websocketsource.cpp @@ -206,6 +206,7 @@ static int callback_http_only(libwebsocket_context *context,struct libwebsocket if (type == "valuechanged") { + printf("Value changed: %s, %s\n",name.c_str(),data.front().c_str()); //Name should be a valid property // routingEngine->updateProperty(VehicleProperty::VehicleSpeed, velocity); //data.front() @@ -217,17 +218,19 @@ static int callback_http_only(libwebsocket_context *context,struct libwebsocket { printf("Exception %s\n",ex.what()); } - if (name == "get") + printf("Done\n"); + /*if (name == "get") { if (data.size() > 0) { } - } + }*/ } else if (type == "methodReply") { if (name == "getSupportedEventTypes") { + printf("Got supported events!\n"); PropertyList props; while (data.size() > 0) { |