#include <hfp.h>
Public Member Functions | |
HfpService * | GetService (void) const |
Query the service associated with the session. | |
bool | IsConnecting (void) const |
Query whether a connection attempt to the device is in progress. | |
bool | IsConnected (void) const |
Query whether the device is fully connected. | |
bool | IsConnectingAudio (void) const |
Query whether a voice audio (SCO) connection is being initiated. | |
bool | IsConnectedAudio (void) const |
Query whether a voice audio (SCO) connection is completed and available for audio streaming. | |
bool | Connect (ErrorInfo *error=0) |
Initiate a connection attempt to the device. | |
bool | HasConnectingCall (void) const |
Query whether the device has an incomplete outgoing call. | |
bool | HasEstablishedCall (void) const |
Query whether the device has an established call. | |
bool | HasWaitingCall (void) const |
Query whether the device has an incomplete incoming call. | |
const GsmClipResult * | WaitingCallIdentity (void) const |
Retrieve the caller ID value of the last incomplete call, either incoming or outgoing. | |
bool | GetServiceState (void) const |
Query whether the attached device has wireless service available. | |
int | GetSignalStrength (void) const |
Query the signal strength (bars) from an audio gateway. | |
int | GetRoaming (void) const |
Query whether the audio gateway is roaming. | |
int | GetBatteryCharge (void) const |
Query the battery charge level of the audio gateway. | |
bool | GetVoiceRecogActive (void) const |
Query the voice recognition state. | |
int | GetVolumeMic (void) const |
Query the microphone gain level. | |
int | GetVolumeSpeaker (void) const |
Query the speaker gain level. | |
bool | GetInBandRingToneEnable (void) const |
Query the in-band ring tone setting. | |
int | GetFeatures (void) const |
Query the feature bit set of the attached device. | |
bool | FeatureThreeWayCalling (void) const |
Query whether the attached device supports three-way calling. | |
bool | FeatureEcnr (void) const |
Query whether the attached device supports echo cancelation and/or noise reduction signal processing. | |
bool | FeatureVoiceRecog (void) const |
Query whether the attached device supports voice recognition. | |
bool | FeatureInBandRingTone (void) const |
Query whether the attached device supports in-band ringtones. | |
bool | FeatureRejectCall (void) const |
Query whether the attached device supports waiting call rejection. | |
bool | FeatureIndSignalStrength (void) const |
Query whether the attached device supports signal strength indication. | |
bool | FeatureIndRoaming (void) const |
Query whether the attached device supports roaming indication. | |
bool | FeatureIndBatteryCharge (void) const |
Query whether the attached device supports battery charge indication. | |
bool | IsCommandPending (void) const |
Query whether a service level command to the device is queued or otherwise pending completion. | |
HfpPendingCommand * | CmdQueryNumber (ErrorInfo *error=0) |
Query the telephone number of the audio gateway. | |
HfpPendingCommand * | CmdQueryOperator (ErrorInfo *error=0) |
Query operator information from the audio gateway. | |
HfpPendingCommand * | CmdQueryCurrentCalls (ErrorInfo *error=0) |
Query current calls from the audio gateway. | |
HfpPendingCommand * | CmdSetVoiceRecog (bool active, ErrorInfo *error=0) |
Request that the audio gateway activate or deactivate voice recognition. | |
HfpPendingCommand * | CmdAnswer (ErrorInfo *error=0) |
Request that the audio gateway answer the unanswered incoming call. | |
HfpPendingCommand * | CmdHangUp (ErrorInfo *error=0) |
Request that the audio gateway hang up the active call. | |
HfpPendingCommand * | CmdDial (const char *phnum, ErrorInfo *error=0) |
Request that the audio gateway place a new outgoing call. | |
HfpPendingCommand * | CmdRedial (ErrorInfo *error=0) |
Request that the audio gateway place a new outgoing call using the last dialed number. | |
HfpPendingCommand * | CmdSendDtmf (char code, ErrorInfo *error=0) |
Request that the audio gateway send a DTMF tone to the active call. | |
HfpPendingCommand * | CmdCallDropHeldUdub (ErrorInfo *error=0) |
Request that the audio gateway drop the held call, or reject the waiting call as User Declared User Busy. | |
HfpPendingCommand * | CmdCallSwapDropActive (ErrorInfo *error=0) |
Request that the audio gateway drop the active call and activate the held or waiting call. | |
HfpPendingCommand * | CmdCallDropIndex (unsigned int actnum, ErrorInfo *error=0) |
Drop a specific call. | |
HfpPendingCommand * | CmdCallSwapHoldActive (ErrorInfo *error=0) |
Request that the audio gateway hold the active call and activate the held or waiting call. | |
HfpPendingCommand * | CmdCallPrivateConsult (unsigned int callnum, ErrorInfo *error=0) |
Request private consultation mode with a call. | |
HfpPendingCommand * | CmdCallLink (ErrorInfo *error=0) |
Request that the audio gateway create a three-way call using the active call and the held or waiting call. | |
HfpPendingCommand * | CmdCallTransfer (ErrorInfo *error=0) |
Request that the audio gateway link the two calls and disconnect the subscriber from both calls. | |
bool | SndOpen (bool play, bool capture, ErrorInfo *error=0) |
Initiate an audio connection to the connected device. | |
void | SndClose (void) |
Disconnect the audio connection. | |
void | SndGetProps (SoundIoProps &props) const |
Query the SoundIo properties of the connected device. | |
void | SndGetFormat (SoundIoFormat &format) const |
Query the supported PCM format of the connected device. | |
bool | SndSetFormat (SoundIoFormat &format, ErrorInfo *error) |
Check whether a PCM format is compatible with the connected device. | |
bool | SndAsyncStart (bool play, bool capture, ErrorInfo *error) |
Initiate asynchronous audio handling. | |
void | SndAsyncStop (void) |
Halt asynchronous audio handling. | |
bool | SndIsAsyncStarted (void) const |
Query whether asynchronous audio handling is enabled. | |
rfcomm_secmode_t | GetSecMode (void) const |
Query the security mode of the connection to the device. | |
bool | IsAutoReconnect (void) const |
Query whether the autoreconnect mechanism is enabled for this device. | |
void | SetAutoReconnect (bool enable) |
Enable or disable the autoreconnect mechanism for this device. | |
bool | IsConnectionRemoteInitiated (void) const |
Query whether an in-progress or complete connection to the device was initiated by the device. | |
bool | IsPriorDisconnectVoluntary (void) const |
Query whether the last disconnection was voluntary or involuntary. | |
BtDevice * | GetDevice (void) const |
Query the BtDevice associated with the session. | |
void | Disconnect (bool voluntary=true) |
Request disconnection of the session. | |
BtHub * | GetHub (void) const |
DispatchInterface * | GetDi (void) const |
void * | GetPrivate (void) const |
Query the private pointer associated with the object. | |
void | SetPrivate (void *priv) |
Assign the private pointer associated with the object. | |
void | Get (void) |
Increment the reference count. | |
void | Put (void) |
Decrement the reference count. | |
Public Attributes | |
Callback< void, HfpSession *, ErrorInfo * > | cb_NotifyConnection |
Notification of an asynchronous change to the device connection state. | |
Callback< void, HfpSession *, ErrorInfo * > | cb_NotifyAudioConnection |
Notification of an asynchronous change to the voice audio connection state. | |
Callback< void, HfpSession *, bool, bool, bool > | cb_NotifyCall |
Notification of a change to the established call state. | |
Callback< void, HfpSession *, const char *, int > | cb_NotifyIndicator |
Notification of a change to a miscellaneous audio gateway state indicator. | |
Callback< void, HfpSession *, bool > | cb_NotifyVoiceRecog |
Notification of a change to the audio gateway's voice recognition state. | |
Callback< void, HfpSession *, bool, bool > | cb_NotifyVolume |
Notification of a change to the negotiated speaker or microphone gain level. | |
Callback< void, HfpSession *, bool > | cb_NotifyInBandRingTone |
Notification of a change to the audio gateway's in-band ring tone setting. | |
Callback< void, BtManaged * > | cb_NotifyDestroy |
Object destruction notification callback. |
This class represents a Hands Free Profile session and connection to a remote audio gateway device (typically a cell phone). An HFP session through this object can allow the audio gateway to use a speakerphone facility provided by the local system. It supports numerous use cases:
create
= true
. This method requires a reference to an existing BtDevice object, or other explicit knowledge of the Bluetooth address of the target device. This method will also only instantiate a new HfpSession object if one doesn't already exist for the associated BtDevice.HfpSession objects are reference-counted Bluetooth managed objects, and are always destroyed under circumstances:
The HfpSession class is designed so that clients may interact with it without defining derived classes. All notifications provided by HfpSession are performed through Callback callback objects.
Clients may override the instantiation path for HfpSession objects by registering their own factory method to HfpService::cb_HfpSessionFactory. As part of a specialized factory, clients may use the default factory method, HfpService::DefaultSessionFactory(). A specialized factory may be used to:
When Disconnected or Connecting, none of the feature inquiries are meaningful, no state indicator and call state notifications will be delivered, the audio connection must be Disconnected, and no commands may be issued on the device.
Once connected, the device will accept commands, state indicator notifications will be delivered and certain values retained, and the voice audio channel may be connected.
HfpService* GetService | ( | void | ) | const [inline] |
Query the service associated with the session.
Reimplemented from RfcommSession.
bool IsConnecting | ( | void | ) | const [inline] |
Query whether a connection attempt to the device is in progress.
true | A connection attempt is in progress | |
false | The device is either fully connected or disconnected |
bool IsConnected | ( | void | ) | const [inline] |
Query whether the device is fully connected.
true | The device is fully connected and accepting commands | |
false | The device is not fully connected |
bool IsConnectingAudio | ( | void | ) | const [inline] |
Query whether a voice audio (SCO) connection is being initiated.
true | An audio connection is in progress but incomplete. | |
false | An audio connection is complete or nonexistant. |
bool IsConnectedAudio | ( | void | ) | const [inline] |
Query whether a voice audio (SCO) connection is completed and available for audio streaming.
true | Audio is connected and operational. | |
false | Audio is disconnected or connecting. |
bool Connect | ( | ErrorInfo * | error = 0 |
) |
Initiate a connection attempt to the device.
This function will attempt to transition the device to the Connecting state. The process of connecting is always asynchronous, and if this function succeeds, a later transition to the Connected state will occur asynchronously after negotiation. As long as the client does not invoke Disconnect(), a future call to HfpSession::cb_NotifyConnection should be expected, to notify a transition to either the Connected or Disconnected state.
As a rule, no callbacks are invoked in a nested fashion from method calls. This function can affect the connection state, but will not directly generate a HfpSession::cb_NotifyConnection callback. Callers must notice state changes in-line.
[out] | error | Error information structure. If this method fails and returns false, and error is not 0, error will be filled out with information on the cause of the failure. |
true | The connection attempt is in progress, and the device has transitioned to the Connecting state. | |
false | The connection attempt failed. Reasons could include:
|
bool HasConnectingCall | ( | void | ) | const [inline] |
Query whether the device has an incomplete outgoing call.
true | Unanswered outgoing call exists | |
false | No unanswered outgoing call exists |
bool HasEstablishedCall | ( | void | ) | const [inline] |
Query whether the device has an established call.
true | Established call, either active or on hold, exists | |
false | No established call exists |
bool HasWaitingCall | ( | void | ) | const [inline] |
Query whether the device has an incomplete incoming call.
true | Unanswered incoming call exists | |
false | No unanswered incoming call exists |
const GsmClipResult* WaitingCallIdentity | ( | void | ) | const [inline] |
Retrieve the caller ID value of the last incomplete call, either incoming or outgoing.
bool GetServiceState | ( | void | ) | const [inline] |
Query whether the attached device has wireless service available.
Queries the last value reported by the audio gateway for service availability.
Wireless service may be unavailable because the phone is out of range of a cell tower.
true | Service available | |
false | Service unavailable |
GSM 07.07 section 8.9
int GetSignalStrength | ( | void | ) | const [inline] |
Query the signal strength (bars) from an audio gateway.
Queries the last value reported by the audio gateway for signal strength.
GSM 07.07 section 8.9
int GetRoaming | ( | void | ) | const [inline] |
Query whether the audio gateway is roaming.
Queries the last value reported by the audio gateway for roaming.
0 | Audio gateway is not roaming | |
1 | Audio gateway is roaming | |
-1 | Roaming state is unknown |
GSM 07.07 section 8.9
int GetBatteryCharge | ( | void | ) | const [inline] |
Query the battery charge level of the audio gateway.
Queries the last value reported by the audio gateway for battery charge level.
GSM 07.07 section 8.9
bool GetVoiceRecogActive | ( | void | ) | const [inline] |
Query the voice recognition state.
If the audio gateway supports voice recognition, and is connected, it will use the microphone of the hands-free to listen for commands. Voice recognition can be activated directly on the audio gateway, or via CmdSetVoiceRecog(). Voice recognition can be deactivated when the audio gateway has recognized a voice command, when the audio gateway times out listening for a command, or via CmdSetVoiceRecog().
Audio gateway support for voice recognition can be tested via FeatureVoiceRecog().
true | Voice recognition activated | |
false | Voice recognition deactivated or unsupported |
int GetVolumeMic | ( | void | ) | const [inline] |
Query the microphone gain level.
If the audio gateway supports remote volume control, this method can be used to retrieve the microphone volume level synchronized with the audio gateway.
int GetVolumeSpeaker | ( | void | ) | const [inline] |
Query the speaker gain level.
If the audio gateway supports remote volume control, this method can be used to retrieve the speaker volume level synchronized with the audio gateway.
bool GetInBandRingToneEnable | ( | void | ) | const [inline] |
Query the in-band ring tone setting.
If the audio gateway supports in-band ring tones, it will send its in-band ring tone state on connection, and when it is changed. This accessor method can be used to query the last known value.
The in-band ring tone setting cannot be changed from the hands-free; it can only be set on the audio gateway.
0 | In-band ring tones disabled or unsupported | |
1 | In-band ring tones enabled |
int GetFeatures | ( | void | ) | const [inline] |
Query the feature bit set of the attached device.
This will return the raw reported features of the device, as defined in the Bluetooth Hands Free Profile specification. It is up to the client to interpret them. For simpler use, the FeatureXXX() methods are available, e.g. FeatureThreeWayCalling().
bool FeatureThreeWayCalling | ( | void | ) | const [inline] |
Query whether the attached device supports three-way calling.
If supported, CmdCallDropWaiting() may be used.
true | Three way calling supported | |
false | Three way calling not supported |
bool FeatureEcnr | ( | void | ) | const [inline] |
Query whether the attached device supports echo cancelation and/or noise reduction signal processing.
true | EC/NR supported | |
false | EC/NR not supported |
bool FeatureVoiceRecog | ( | void | ) | const [inline] |
Query whether the attached device supports voice recognition.
true | Voice recognition supported | |
false | Voice recognition not supported |
bool FeatureInBandRingTone | ( | void | ) | const [inline] |
Query whether the attached device supports in-band ringtones.
If the audio gateway supports in-band ringtones, it is able to play its own ringtone through the voice audio link, and will do so when in-band ringtones are enabled.
true | In-band ringtones supported | |
false | In-band ringtones not supported |
bool FeatureRejectCall | ( | void | ) | const [inline] |
Query whether the attached device supports waiting call rejection.
If supported, CmdCallDropWaiting() may be used.
true | Call rejection supported | |
false | Call rejection not supported |
bool FeatureIndSignalStrength | ( | void | ) | const [inline] |
Query whether the attached device supports signal strength indication.
If supported, the signal strength may be queried with GetSignalStrength().
true | Signal strength indication supported | |
false | Signal strength indication not supported |
bool FeatureIndRoaming | ( | void | ) | const [inline] |
Query whether the attached device supports roaming indication.
If roaming indication is supported, the roaming state may be queried with GetRoaming().
true | Roaming state indication supported | |
false | Roaming state indication not supported |
bool FeatureIndBatteryCharge | ( | void | ) | const [inline] |
Query whether the attached device supports battery charge indication.
If battery charge indication is supported, the battery charge state may be queried with GetBatteryCharge().
true | Battery charge indication supported | |
false | Battery charge indication not supported |
bool IsCommandPending | ( | void | ) | const [inline] |
Query whether a service level command to the device is queued or otherwise pending completion.
true | At least one command is pending | |
false | The command queue is empty |
HfpPendingCommand * CmdQueryNumber | ( | ErrorInfo * | error = 0 |
) |
Query the telephone number of the audio gateway.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lostHfpPendingCommand * CmdQueryOperator | ( | ErrorInfo * | error = 0 |
) |
Query operator information from the audio gateway.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lostHfpPendingCommand * CmdQueryCurrentCalls | ( | ErrorInfo * | error = 0 |
) |
Query current calls from the audio gateway.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lostHfpPendingCommand * CmdSetVoiceRecog | ( | bool | active, | |
ErrorInfo * | error = 0 | |||
) |
Request that the audio gateway activate or deactivate voice recognition.
[in] | active | Set to true to request activation of voice recognition mode, false to request deactivation. |
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lostHfpPendingCommand * CmdAnswer | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway answer the unanswered incoming call.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdHangUp | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway hang up the active call.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
true | Command was queued |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdDial | ( | const char * | phnum, | |
ErrorInfo * | error = 0 | |||
) |
Request that the audio gateway place a new outgoing call.
[in] | phnum | Phone number to be dialed |
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost or the phone number is too long HfpPendingCommand * CmdRedial | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway place a new outgoing call using the last dialed number.
The last dialed number is the number last dialed by the audio gateway, and may have been dialed before the audio gateway was connected to the hands-free.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdSendDtmf | ( | char | code, | |
ErrorInfo * | error = 0 | |||
) |
Request that the audio gateway send a DTMF tone to the active call.
code | DTMF code to be sent. May be numeric, #, or *. | |
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
true | Command was queued |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallDropHeldUdub | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway drop the held call, or reject the waiting call as User Declared User Busy.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallSwapDropActive | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway drop the active call and activate the held or waiting call.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallDropIndex | ( | unsigned int | actnum, | |
ErrorInfo * | error = 0 | |||
) |
Drop a specific call.
[in] | actnum | Call number to be dropped |
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallSwapHoldActive | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway hold the active call and activate the held or waiting call.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallPrivateConsult | ( | unsigned int | callnum, | |
ErrorInfo * | error = 0 | |||
) |
Request private consultation mode with a call.
[in] | callnum | Call number to be made the active call |
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallLink | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway create a three-way call using the active call and the held or waiting call.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost HfpPendingCommand * CmdCallTransfer | ( | ErrorInfo * | error = 0 |
) |
Request that the audio gateway link the two calls and disconnect the subscriber from both calls.
[out] | error | Error information structure. If this method fails and returns 0 , and error is not 0, error will be filled out with information on the cause of the failure. |
0
if the command could not be queued, e.g. because the device connection was lost bool SndOpen | ( | bool | play, | |
bool | capture, | |||
ErrorInfo * | error = 0 | |||
) |
Initiate an audio connection to the connected device.
This method will initiate an outbound audio connection to the connected device.
[in] | play | Must be true |
[in] | capture | Must be true |
[out] | error | Error information structure. If this method fails and returns false, and error is not 0, error will be filled out with information on the cause of the failure. |
true | Audio connection has been initiated. The connection will be incomplete, i.e. IsConnectingAudio(), and a callback to HfpSession::cb_NotifyAudioConnection will be pending. | |
false | Audio is either already connected, the connection attempt failed, or the play and/or capture parameters were false. |
void SndClose | ( | void | ) |
Disconnect the audio connection.
Closes an existing audio connection, or cancels a pending audio connection.
As a rule, no callbacks are invoked in a nested fashion from method calls. This method is no exception and does not result in a call to either HfpSession::cb_NotifyAudioConnection or SoundIo::cb_NotifyPacket.
void SndGetProps | ( | SoundIoProps & | props | ) | const |
Query the SoundIo properties of the connected device.
This method is provided as part of the audio handling interface.
void SndGetFormat | ( | SoundIoFormat & | format | ) | const |
Query the supported PCM format of the connected device.
This method is provided as part of the audio handling interface.
bool SndSetFormat | ( | SoundIoFormat & | format, | |
ErrorInfo * | error | |||
) |
Check whether a PCM format is compatible with the connected device.
This method is provided as part of the audio handling interface.
bool SndAsyncStart | ( | bool | play, | |
bool | capture, | |||
ErrorInfo * | error | |||
) |
Initiate asynchronous audio handling.
Initiates periodic callbacks to SoundIo::cb_NotifyPacket as audio packets are sent to/received from the connected device.
[in] | play | Must be true |
[in] | capture | Must be true |
[out] | error | Error information structure. If this method fails and returns false, and error is not 0, error will be filled out with information on the cause of the failure. |
true | Asynchronous audio handling has been enabled. Expect future callbacks to SoundIo::cb_NotifyPacket. | |
false | Error enabling asynchronous audio handling. Reasons might include:
|
void SndAsyncStop | ( | void | ) |
Halt asynchronous audio handling.
This method is provided as part of the audio handling interface.
bool SndIsAsyncStarted | ( | void | ) | const [inline] |
Query whether asynchronous audio handling is enabled.
This method is provided as part of the audio handling interface.
rfcomm_secmode_t GetSecMode | ( | void | ) | const [inline, inherited] |
Query the security mode of the connection to the device.
For information on the security mode, see rfcomm_secmode_t.
If the device is connected, this accessor will return the security mode associated with the socket.
Security modes are configured at the service level, as they must be set at the socket level prior to connection in order to take effect. For inbound connections, the service object is the keeper of the one listening socket that accepts inbound connections and assigns their security modes.
While it may be possible to try to manage security modes at the level of each session, at least for outbound connections, no compelling reasons have been identified at the time of this writing and management only at the level of the service is supported.
bool IsAutoReconnect | ( | void | ) | const [inline, inherited] |
Query whether the autoreconnect mechanism is enabled for this device.
true | Autoreconnect is enabled | |
false | Autoreconnect is disabled. |
void SetAutoReconnect | ( | bool | enable | ) | [inherited] |
Enable or disable the autoreconnect mechanism for this device.
If enabled, whenever the device is disconnected, a reconnection attempt will be made periodically through a timer. Auto-reconnection is useful for devices such as phones that regularly move in and out of range.
This function can affect the life cycle management of the object it is called on.
enable | Set to true to enable, false to disable. |
bool IsConnectionRemoteInitiated | ( | void | ) | const [inline, inherited] |
Query whether an in-progress or complete connection to the device was initiated by the device.
This is useful for connection auditing logic, e.g. to refuse connections from unknown devices.
true | The device initiated the connection | |
false | The local UI or autoreconnect mechanism initiated the connection |
bool IsPriorDisconnectVoluntary | ( | void | ) | const [inline, inherited] |
Query whether the last disconnection was voluntary or involuntary.
When a connection is explicitly broken, e.g. selecting a disconnect function on the device or calling Disconnect(), it is considered voluntary. When a connection fails for implicit reasons such as a device moving out of radio range or an HCI being disconnected, it is considered involuntary. This function reports whether the last transition from the Connecting or Connected state to the Disconnected state was voluntary.
true | The last transition to the Disconnected state was voluntary. | |
false | The last transition to the Disconnected state was involuntary. |
BtDevice* GetDevice | ( | void | ) | const [inline, inherited] |
void Disconnect | ( | bool | voluntary = true |
) | [inline, inherited] |
Request disconnection of the session.
This abstract interface allows one to request any connection-oriented session object derived from BtSession to disconnect itself.
voluntary | Whether the disconnection should be presented as voluntary and explicit, i.e. selecting disconnect on a list, or involuntary, i.e. exiting Bluetooth radio range. |
DispatchInterface* GetDi | ( | void | ) | const [inline, inherited] |
Query the dispatcher interface of the presiding BtHub
void* GetPrivate | ( | void | ) | const [inline, inherited] |
Query the private pointer associated with the object.
All BtManaged derived objects have a single pointer field reserved for the use of clients. It is always initialized to zero when the object is constructed, and clients may assign it as they wish.
void SetPrivate | ( | void * | priv | ) | [inline, inherited] |
Assign the private pointer associated with the object.
All BtManaged derived objects have a single pointer field reserved for the use of clients. It is always initialized to zero when the object is constructed, and clients may assign it as they wish.
priv | New value to assign to the private pointer |
void Get | ( | void | ) | [inline, inherited] |
Increment the reference count.
As per managed objects, BtManaged derived objects are not deleted so long as they have a positive reference count.
void Put | ( | void | ) | [inherited] |
Decrement the reference count.
As per managed objects, when the object's reference count reaches zero, the object will be destroyed in the context of a timer event.
Callback<void, HfpSession *, ErrorInfo *> cb_NotifyConnection |
Notification of an asynchronous change to the device connection state.
The connection state, from the perspective of HfpSession clients, has three states:
The audio gateway may transition from Disconnected to Connecting, from Connecting to Connected, and from either Connecting or Connected to Disconnected. There is no legal transition directly from Disconnected to Connected.
As a rule, no callbacks are invoked in a nested fashion from method calls. State changes effected directly by Connect() and Disconnect() are not reported through this mechanism, and clients must notice such state changes directly. State changes caused by connections initiated by the audio gateway or the auto-reconnect mechanism, connections that have completed negotiation, and connection attempts that have failed for reasons other than Disconnect() are reported.
For example, if a HfpSession object in the Disconnected state has its Connect() method invoked, it will transition to the Connecting state, but no notification will be generated through HfpSession::cb_NotifyConnection. Later, after negotiation completes, and the object transitions to the Connected state, a notification WILL be generated because the event causing the transition was system-generated and while it may have been the result of an earlier call to Connect(), the notification is not being generated from directly underneath that call.
The transition to the Connected state is always done from the Connecting state, and will always be notified through this callback. Because most queries and commands cannot be made of the device until it enters the Connected state, it is critical that clients receive notification of it.
HfpSession* | The HfpSession object that has had an asynchronous state transition to its service-level connection. | |
error | Error information structure. If the state transition was to the Disconnected state, the ErrorInfo* parameter is nonzero, and contains information about why the connection was lost. Otherwise, it is 0 . |
Callback<void, HfpSession*, ErrorInfo*> cb_NotifyAudioConnection |
Notification of an asynchronous change to the voice audio connection state.
The voice audio connection states include:
Similar to the device connection state, the audio connection state can transition from Disconnected to Connecting, e.g. by SoundIo::SndOpen() or a remote connection attempt. It can transition from Connecting to Connected following negotiation. It can transition from Connecting or Connected to Disconnected by SoundIo::SndClose() or Disconnect(). It cannot transition directly from Disconnected to Connected.
As a rule, no callbacks are invoked in a nested fashion from method calls. Similar to HfpSession::cb_NotifyConnection, this callback is only invoked on asynchronous changes to the audio connection state above and never directly through method calls.
The audio connection will always be Disconnected whenever the device is not Connected.
HfpSession* | The HfpSession object that has had an asynchronous state transition to its audio connection. | |
error | Error information structure. If the state transition of the device audio was to the Disconnected state, the ErrorInfo* parameter is nonzero, and contains information about why the audio connection was lost. Otherwise, it is 0 . |
Callback<void, HfpSession *, bool, bool, bool> cb_NotifyCall |
Notification of a change to the established call state.
HfpSession* | Pointer to the HfpSession originating the call. Largely redundant as Callback can store and substitute parameters. | |
bool | Set to true if the device's active call state has changed. Use HasEstablishedCall() to test wiether an established call exists or not. | |
bool | Set to true if the device's waiting or held call state has changed. Use HasConnectingCall() to test whether an outbound call is in progress, and HasWaitingCall() to test whether an inbound call is ready to be answered. Use WaitingCallIdentity() to retrieve the Caller ID value provided in the case of an incoming call. | |
bool | Set to true when the device signals a ring. Clients may use this to play a ring tone or execute alerting activity. |
Callback<void, HfpSession *, const char *, int> cb_NotifyIndicator |
Notification of a change to a miscellaneous audio gateway state indicator.
char* | Name of indicator | |
int | New value of indicator |
Callback<void, HfpSession *, bool> cb_NotifyVoiceRecog |
Notification of a change to the audio gateway's voice recognition state.
bool | Set to true if the audio gateway has activated voice recognition mode, false otherwise |
Callback<void, HfpSession *, bool, bool> cb_NotifyVolume |
Notification of a change to the negotiated speaker or microphone gain level.
bool1 | Set to true if the microphone gain level has been changed by audio gateway | |
bool2 | Set to true if the speaker gain level has been changed by audio gateway |
Callback<void, HfpSession *, bool> cb_NotifyInBandRingTone |
Notification of a change to the audio gateway's in-band ring tone setting.
bool | Set to true if the audio gateway has enabled in-band ring tones, false otherwise |
Callback<void, BtManaged*> cb_NotifyDestroy [inherited] |
Object destruction notification callback.
This callback is invoked proir to deletion of the managed object, so that clients may release associated resources. This callback occurs in the context of a timer event, and complies with the rule of not invoking client callbacks in a nested fashion.
The decision to destroy the object is final. The client may not attempt to preserve the object by acquiring additional references from this callback.