automotive-message-broker  0.13.1
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
List of all members
AmbPlugin< T > Class Template Reference

#include <ambplugin.h>

Inheritance diagram for AmbPlugin< T >:
AbstractSource AbstractSink

Public Member Functions

 AmbPlugin (AbstractRoutingEngine *re, const std::map< std::string, std::string > &config)
 
virtual void getPropertyAsync (AsyncPropertyReply *reply)
 getPropertyAsync is called when a sink requests the value for given property. This is only called if the source supports the Get operation.
 
virtual void getRangePropertyAsync (AsyncRangePropertyReply *reply)
 getRangePropertyAsync is called when a sink requests a series of values for a given property within a specified time or sequencial range. This will only be called if the source support the Ranged Operation.
 
virtual AsyncPropertyReplysetProperty (AsyncSetPropertyRequest request)
 setProperty is called when a sink requests to set a value for a given property. This is only called if the source supports the Set Operation.
 
virtual void subscribeToPropertyChanges (VehicleProperty::Property property)
 subscribeToPropertyChanges is called when a sink requests a subscription. Source plugins can keep track of subscriptions and may wish to sleep if there are no subscriptions.
 
virtual void unsubscribeToPropertyChanges (VehicleProperty::Property property)
 unsubscribeToPropertyChanges is called when a sink requests to unsubscribe from a given property's changes.
 
virtual PropertyList supported ()
 supported is called by the routingEngine to understand what properties this source supports
 
virtual int supportedOperations ()
 supportedOperations
 
virtual PropertyInfo getPropertyInfo (const VehicleProperty::Property &property)
 getPropertyInfo used to return specific information about a property. The source should override this otherwise a PropertyInfo::invalid() will be returned for the property.
 
virtual const string uuid ()
 
virtual void propertyChanged (AbstractPropertyType *value)
 
virtual void supportedChanged (const PropertyList &supportedProperties)
 
void init ()
 
- Public Member Functions inherited from AbstractSource
 AbstractSource (AbstractRoutingEngine *engine, map< string, string > config)
 
- Public Member Functions inherited from AbstractSink
 AbstractSink (AbstractRoutingEngine *engine, map< string, string > config)
 

Additional Inherited Members

- Public Types inherited from AbstractSource
enum  Operations { Get = 0x01, Set = 0x02, GetRanged = 0x04 }
 The Operations enum is a bitmask flag used to specify which operations are supported by the source plugin.
 
- Protected Attributes inherited from AbstractSource
AbstractRoutingEngineroutingEngine
 routingEngine the core routing engine used to send property updates to sink plugins.
 

Detailed Description

template<class T>
class AmbPlugin< T >

AmbPlugin class contains common code used in all IviPoC II plugins for Automotive message broker(AMB). For the AMB library API please visit Automotive message broker web page.

Example of the minimal code to write a new plugin using AmbPlugin:

#include "ambpluginimpl.h"
class MyPlugin: public AmbPluginImpl {
public:
MyPlugin(AbstractRoutingEngine* re, const std::map<std::string, std::string>& config, AbstractSink& parent);
~MyPlugin();
const std::string uuid() const { return "plugin_uuid"; }
};
// library exported function for plugin loader
extern "C" AbstractSource* create(AbstractRoutingEngine* routingengine, std::map<std::string, std::string> config)
{
return new AmbPlugin<MyPlugin>(routingengine, config);
}

Constructor & Destructor Documentation

template<typename T >
AmbPlugin< T >::AmbPlugin ( AbstractRoutingEngine re,
const std::map< std::string, std::string > &  config 
)

Compile time check

Parameters
reAbstractRoutingEngine
configMap of the configuration string values loaded on startup from AMB configuration file

Member Function Documentation

template<typename T >
void AmbPlugin< T >::getPropertyAsync ( AsyncPropertyReply reply)
virtual

getPropertyAsync is called when a sink requests the value for given property. This is only called if the source supports the Get operation.

Parameters
replythe reply variable.
See Also
AsyncPropertyReply

Implements AbstractSource.

template<typename T >
PropertyInfo AmbPlugin< T >::getPropertyInfo ( const VehicleProperty::Property &  property)
virtual

getPropertyInfo used to return specific information about a property. The source should override this otherwise a PropertyInfo::invalid() will be returned for the property.

Parameters
propertythe property to get info for.
Returns
a PropertyInfo object.

Implements AbstractSource.

template<typename T >
void AmbPlugin< T >::getRangePropertyAsync ( AsyncRangePropertyReply reply)
virtual

getRangePropertyAsync is called when a sink requests a series of values for a given property within a specified time or sequencial range. This will only be called if the source support the Ranged Operation.

Parameters
replyis the reply variable.
See Also
AsyncRangePropertyReply

Implements AbstractSource.

template<typename T >
void AmbPlugin< T >::init ( )

Second phase of the plugin initialization.

template<typename T >
void AmbPlugin< T >::propertyChanged ( AbstractPropertyType value)
virtual

propertyChanged is called when a subscribed to property changes.

Parameters
valuevalue of the property that changed. this is a temporary pointer that will be destroyed. Do not destroy it. If you need to store the value use value.anyValue(), value.value<T>() or value->copy() to copy.

Reimplemented from AbstractSink.

template<typename T >
AsyncPropertyReply * AmbPlugin< T >::setProperty ( AsyncSetPropertyRequest  request)
virtual

setProperty is called when a sink requests to set a value for a given property. This is only called if the source supports the Set Operation.

Parameters
requestthe requested property to set.
Returns
returns a pointer to the new value for the property.

Implements AbstractSource.

template<typename T >
void AmbPlugin< T >::subscribeToPropertyChanges ( VehicleProperty::Property  property)
virtual

subscribeToPropertyChanges is called when a sink requests a subscription. Source plugins can keep track of subscriptions and may wish to sleep if there are no subscriptions.

Parameters
propertythe property that is being subscribed.

Implements AbstractSource.

template<typename T >
PropertyList AmbPlugin< T >::supported ( )
virtual

supported is called by the routingEngine to understand what properties this source supports

Returns
returns a list of supported properties. If the the supported properties changed, the source should call AbstractRoutingEngine::setSupported.

Implements AbstractSource.

template<typename T >
void AmbPlugin< T >::supportedChanged ( const PropertyList &  supportedProperties)
virtual

supportedChanged() is called when the supported properties changes

Parameters
supportedPropertiesthe new list of supported properties.

Implements AbstractSink.

template<typename T >
int AmbPlugin< T >::supportedOperations ( )
virtual

supportedOperations

Returns
returns the supported operations.

Implements AbstractSource.

template<typename T >
void AmbPlugin< T >::unsubscribeToPropertyChanges ( VehicleProperty::Property  property)
virtual

unsubscribeToPropertyChanges is called when a sink requests to unsubscribe from a given property's changes.

Parameters
propertythe property to unsubscribe to

Implements AbstractSource.

template<typename T >
const string AmbPlugin< T >::uuid ( )
virtual

uuid() is a unique identifier

Returns
A guid-style unique identifier

Implements AbstractSink.


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