CBTEngConnMan Class Reference
class CBTEngConnMan : public CBase
|
Class
CBTEngConnMan
This class provides functionality for Bluetooth connection management on profile-level. The class mainly forwards the commands to BTEng server side, which passes the commands to its plug-ins which handle the profile-level (service-level) connection management.
Connection management commands are asynchronous, and the result is passed back to the caller through the
MBTEngConnObserver
callback interface. Multiple commands can be outstanding simultaneously.
btengconnman.lib
-
Since
-
S60 v3.2
Constructor & Destructor Documentation
CBTEngConnMan(MBTEngConnObserver *)
Parameters
MBTEngConnObserver
* aObserver
|
Pointer to callback interface that receives connection events.
|
~CBTEngConnMan()
~CBTEngConnMan
|
(
|
)
|
[virtual]
|
Member Functions Documentation
CancelConnect(const TBTDevAddr &)
IMPORT_C void
|
CancelConnect
|
(
|
const
TBTDevAddr
&
|
aAddr
|
)
|
|
Cancels the creation of a service-level connection to the specified Bluetooth address.
This is part of an asynchronous operation; on completion, the caller is informed through
MBTEngConnObserver::ConnectComplete
with error code with KErrCancel if successfully canceled, or KErrNotFound if no service-level connection with the specified Bluetooth address existed.
Parameters
const
TBTDevAddr
& aAddr
|
The Bluetooth address of the remote device.
|
CancelPairDevice()
IMPORT_C void
|
CancelPairDevice
|
(
|
)
|
|
Cancels an ongoing pairing with a Bluetooth device. If this function is issued after the device has been actually paired, the device will not be un-paired.
Connect(const TBTDevAddr &, const TBTDeviceClass &)
Create a service-level connection to the specified Bluetooth address. The decision which profile to use for the service-level connection is taken by BTEng, based on the parameters that are part of the address structure passed as argument.
This is an asynchronous operation; on completion, the caller is informed through
MBTEngConnObserver::ConnectComplete
with the appropriate error code.
Parameters
const
TBTDevAddr
& aAddr
|
The Bluetooth address of the remote device.
|
const
TBTDeviceClass
& aDeviceClass
|
The device class of the remote device. This will be used to select the correct plug-in for creating the service-level connection.
|
ConstructL()
void
|
ConstructL
|
(
|
)
|
[private]
|
Symbian 2nd-phase constructor
Disconnect(const TBTDevAddr &, TBTDisconnectType)
IMPORT_C
TInt
|
Disconnect
|
(
|
const
TBTDevAddr
&
|
aAddr,
|
|
TBTDisconnectType
|
aDiscType
|
|
)
|
|
Disconnects the creation of a service-level connection with the specified Bluetooth address.
This is an asynchronous operation; on completion, the caller is informed through
MBTEngConnObserver::DisconnectComplete
with the appropriate error code.
Parameters
const
TBTDevAddr
& aAddr
|
The Bluetooth address of the remote device.
|
TBTDisconnectType
aDiscType
|
The type of disconnection; EGraceful for graceful (normal) disconnection, EImmediate for immediate (forced) disconnection.
|
GetConnectedAddresses(RBTDevAddrArray &)
Gets the remote addresses for all the open Bluetooth connections. These include all baseband connections, so also connections for which no service-level connection is handled by BTEng profile plug-ins.
Parameters
RBTDevAddrArray
& aAddrArray
|
On return, holds the Bluetooth device addresses of all the connected Bluetooth devices.
|
GetConnectedAddresses(RBTDevAddrArray &, TBTProfile)
IMPORT_C
TInt
|
GetConnectedAddresses
|
(
|
RBTDevAddrArray
&
|
aAddrArray,
|
|
TBTProfile
|
aConnectedProfile
|
|
)
|
|
Gets the remote addresses for all the open Bluetooth connections for the specified profile.
Parameters
RBTDevAddrArray
& aAddrArray
|
On return, holds the Bluetooth device addresses of the connected Bluetooth devices for the requested profile.
|
TBTProfile
aConnectedProfile
|
The profile for which the existing connections are requested.
|
IsConnectable(const TBTDeviceClass &, TBool &)
Checks whether a service-level connection can be created to a device that advertises the specified Class of Device. Note that this only indicate that a suitable profile plug-in is currently loaded by BTEng, it does does not indicate that a connection would succeed (e.g. the device may refuse the connection or could be out of range).
Parameters
const
TBTDeviceClass
& aDeviceClass
|
The device class of the remote device. This will be used to determine whether the device is connectable or not.
|
TBool
& aConnectable
|
On return, contains the value for indicating whether the device is connectable: ETrue if the device is connectable, EFalse if not.
|
IsConnectable(const TBTDevAddr &, const TBTDeviceClass &, TBool &)
Checks whether a service-level connection can be created to a device that advertises the specified Class of Device. Note that this only indicate that a suitable profile plug-in is currently loaded by BTEng, it does does not indicate that a connection would succeed (e.g. the device may refuse the connection or could be out of range).
Parameters
const
TBTDevAddr
& aAddr
|
The address of the remote device. This will be used to get service UUIDs in EIR data to determine whether the device is connectable or not.
|
const
TBTDeviceClass
& aDeviceClass
|
The device class of the remote device. This will be used to determine whether the device is connectable or not.
|
TBool
& aConnectable
|
On return, contains the value for indicating whether the device is connectable: ETrue if the device is connectable, EFalse if not.
|
IsConnected(const TBTDevAddr &, TBTEngConnectionStatus &)
IMPORT_C
TInt
|
IsConnected
|
(
|
const
TBTDevAddr
&
|
aAddr,
|
|
TBTEngConnectionStatus
&
|
aConnected
|
|
)
|
|
Checks whether there is a service-level connection to the specified Bluetooth device.
Parameters
const
TBTDevAddr
& aAddr
|
The Bluetooth address of the remote device.
|
TBTEngConnectionStatus
& aConnected
|
On return, holds the connection status for the specified address; ENotConnected if no connection exists, EConnecting if a (service-level) connection is being established, EConnected if a service-level connection exists, and EDisconnecting if a service-level connection is being disconnected.
|
NewL(MBTEngConnObserver *)
Parameters
MBTEngConnObserver
* aObserver = NULL
|
Pointer to callback interface that receives connection events (see also SetObserver below).
|
NewLC(MBTEngConnObserver *)
Parameters
MBTEngConnObserver
* aObserver = NULL
|
Pointer to callback interface that receives connection events (see also SetObserver below).
|
PairDevice(const TBTDevAddr &)
Start a pairing (a.k.a. bonding) operation with a remote Bluetooth device. This will launch an authentication dialog as part of the pairing procedure (Except Just Works pairing). Since S60 5.1, a confirmation note will be shown indicating whether pairing succeeded when pairing completes; and user will be queried if he/she wants to set the device as trusted if the device has been paired. This operation finally completes when user answers the query or pairing failed confirmation has been shown.
This is an asynchronous operation; on completion, the caller is informed through
MBTEngConnObserver::PairingComplete
with the appropriate error code.
Note: this method is intended for operations that only include pairing, and no connection establishment. When requiring authentication/encryption on a Bluetooth link, the preferred method is to pass the security requirements through the
TBTSockAddr
structure.
PairDevice(const TBTDevAddr &, TBTDeviceClass)
Start a pairing (a.k.a. bonding) operation with a remote Bluetooth device. This will launch an authentication dialog as part of the pairing procedure (Except Just Works pairing). Or in case of audio headset whose version is earlier than BT v2.1,and if the auto-pairing feature is supported, the PIN query is not shown but the default PIN (0000) is given automatically. If that fails the PIN query is shown normally. Since S60 5.1, a confirmation note will be shown indicating whether pairing succeeded when pairing completes; and user will be queried if he/she wants to set the device as trusted if the device has been paired. This operation finally completes when user answers the query or pairing failed confirmation has been shown.
This is an asynchronous operation; on completion, the caller is informed through
MBTEngConnObserver::PairingComplete
with the appropriate error code.
Note: this method is intended for operations that only include pairing, and no connection establishment. When requiring authentication/encryption on a Bluetooth link, the preferred method is to pass the security requirements through the
TBTSockAddr
structure.
PrepareDiscovery()
IMPORT_C void
|
PrepareDiscovery
|
(
|
)
|
|
Prepares any existing Bluetooth connection topology for performing device discovery. As a result of this call, the server will request the master role on each existing connection. Note: this method is for usage of BTNotif only. It attempts to optimize the existing topology so therefore there is no result to be informed. The functionality is only executed after this function has returned.
RemoveObserver()
IMPORT_C void
|
RemoveObserver
|
(
|
)
|
|
Removes the subscription to service-level connection events. Note: this functionality is implicit when destroying CBTConnMan.
SetObserver(MBTEngConnObserver *)
Subscribes to service-level connection events. This will replace any previoously registered callback interface object. The observer is informed of connection events through the
MBTEngConnObserver
callback interface. Note: the observer is only notified of events related to service-level connections. Generic notifications about Bluetooth baseband events can be obtained through bluetooth.lib.
An observer must be set before issueing any connection-related commands.
Parameters
MBTEngConnObserver
* aObserver
|
The callback interface through which connection events are passed back.
|
StartPairingObserver(const TBTDevAddr &)
IMPORT_C
TInt
|
StartPairingObserver
|
(
|
const
TBTDevAddr
&
|
aAddr
|
)
|
[static]
|
Listen to the result of a pairing operation, and launch the authorization notifier if successful. Note: this method is for usage of BTNotif only. The authorization notifier is called independently i.e. there is no callback resulting from calling this function. This function requires LocalServices and WriteDeviceData capabilities.
StopPairingObserver(const TBTDevAddr &)
IMPORT_C
TInt
|
StopPairingObserver
|
(
|
const
TBTDevAddr
&
|
aAddr
|
)
|
[static]
|
Stop handling the result of a pairing operation. Note: this method is for usage of BTNotif only. The authorization notifier is called independently i.e. there is no callback resulting from calling this function. This function requires LocalServices and WriteDeviceData capabilities.
Member Data Documentation
CBTEngConnHandler * iConnHandler
Handle to BTEng server side and listener to connection events. Own.
MBTEngConnObserver * iObserver
Reference to receiver of connection events. Not own.
TAny * iReserved
TAny
*
|
iReserved
|
[private]
|
This field is NOT used. Reserved for future extension. Own.
Copyright ©2010 Nokia Corporation and/or its subsidiary(-ies).
All rights
reserved. Unless otherwise stated, these materials are provided under the terms of the Eclipse Public License
v1.0.