20 #ifndef ABSTRACTROUTINGENGINE_H
21 #define ABSTRACTROUTINGENGINE_H
23 #include <sys/types.h>
25 #include <boost/any.hpp>
30 #include "vehicleproperty.h"
31 #include "abstractpropertytype.h"
32 #include "propertyinfo.hpp"
41 typedef std::function<void (AsyncPropertyReply*)> GetPropertyCompletedSignal;
42 typedef std::function<void (AsyncRangePropertyReply*)> GetRangedPropertyCompletedSignal;
43 typedef std::function<void (AsyncPropertyReply*)> TimedOutCallback;
152 else if(err == Timeout)
154 else if(err == InvalidOperation)
155 return "InvalidOperation";
156 else if(err == PermissionDenied)
157 return "PermissionDenied";
158 else if(err == ZoneNotSupported)
159 return "ZoneNotSupported";
172 else if(err ==
"Timeout")
174 else if(err ==
"InvalidOperation")
175 return InvalidOperation;
176 else if(err ==
"PermissionDenied")
177 return PermissionDenied;
178 else if(err ==
"ZoneNotSupported")
179 return ZoneNotSupported;
210 GSource* timeoutSource;
342 for(
auto itr =
values.begin(); itr !=
values.end(); itr++)
369 typedef std::function<void (AbstractPropertyType* value)> PropertyChangedType;
375 virtual void updateSupported(PropertyList added, PropertyList removed,
AbstractSource* source) = 0;
381 DebugOut(
DebugOut::Warning)<<
"updateProperty(VehicleProperty::Property,AbstractPropertyType*,std::string) is deprecated. use new updateProperty(AbstractPropertyType*, const std::string &)"<<endl;
386 virtual PropertyList supported() = 0;
397 virtual std::vector<std::string>
sourcesForProperty(
const VehicleProperty::Property & property) = 0;
465 virtual uint
subscribeToProperty(
const VehicleProperty::Property & propertyName, PropertyChangedType callback, std::string pid=
"") = 0;
508 virtual bool subscribeToProperty(
const VehicleProperty::Property & propertyName,
const std::string & sourceUuidFilter, Zone::Type zoneFilter,
AbstractSink *
self) = 0;
512 virtual PropertyInfo getPropertyInfo(
const VehicleProperty::Property &,
const std::string & sourceUuid) = 0;
515 std::map<std::string, std::string> mConfig;
518 #endif // ABSTRACTROUTINGENGINE_H
static const Property NoValue
Various property types:
Definition: vehicleproperty.h:431
double timeEnd
timeEnd Set this to request values for the specified property beggining at this time. Time is seconds\ since the unix epoc. Set this to '0' if you do not want values within a time range.
Definition: abstractroutingengine.h:306
Definition: abstractpropertytype.h:70
GetPropertyCompletedSignal completed
completed the callback when the request has been completed.
Definition: abstractroutingengine.h:99
Definition: abstractroutingengine.h:366
TimedOutCallback timedout
timed out callback is called when the reply times out. This is so sources can avoid using this reply ...
Definition: abstractroutingengine.h:200
std::string pid
pid requesting process id
Definition: abstractroutingengine.h:111
The AsyncRangePropertyRequest class is used by sinks to request values within a time or sequence rang...
Definition: abstractroutingengine.h:249
bool success
success indicates if the request was successfull or not. True means success. False means fail and the...
Definition: abstractroutingengine.h:194
bool success
success this will be true if the request was successful. If not, this is false and error is set...
Definition: abstractroutingengine.h:363
double timeBegin
timeBegin Set this to request values for the specified property beggining at this time...
Definition: abstractroutingengine.h:299
Zone::Type zoneFilter
zoneFilter the requesting sink should use this if he wants to filter on a specific zone ...
Definition: abstractroutingengine.h:94
int32_t sequenceEnd
sequenceEnd set this to request values with a sequence <= to the sequenceEnd value. Set to -1 if you don't want values within a sequence ranges.
Definition: abstractroutingengine.h:318
Error
The Error enum.
Definition: abstractroutingengine.h:137
std::list< AbstractPropertyType * > values
values if the request was successful, this will contain a list of values meeting the criteria of the ...
Definition: abstractroutingengine.h:358
static const int Warning
Warning use when non-essential functionality is bocked, or when workarounds exist.
Definition: debugout.h:69
virtual void registerSink(AbstractSink *self)=0
sinks:
static std::string errorToStr(Error err)
errorToStr returns string representing the Error
Definition: abstractroutingengine.h:148
PropertyList properties
properties list of properties to request
Definition: abstractroutingengine.h:275
The AsyncPropertyReply class is used by sources to reply to Get and Set operations. The source should set success to true if the call is successful or 'false' if the request was not successful and set 'error' to the appropriate error.
Definition: abstractroutingengine.h:123
int32_t sequenceBegin
sequenceBegin set this to request values with a sequence >= to the sequenceBegin value. Set to -1 if you don't want values within a sequence ranges.
Definition: abstractroutingengine.h:312
virtual AsyncPropertyReply * getPropertyAsync(AsyncPropertyRequest request)=0
Error error
error contains the error if the request was not successful.\
Definition: abstractroutingengine.h:206
The AsyncSetPropertyRequest class is used by sinks to set a property to the 'value'. The source will reply with a AsyncPropertyReply containing the new value or an error.
Definition: abstractroutingengine.h:219
Definition: propertyinfo.hpp:6
std::string sourceUuid
sourceUuid if the sink wishes to request a specific source, this should be set to the uuid of the sou...
Definition: abstractroutingengine.h:280
virtual void unsubscribeToProperty(uint handle)=0
unsubscribeToProperty
GetRangedPropertyCompletedSignal completed
completed callback 'completed' is called when the ranged request is complete. The reply from this req...
Definition: abstractroutingengine.h:292
The AsyncPropertyRequest class is used by sinks to request property values.
Definition: abstractroutingengine.h:50
VehicleProperty::Property property
property property to request.
Definition: abstractroutingengine.h:84
The AsyncRangePropertyReply class is used by a source to reply to an AsyncRangePropertyRequest. The source should set success to 'true' and populate the 'values' member if the request was successful. If the request is not successful, 'success' should be set to 'false' and the 'error' member should be set.
Definition: abstractroutingengine.h:331
Zone::Type zone
zone if the sink wishes to request a specific zone, this should be set to the desired zone ...
Definition: abstractroutingengine.h:285
static Error strToError(std::string err)
strToError returns Error representing the string
Definition: abstractroutingengine.h:168
std::string sourceUuidFilter
sourceUuidFilter the requesting sink should use this to filter on a specific source or leave blank to...
Definition: abstractroutingengine.h:89
Definition: abstractsink.h:40
virtual uint subscribeToProperty(const VehicleProperty::Property &propertyName, PropertyChangedType callback, std::string pid="")=0
subscribeToProperty subscribes to propertyName. Value changes will be passed to callback.
std::string pid
pid requesting process id
Definition: abstractroutingengine.h:323
void updateProperty(VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid)
Deprecated:
Definition: abstractroutingengine.h:379
AsyncPropertyReply::Error error
error this is set if there was an error in the request. "success" will also be set to false...
Definition: abstractroutingengine.h:353
AbstractPropertyType * value
value the new value to set the property to.
Definition: abstractroutingengine.h:242
uint timeout
use to specify a timeout in ms for the request. When a timeout occurs, the 'completed' callback will ...
Definition: abstractroutingengine.h:106
virtual void getRangePropertyAsync(AsyncRangePropertyRequest request)=0
getRangePropertyAsync is used for getting a range of properties that are within the specified time or...
The DebugOut class represents a class used for outputing debug information The specified debug level ...
Definition: debugout.h:57
virtual std::vector< std::string > sourcesForProperty(const VehicleProperty::Property &property)=0
AbstractPropertyType * value
value of the reply. This may be null if success = false. This is owned by the source.
Definition: abstractroutingengine.h:188
Definition: abstractsource.h:41