bool supportsGet = supportedOps & AbstractSource::Get;
- if(ListPlusPlus<VehicleProperty::Property>(&properties).contains(request.property) && supportsGet)
+ if(ListPlusPlus<VehicleProperty::Property>(&properties).contains(request.property) && supportsGet && (request.sourceUuid == "" || request.sourceUuid == src->uuid()))
{
src->getPropertyAsync(reply);
{
AbstractSource* src = (*itr);
PropertyList properties = src->supported();
- if(ListPlusPlus<VehicleProperty::Property>(&properties).contains(request.property) && src->supportedOperations() & AbstractSource::GetRanged)
+ if(ListPlusPlus<VehicleProperty::Property>(&properties).contains(request.property)
+ && (src->supportedOperations() & AbstractSource::GetRanged)
+ && (request.sourceUuid == "" || request.sourceUuid == src->uuid()))
{
src->getRangePropertyAsync(reply);
}
#ifndef ABSTRACTROUTINGENGINE_H
#define ABSTRACTROUTINGENGINE_H
-#include "sys/types.h"
+#include <sys/types.h>
#include <stdlib.h>
-
#include <boost/any.hpp>
#include <functional>
+#include <string>
#include <time.h>
+
#include "vehicleproperty.h"
#include "abstractpropertytype.h"
{
this->property = request.property;
this->completed = request.completed;
+ this->sourceUuid = request.sourceUuid;
}
AsyncPropertyRequest & operator = (const AsyncPropertyRequest & other)
{
this->property = other.property;
this->completed = other.completed;
+ this->sourceUuid = other.sourceUuid;
return *this;
}
VehicleProperty::Property property;
+ std::string sourceUuid;
GetPropertyCompletedSignal completed;
};
this->timeEnd = request.timeEnd;
this->sequenceBegin = request.sequenceBegin;
this->sequenceEnd = request.sequenceEnd;
+ this->sourceUuid = request.sourceUuid;
}
VehicleProperty::Property property;
+ std::string sourceUuid;
GetRangedPropertyCompletedSignal completed;
double timeBegin;
double timeEnd;
unordered_map<string, AbstractDBusInterface*> AbstractDBusInterface::interfaceMap;
list<string> AbstractDBusInterface::mimplementedProperties;
+
+static void handleMethodCall(GDBusConnection *connection,
+ const gchar *sender,
+ const gchar *object_path,
+ const gchar *interface_name,
+ const gchar *method_name,
+ GVariant *parameters,
+ GDBusMethodInvocation *invocation,
+ gpointer user_data)
+{
+
+ std::string method = method_name;
+
+
+
+}
+
AbstractDBusInterface::AbstractDBusInterface(string interfaceName, string op,
GDBusConnection* connection)
: mInterfaceName(interfaceName), mObjectPath(op), mConnection(connection)
///see which properties are supported:
introspectionXml += "<property type='"+ property->signature() + "' name='"+ property->name()+"' access='"+access+"' />"
- "<signal name='" + property->name() + "Changed' >"
- " <arg type='v' name='" + nameToLower + "' direction='out' />"
- " <arg type='d' name='timestamp' direction='out' />"
- "</signal>";
+ "<method name='get" + property->name() + "Extended'>"
+ " <arg type='v' direction='out' name='value' />"
+ " <arg type='d' direction='out' name='timestamp' />"
+ " <arg type='d' direction='out' name='sequence' />"
+ "</method>"
+ "<signal name='" + property->name() + "Changed' >"
+ " <arg type='v' name='" + nameToLower + "' direction='out' />"
+ " <arg type='d' name='timestamp' direction='out' />"
+ "</signal>";
properties[property->name()] = property;
GDBusInterfaceInfo* mInterfaceInfo = g_dbus_node_info_lookup_interface(introspection, mInterfaceName.c_str());
- auto fakeMethodCb = [](GDBusConnection *connection,
- const gchar *sender,
- const gchar *object_path,
- const gchar *interface_name,
- const gchar *method_name,
- GVariant *parameters,
- GDBusMethodInvocation *invocation,
- gpointer user_data) { };
- const GDBusInterfaceVTable vtable = { fakeMethodCb, AbstractDBusInterface::getProperty, AbstractDBusInterface::setProperty };
+ const GDBusInterfaceVTable vtable = { handleMethodCall, AbstractDBusInterface::getProperty, AbstractDBusInterface::setProperty };
- regId = g_dbus_connection_register_object(mConnection, mObjectPath.c_str(), mInterfaceInfo, &vtable, NULL, NULL, &error);
+ regId = g_dbus_connection_register_object(mConnection, mObjectPath.c_str(), mInterfaceInfo, &vtable, this, NULL, &error);
if(error) throw -1;
src->uuidRangedReplyMap.erase((*i).first);
src->uuidTimeoutMap.erase((*i).first);
i--;
-<<<<<<< HEAD
-=======
+
if (src->uuidTimeoutMap.size() == 0)
{
return 0;
}
->>>>>>> 46f67f8d33d8eccc26d9326ce1c6b9745dc6bb97
+
}
else
{
//Reply has already come back, ignore and erase from list.
src->uuidTimeoutMap.erase((*i).first);
i--;
-<<<<<<< HEAD
- }
- }
-=======
if (src->uuidTimeoutMap.size() == 0)
{
return 0;
}
return 0;
->>>>>>> 46f67f8d33d8eccc26d9326ce1c6b9745dc6bb97
}
static int callback_http_only(libwebsocket_context *context,struct libwebsocket *wsi,enum libwebsocket_callback_reasons reason,void *user, void *in, size_t len)
source->uuidReplyMap[id]->success = true;
source->uuidReplyMap[id]->completed(source->uuidReplyMap[id]);
source->uuidReplyMap.erase(id);
-<<<<<<< HEAD
- delete v;
-=======
->>>>>>> 46f67f8d33d8eccc26d9326ce1c6b9745dc6bb97
+
}
else
{
DebugOut() << "get methodReply has been recieved, without a request being in!. This is likely due to a request coming in after the timeout has elapsed.\n";
}
-<<<<<<< HEAD
-=======
- delete v;
->>>>>>> 46f67f8d33d8eccc26d9326ce1c6b9745dc6bb97
}
else
{
}
void WebSocketSource::setSupported(PropertyList list)
{
- DebugOut() << "SET SUPPORTED";
+ DebugOut() <<__SMALLFILE__ << ":" << __LINE__ <<"SET SUPPORTED"<<endl;
m_supportedProperties = list;
m_re->updateSupported(list,PropertyList());
}