Definition of the PeerHood interface.
Inheritance:
Public Methods
-
virtual ~MPeerHood()
- Default destructor.
-
static MPeerHood* GetInstance(CBasicCallback* aCallback = NULL)
- Method used to create a new instance of the PeerHood interface.
-
virtual bool Init(int aArgc, char** aArgv) = 0
- Initializes the PeerHood instance.
-
virtual TDeviceList* GetDeviceListL() = 0
- Gets a list of all nearby devices and their services.
-
virtual TDeviceList* GetDeviceListL(const std::string* aServiceName) = 0
- Returns a list of devices that offer the asked service.
-
virtual TServiceList* GetLocalServiceListL() = 0
- Returns all locally registered services.
-
virtual MAbstractConnection* Connect(TServiceIterator& aService) = 0
- Creates a connection to a local service.
-
virtual MAbstractConnection* Connect(CService& aService) = 0
- Creates a connection to a local service.
-
virtual MAbstractConnection* Connect(TDeviceIterator& aDevice, const std::string aServiceName) = 0
- Creates a connection to a service on another PeerHood capable device.
-
virtual MAbstractConnection* Connect(MAbstractDevice& aDevice, const std::string& aServiceName) = 0
- Creates a connection to a service on another PeerHood capable device.
-
virtual unsigned short RegisterService(const std::string& aName, const std::string& aAttributes, const std::string& aPort) = 0
- Registers a service so that other PeerHood devices can find it.
-
virtual unsigned short RegisterService(const std::string& aName, const std::string& aAttributes) = 0
- Registers a service so that other PeerHood devices can find it.
-
virtual bool UnregisterService(const std::string& aName) = 0
- Unregisters a previously registered service.
-
virtual bool UnregisterService(const std::string& aName, const std::string& aPort) = 0
- Unregisters a previously registered service.
-
virtual bool MonitorDevice(TDeviceIterator& aDevice) = 0
- Sets a device under constant monitoring.
-
virtual bool UnmonitorDevice(TDeviceIterator& aDevice) = 0
- Stops the monitoring of a device.
-
virtual bool SignalMonitorDevice(TDeviceIterator& aDevice) = 0
- Sets a device under constant monitoring using signal-level monitoring.
-
virtual bool SignalUnmonitorDevice() = 0
- Stops the signal-level monitoring of a device.
-
virtual void SetPreferedPlugin(const char* aPluginName) = 0
- Sets the plugin prefered by the current application (Not used currently).
Documentation
Definition of the PeerHood interface. This interface defines the public
API of the whole PeerHood library.
virtual ~MPeerHood()
-
Default destructor. Currently this does nothing but is here because
base classes without a destructor are <b><i>evil</i></b>.
- Returns:
- none
static MPeerHood* GetInstance(CBasicCallback* aCallback = NULL)
-
Method used to create a new instance of the PeerHood interface. The
only way to create the instance is via this method. When this method is
called for the very first time a new instance of the interface is created.
Subsequent calls will return a pointer to the existing instance.
- Parameters:
- aCallback - Pointer to the callback that will receive notifications
from the PeerHood library.
- Returns:
- pointer to a PeerHood instance
virtual bool Init(int aArgc, char** aArgv) = 0
-
Initializes the PeerHood instance. These routines include connecting
to the PeerHood daemon and setting up the debug output. In addition, all
internal variables are initialized. This method should be called only
once.
- Parameters:
- aArgc - The number of parameters.
aArgv - Array containing the parameters.
- Returns:
- true if the object was initialized succesfully
virtual TDeviceList* GetDeviceListL() = 0
-
Gets a list containing all nearby devices and their services and
resources. Note that this function reserves the memory required by the
list and it's caller's responsibility to free it. Also note that the
returned list contains <i>all</i> devices in range - inluding those
without PeerHood capability. If no devices are found then the returned
list is empty.
- Returns:
- a list of found devices or NULL if an error occurred
virtual TDeviceList* GetDeviceListL(const std::string* aServiceName) = 0
-
This function builds and returns a list that contains all devices
that offer the requested service. Note that the caller must free the
memory allocated for the returned list. If no devices are found then the
returned list will be empty.
- Parameters:
- aServiceName - The service that should be looked for.
- Returns:
- a list of devices that offer the requested service or NULL if an
error occurred
virtual TServiceList* GetLocalServiceListL() = 0
-
Returns all locally registered services on a list. The memory
allocated for the returned list is not freed automatically so the caller
must take care of it. If no services are registered then the returned list
will be empty.
- Returns:
- a list of locally registered services or NULL in the case of an
error
virtual MAbstractConnection* Connect(TServiceIterator& aService) = 0
-
Creates a connetion to a local service.
Destination address and technology prototype are taken from the parameters. If a
connection object is returned then it's caller's responsibility to delete
it in a controlled way.
- Parameters:
- aService - The service to connect to.
- Returns:
- a new connection object or NULL if an error happened
virtual MAbstractConnection* Connect(CService& aService) = 0
-
Creates a connetion to a local service.
Destination address and technology prototype are taken from the parameters. If a
connection object is returned then it's caller's responsibility to delete
it in a controlled way. For supporting C-API of PeerHood.
- Parameters:
- aService - The service to connect to. CService class objects can be used
directly.
- Returns:
- a new connection object or NULL if an error happened
virtual MAbstractConnection* Connect(TDeviceIterator& aDevice, const std::string aServiceName) = 0
-
Creates a connetion to a service on another PeerHood capable device.
Destination address and technology prototype are taken from the parameters. If a
connection object is returned then it's caller's responsibility to delete
it in a controlled way.
- Parameters:
- aDevice - The remote device.
aServiceName - Remote service's name.
- Returns:
- a new connection object or NULL if an error happened
virtual MAbstractConnection* Connect(MAbstractDevice& aDevice, const std::string& aServiceName) = 0
-
Creates a connetion to a service on another PeerHood capable device.
Destination address and technology prototype are taken from the parameters. If a
connection object is returned then it's caller's responsibility to delete
it in a controlled way.
- Parameters:
- aDevice - The remote device.
aServiceName - Remote service's name.
- Returns:
- a new connection object or NULL if an error happened
virtual unsigned short RegisterService(const std::string& aName, const std::string& aAttributes, const std::string& aPort) = 0
-
Registers a service so that other PeerHood devices can find and use
it. This method contacts the PeerHood daemon that in turns starts to
advert the service through its currently running plugins.
- Parameters:
- aName - The name of the service.
aAttributes - Service's attributes in one string.
aPort - Service's port.
- Returns:
- port number if the service could be registered, otherwise 0
virtual unsigned short RegisterService(const std::string& aName, const std::string& aAttributes) = 0
-
Registers a service so that other PeerHood devices can find and use
it. This method contacts the PeerHood daemon that in turns starts to
advert the service through its currently running plugins.
- Parameters:
- aName - The name of the service.
aAttributes - Service's attributes in one string.
- Returns:
- port number if the service could be registered, otherwise 0
virtual bool UnregisterService(const std::string& aName) = 0
-
Unregisters a previously registered service. After unregistration
other devices are unable to find and call the unregistered service. Note
that the unregistration procedure doesn't delete the service object so
this should be done by the actual server application.
- Parameters:
- aName - The name of the service to be unregistered.
- Returns:
- true if the service could be unregistered
virtual bool UnregisterService(const std::string& aName, const std::string& aPort) = 0
-
Unregisters a previously registered service. After unregistration
other devices are unable to find and call the unregistered service. Note
that the unregistration procedure doesn't delete the service object so
this should be done by the actual server application.
- Parameters:
- aName - The name of the service to be unregistered.
- Returns:
- true if the service could be unregistered
virtual bool MonitorDevice(TDeviceIterator& aDevice) = 0
-
Sets a device under constant monitoring. If a change (out of range,
back in range) takes place then the registered callback interface is
notified. An application must derive from the <code>CBasicCallback</code>
class and implement the defined methods in order to receive callback
events.
- Parameters:
- aDevice - The device that should be monitored.
- Returns:
- true if the monitoring could be started
virtual bool UnmonitorDevice(TDeviceIterator& aDevice) = 0
-
Stops the monitoring of a device. After this function is called the
given device is no longer monitored.
- Parameters:
- aDevice - The target device.
- Returns:
- true if the monitoring could be canceled succesfully
virtual bool SignalMonitorDevice(TDeviceIterator& aDevice) = 0
-
Sets a device under constant monitoring using signal-level monitoring.
If a change (out of range,
back in range) takes place then the registered callback interface is
notified (Not currently used). An application must derive from the <code>CBasicCallback</code>
class and implement the defined methods in order to receive callback
events.
- Parameters:
- aDevice - The device that should be monitored.
- Returns:
- true if the monitoring could be started
virtual bool SignalUnmonitorDevice() = 0
-
Stops the signal-level monitoring of a device. After this function is called the
given device is no longer monitored.
- Parameters:
- aDevice - The target device.
- Returns:
- true if the monitoring could be canceled succesfully
virtual void SetPreferedPlugin(const char* aPluginName) = 0
-
Sets the plugin prefered by the current application. This means that
PeerHood will try to use the given plugin whenever possible. This method
will override the value read from the configuration file. The prefered
plugin can be changed during runtime. However, it affects only the actions
performed after the call i.e. the running services are not affected.
- Parameters:
- aPluginName - The name of the prefered plugin.
- Returns:
- none
- Direct child classes:
- CPeerHoodImpl
Alphabetic index HTML hierarchy of classes or Java
This page was generated with the help of DOC++.