Detailed Description
The QAbstractCommDeviceManager class manages power state of a communications device.
The QAbstractCommDeviceManager implements functionality necessary to provide device session functionality for a communications device. It also controls the power and state of a communications device.
QAbstractCommDeviceManager manages the device availability for all applications which are use the communications device. The applications must use the QCommDeviceSession class to notify the manager that they are or will be using the communications device. If a session is activated and the device is not in a correct state (e.g. turned off), the device is brought up automatically. Once all sessions are closed, the device can be brought down automatically if required to conserve power.
This class is part of the Qt Extended server and cannot be used by other Qt Extended applications.
See also QCommDeviceSession and QCommDeviceController.
Member Function Documentation
QAbstractCommDeviceManager::QAbstractCommDeviceManager ( const QByteArray & path, const QByteArray & devId, QObject * parent = 0 )
Constructs a QAbstractCommDeviceManager. The path argument contains the UNIX socket path for the manager to listen on. This should usually be in Qt Extended temp directory. The devId contains the unique device identifier, e.g. irda0 or hci0. The parent contains the QObject parent.
See also serverPath() and deviceId().
QAbstractCommDeviceManager::~QAbstractCommDeviceManager () [virtual]
Destructor.
void QAbstractCommDeviceManager::bringDown () [pure virtual protected]
Clients should reimplement this method to bring down the device. If the operation is successful, clients should emit the downStatus signal. If an error occurred, the downStatus signal should be emitted with error set to true.
See also downStatus().
void QAbstractCommDeviceManager::bringUp () [pure virtual protected]
Clients should reimplement this method to bring up the device. If the operation is successful, clients should emit the upStatus signal. If an error occurred, the upStatus signal should be emitted with error set to true.
See also upStatus().
const QByteArray & QAbstractCommDeviceManager::deviceId () const
Returns the unique device id of the device this manager is responsible for.
See also serverPath().
void QAbstractCommDeviceManager::downStatus ( bool error, const QString & msg ) [signal]
Clients should emit this signal whenever the bringDown operation is successful or has failed. If the operation succeeds, the error parameter should be set to false. Otherwise the error paramter should be set to true and the msg paramter can contain an optional error message.
See also bringDown().
bool QAbstractCommDeviceManager::isStarted () const
Returns true if the manager is started, false otherwise.
See also start() and stop().
bool QAbstractCommDeviceManager::isUp () const [pure virtual protected]
Clients should reimplement this method to return true if the device is currently available, and false otherwise.
See also bringUp() and bringDown().
const QByteArray & QAbstractCommDeviceManager::serverPath () const
Returns the UNIX server socket path of the device.
See also deviceId().
bool QAbstractCommDeviceManager::sessionsActive () const
Returns true if there are applications using this device.
bool QAbstractCommDeviceManager::shouldBringDown ( QUnixSocket * socket ) const [virtual protected]
This method is called whenever a bring down request is processed by the device manager. It can be used by clients to specialize the logic of whether a device should be brought down. E.g. there are several applications that are using the device (e.g. there are several sessions open), and bringing up the device might interfere with these sessions. The default implementation returns true if there are no active sessions, and false otherwise.
The socket parameter holds the socket of the peer who is requesting the device be brought down.
NOTE: It is safe to start a new EventLoop inside this method.
bool QAbstractCommDeviceManager::shouldStartSession ( QUnixSocket * socket ) const [virtual protected]
This method is called whenever a new session request is processed by the device manager. It can be used by clients to specialize the logic of whether a given peer has the ability to start a session utilizing the device. The socket parameter holds the socket of the peer.
The default implementation returns false if Qt Extended is in plane mode; otherwise, it returns true.
See also QPhoneProfileManager::planeMode().
bool QAbstractCommDeviceManager::start ()
Returns if able to start the manager; otherwise returns false.
See also isStarted() and stop().
void QAbstractCommDeviceManager::stop ()
Stops the manager.
See also isStarted() and start().
void QAbstractCommDeviceManager::upStatus ( bool error, const QString & msg ) [signal]
Clients should emit this signal whenever the bringUp operation is successful or has failed. If the operation succeeds, the error parameter should be set to false. Otherwise the error paramter should be set to true and the msg paramter can contain an optional error message.
See also bringUp().