Detailed Description
The QBluetoothAudioGateway class provides an interface to a Bluetooth Audio Gateway.
The Bluetooth Audio Gateway usually has an audio device associated with it. Clients can also control speaker and microphone volume of the device, connect and disconnect remote clients and find status information of the audio gateway.
The QBluetoothAudioGateway is used to control the Headset and Handsfree profile implementations in Qtopia. Both use a control RFCOMM channel and a SCO voice data channel. This class should be used by client applications that wish to control the state of Handsfree / Headset implementations (e.g. a Bluetooth Audio settings application.)
See also QCommInterface.
Member Function Documentation
QBluetoothAudioGateway::QBluetoothAudioGateway ( const QString & service = QString(), QObject * parent = 0, QAbstractIpcInterface::Mode mode = Client )
Construct a new audio gateway object for service and attach it to parent. The object will be created in client mode if mode is Client, or server mode otherwise.
If service is empty, this class will use the first available service that supports bluetooth audio gateway. If there is more than one service that supports bluetooth audio gateway, the caller should enumerate them with QCommServiceManager::supports() and create separate QBluetoothAudioGateway objects for each.
See also QAbstractIpcInterfaceGroup::supports().
QBluetoothAudioGateway::~QBluetoothAudioGateway ()
Destroys the audio gateway.
bool QBluetoothAudioGateway::audioEnabled () const
Returns whether the voice data information is being passed to the device. This is true once an SCO connection has been established between the remote device (headset) and the audio gateway. All audio information should now be routed over the device associated with this audio gateway.
See also isConnected() and remotePeer().
void QBluetoothAudioGateway::audioStateChanged () [signal]
This signal is emitted whenever the state of the audio data stream has changed. E.g. the audio stream (SCO connection) has been disconnected or connected. Use audioEnabled() to find out the state of the audio stream.
See also audioEnabled().
void QBluetoothAudioGateway::connect ( const QBluetoothAddress & addr, int rfcomm_channel ) [virtual slot]
Attempts to establish an Audio Gateway initiated RFCOMM control connection to the headset. The addr contains the address of the remote device and rfcomm_channel contains the service channel to connect on.
The connectResult() signal will be sent once the connection succeeds or fails.
See also connectResult().
void QBluetoothAudioGateway::connectAudio () [virtual slot]
Asks the Audio Gateway to establish an SCO data connection with the currently connected peer. All audio data should now be routed to the associated audio device.
See also releaseAudio().
void QBluetoothAudioGateway::connectResult ( bool success, const QString & msg ) [signal]
This signal is sent after the connect method has been called on the Audio Gateway object. The success parameter is true if the connection succeeded, and false otherwise. If the connection failed, the msg parameter holds the error string.
See also connect().
void QBluetoothAudioGateway::disconnect () [virtual slot]
Disconnect the currently active client from the Audio Gateway. The headsetDisconnected() signal will be sent once the headset is disconnected().
See also headsetDisconnected().
void QBluetoothAudioGateway::headsetDisconnected () [signal]
This signal is sent whenever a headset has disconnected from the audio gateway.
See also disconnect().
bool QBluetoothAudioGateway::isConnected () const
Returns true if a client is connected. This is true once an RFCOMM control connection has been established between the remote device and the audio gateway.
See also audioEnabled() and remotePeer().
int QBluetoothAudioGateway::microphoneVolume () const
Returns the current microphone volume of the device. The volume can be between 0 and 15.
See also setMicrophoneVolume().
void QBluetoothAudioGateway::microphoneVolumeChanged () [signal]
This signal is sent whenever the microphone volume of the remote device has been changed.
See also microphoneVolume() and setMicrophoneVolume().
void QBluetoothAudioGateway::newConnection ( const QBluetoothAddress & addr ) [signal]
This signal is sent whenever a client has connected to the Audio Gateway. It is only sent on remote device initiated connections. The addr parameter holds the address of the connected remote device.
See also connect().
void QBluetoothAudioGateway::releaseAudio () [virtual slot]
Asks the Audio Gateway to release the SCO audio data connection. No audio should be routed through the associated audio device.
See also connectAudio().
QBluetoothAddress QBluetoothAudioGateway::remotePeer () const
Returns the address of the connected remote device. If there is no connection an invalid QBluetoothAddress is returned.
See also isConnected().
void QBluetoothAudioGateway::setMicrophoneVolume ( int volume ) [virtual slot]
Requests the Audio Gateway to notify the remote device to update its microphone volume to volume. The volume range must be between 0 and 15.
See also microphoneVolume().
void QBluetoothAudioGateway::setSpeakerVolume ( int volume ) [virtual slot]
Requests the Audio Gateway to notify the remote device to update its speaker volume to volume. The volume range must be between 0 and 15.
See also speakerVolume().
int QBluetoothAudioGateway::speakerVolume () const
Returns the current speaker volume of the device. The volume can be between 0 and 15.
See also setSpeakerVolume().
void QBluetoothAudioGateway::speakerVolumeChanged () [signal]
This signal is sent whenever the microphone volume of the remote device has been changed.
See also speakerVolume() and setSpeakerVolume().