class MAbstractPlugin

Common abstract interface for all PeerHood plugins. Every plugin must implement this interface.

Inheritance:


Public Methods

[more]virtual ~MAbstractPlugin()
Default destructor.
[more]virtual bool Advert() = 0
Starts to advert the PeerHood service by using plugin's networking technology.
[more]virtual bool Unadvert() = 0
Ends the advertising of the PeerHood service.
[more]virtual bool Start() = 0
Starts the plugin's inquiry routine.
[more]virtual void Stop() = 0
Stops the plugin's inquiry routine.
[more]virtual const std::string& GetName() = 0
Returns plugin's unique id string.
[more]virtual void UpdateState() = 0
Updates the internal state of the plugin
[more]virtual void LoadListeners() = 0
Loads all listeners for plugin


Inherited from MAbstractStateConverter:

Public Methods

ovirtual void RegisterListener(MAbstractListener* aListener)
ovirtual void SetState(bool aActive)
ovirtual void TriggerShutdown()
ovirtual void SetAdapter(const std::string& aInterface, int aId)


Documentation

Common abstract interface for all PeerHood plugins. Every real plugin must implement this interface so that the PeerHood Daemon can use it without any further knowledge of plugin's special characteristics. All plugins are compiled as dynamically linkable libraries and loaded as a part of the daemon's startup procedure from the directory pointed by the PH_PLUGIN_DIR environment variable. Every plugin must meet the following requirements:<ol> <li>Plugin's name must end with the 'plugin.so' suffix.</li> <li>Every plugin must have a unique prototype id (a string).</li> <li>A static instance of the plugin must be declared at the end of its implementation.</li> <li>Plugin's constructor must register it to daemon's map: <code>pluginMap["plugin_id"] = this</code>.</li> <li>Plugin must be able to deliver a list of available services to another PeerHood device. This is done by calling the <code> CDaemon::SendServiceList(MAbstractPlugin*)</code> function</li></ol>

Every plugin implements MAbstractStateConverter interface. This allows the usage of this class by system state listeners via simple interface.

ovirtual ~MAbstractPlugin()
Default destructor. Currently this does nothing but is here because base classes without a destructor are <b><i>evil</i></b>.

Returns:
none

ovirtual bool Advert() = 0
Starts to advert the PeerHood service by using plugin's networking technology. There's no standard advertising method. Instead, every plugin should use the means that suit for the networking technology in question.

Returns:
true if the adverting could be started

ovirtual bool Unadvert() = 0
Ends the advertising of the PeerHood service. Although this function can return also <i>false</i> the plugin should take care that the PeerHood service is not advertised after this function call. In other words, the advertising routine must be ended by force if otherwise impossible. The return value is there to mainly inform the user.

Returns:
true if the operation was successfull

ovirtual bool Start() = 0
Starts the plugin's inquiry routine. After this method is called the plugin starts to monitor its environment and tries to locate nearby PeerHood-capable devices. Whenever a change in the neighborhood status is detected the plugin will update the database located in the daemon.

Returns:
boolean telling if the plugin could be started

ovirtual void Stop() = 0
Stops the plugin's inquiry routine. After this call is handled the plugin will stop monitoring the environment. This means that daemon's device & service database will be deprecated as the time passes.

Returns:
none

ovirtual const std::string& GetName() = 0
Returns plugin's unique id string. Every plugin must have a <b>unique </b> id or disasters will follow.

Returns:
plugin's unique id string

ovirtual void UpdateState() = 0
Checks the state of the device used by the plugin via listener which is made specially for that plugin.

ovirtual void LoadListeners() = 0
Calls ListenerFactory to create listeners for this plugin


Direct child classes:
CWLANPlugin
CGPRSPlugin
CBTPlugin
See Also:
CDaemon
MAbstractStateConverter

Alphabetic index HTML hierarchy of classes or Java



This page was generated with the help of DOC++.