automotive-message-broker  0.13
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Modules Pages
Public Types | Public Member Functions | Protected Attributes | List of all members
AbstractRoutingEngine Class Referenceabstract

Public Types

typedef std::function< void(AbstractPropertyType
*value)> 
PropertyChangedType
 

Public Member Functions

 AbstractRoutingEngine (std::map< std::string, std::string > configuration)
 
virtual void registerSource (AbstractSource *src)=0
 
virtual void updateSupported (PropertyList added, PropertyList removed, AbstractSource *source)=0
 
void updateProperty (VehicleProperty::Property property, AbstractPropertyType *value, std::string uuid)
 Deprecated:
 
virtual void updateProperty (AbstractPropertyType *value, const std::string &uuid)=0
 
virtual PropertyList supported ()=0
 
virtual void registerSink (AbstractSink *self)=0
 sinks:
 
virtual void unregisterSink (AbstractSink *self)=0
 
virtual std::vector< std::string > sourcesForProperty (const VehicleProperty::Property &property)=0
 
virtual AsyncPropertyReplygetPropertyAsync (AsyncPropertyRequest request)=0
 
virtual void getRangePropertyAsync (AsyncRangePropertyRequest request)=0
 getRangePropertyAsync is used for getting a range of properties that are within the specified time or sequence parameters. More...
 
virtual AsyncPropertyReplysetProperty (AsyncSetPropertyRequest request)=0
 
virtual uint subscribeToProperty (const VehicleProperty::Property &propertyName, PropertyChangedType callback, std::string pid="")=0
 subscribeToProperty subscribes to propertyName. Value changes will be passed to callback. More...
 
virtual void unsubscribeToProperty (uint handle)=0
 unsubscribeToProperty More...
 
virtual bool subscribeToProperty (const VehicleProperty::Property &propertyName, AbstractSink *self)=0
 subscribeToProperty subscribe to changes made to a property value. More...
 
virtual bool subscribeToProperty (const VehicleProperty::Property &propertyName, const std::string &sourceUuidFilter, AbstractSink *self)=0
 subscribeToProperty subscribe to changes made to a property value. More...
 
virtual bool subscribeToProperty (const VehicleProperty::Property &propertyName, const std::string &sourceUuidFilter, Zone::Type zoneFilter, AbstractSink *self)=0
 subscribeToProperty subscribe to changes made to a property value. More...
 
virtual bool unsubscribeToProperty (const VehicleProperty::Property &, AbstractSink *self)=0
 
virtual PropertyInfo getPropertyInfo (const VehicleProperty::Property &, const std::string &sourceUuid)=0
 

Protected Attributes

std::map< std::string,
std::string > 
mConfig
 

Member Function Documentation

virtual AsyncPropertyReply* AbstractRoutingEngine::getPropertyAsync ( AsyncPropertyRequest  request)
pure virtual

/brief getPropertyAsync requests a property value from a source. This call has a timeout and the callback specified in the request will always be called. /see AsyncPropertyRequest /see AsyncPropertyReply. /param request requested property. /return AsyncPropertyReply. The returned AsyncPropertyReply is owned by the caller of getPropertyAsync. /code AsyncPropertyRequest request; request.property = VehicleProperty::VehicleSpeed request.completed = [](AsyncPropertyReply* reply) { //you own the reply delete reply; }; routingEngine->getPropertyAsync(request); /endcode

virtual void AbstractRoutingEngine::getRangePropertyAsync ( AsyncRangePropertyRequest  request)
pure virtual

getRangePropertyAsync is used for getting a range of properties that are within the specified time or sequence parameters.

  • request the request containing the property and other information required by the query
    Returns
    a pointer to the reply.
    AsyncRangePropertyRequest vehicleSpeedFromLastWeek;
    vehicleSpeedFromLastWeek.timeBegin = amb::currentTime() - 10;
    vehicleSpeedFromLastWeek.timeEnd = amb::currentTime();
    PropertyList requestList;
    requestList.push_back(VehicleProperty::VehicleSpeed);
    requestList.push_back(VehicleProperty::EngineSpeed);
    vehicleSpeedFromLastWeek.properties = requestList;
    vehicleSpeedFromLastWeek.completed = [](AsyncRangePropertyReply* reply)
    {
    std::list<AbstractPropertyType*> values = reply->values;
    for(auto itr = values.begin(); itr != values.end(); itr++)
    {
    auto val = *itr;
    DebugOut(1)<<"Value from past: ("<<val->name<<"): "<<val->toString()<<" time: "<<val->timestamp<<endl;
    }
    delete reply;
    };
    routingEngine->getRangePropertyAsync(vehicleSpeedFromLastWeek);
virtual std::vector<std::string> AbstractRoutingEngine::sourcesForProperty ( const VehicleProperty::Property &  property)
pure virtual

/brief sourcesForProperty /param property /return vector of source uuid's that support the "property"

virtual uint AbstractRoutingEngine::subscribeToProperty ( const VehicleProperty::Property &  propertyName,
PropertyChangedType  callback,
std::string  pid = "" 
)
pure virtual

subscribeToProperty subscribes to propertyName. Value changes will be passed to callback.

  • propertyName
  • callback
  • pid process id of the requesting application
    Returns
    subscription handle
virtual bool AbstractRoutingEngine::subscribeToProperty ( const VehicleProperty::Property &  propertyName,
AbstractSink self 
)
pure virtual

subscribeToProperty subscribe to changes made to a property value.

  • propertyName name of the property to request a subscription for.
  • self pointer to the sink who is subscribing.
    //somewhere in the sink:
    routingEngine->subscribeToProperty(VehicleProperty::EngineSpeed, this);
    //... elsewhere in the sink, this will be called when a property changes:
    void MySink::propertyChanged(const AbstractPropertyType* property)
    {
    {
    ...
    }
    }
virtual bool AbstractRoutingEngine::subscribeToProperty ( const VehicleProperty::Property &  propertyName,
const std::string &  sourceUuidFilter,
AbstractSink self 
)
pure virtual

subscribeToProperty subscribe to changes made to a property value.

  • propertyName name of the property to request a subscription for.
  • sourceUuidFilter source UUID to filter. Only property updates from this source will be sent to the sink.
  • self pointer to the sink who is subscribing.
virtual bool AbstractRoutingEngine::subscribeToProperty ( const VehicleProperty::Property &  propertyName,
const std::string &  sourceUuidFilter,
Zone::Type  zoneFilter,
AbstractSink self 
)
pure virtual

subscribeToProperty subscribe to changes made to a property value.

  • propertyName name of the property to request a subscription for.
  • sourceUuidFilter source UUID to filter. Only property updates from this source will be sent to the sink.
  • zoneFilter zone to filter. Only updates from this zone will be passed to the sink.
  • self pointer to the sink who is subscribing.
virtual void AbstractRoutingEngine::unsubscribeToProperty ( uint  handle)
pure virtual

unsubscribeToProperty

  • handle

The documentation for this class was generated from the following files: