CBluetoothSynchronousLink Class Reference

class CBluetoothSynchronousLink : public CBase

Provides Bluetooth SCO functionality.

This allows Bluetooth SCO (synchronous) link Connect, Disconnect, Send and Receive.

Inherits from

Public Member Functions
~CBluetoothSynchronousLink ()
IMPORT_C TInt AcceptConnection ()
IMPORT_C TInt AcceptConnection (const TBTSyncPackets &)
IMPORT_C TBTSyncBandwidth Bandwidth ()
RBTBaseband & Baseband ()
IMPORT_C void CancelAccept ()
IMPORT_C void CancelReceive ()
IMPORT_C void CancelSend ()
IMPORT_C void CancelSetup ()
IMPORT_C TUint16 Coding ()
IMPORT_C TInt Disconnect ()
RSocket & ESCOSocket ()
void HandleAcceptConnectionCompleteL ( TInt , TSCOType )
void HandleDisconnectionCompleteL ( TInt )
void HandleReceiveCompleteL ( TInt )
void HandleSendCompleteL ( TInt )
void HandleSetupConnectionCompleteL ( TInt , TSCOType )
IMPORT_C TUint16 Latency ()
RSocket & ListeningESCOSocket ()
RSocket & ListeningSCOSocket ()
IMPORT_C CBluetoothSynchronousLink * NewL ( MBluetoothSynchronousLinkNotifier &, RSocketServ &)
IMPORT_C CBluetoothSynchronousLink * NewLC ( MBluetoothSynchronousLinkNotifier &, RSocketServ &)
MBluetoothSynchronousLinkNotifier & Notifier ()
IMPORT_C TInt Receive ( TDes8 &)
IMPORT_C void RemoteName ( TSockAddr &)
IMPORT_C TUint8 RetransmissionEffort ()
RSocket & SCOSocket ()
IMPORT_C TInt Send (const TDesC8 &)
IMPORT_C void SetCoding ( TUint16 )
IMPORT_C void SetMaxBandwidth ( TBTSyncBandwidth )
IMPORT_C void SetMaxLatency ( TUint16 )
IMPORT_C void SetNotifier ( MBluetoothSynchronousLinkNotifier &)
IMPORT_C void SetRetransmissionEffort ( TBTeSCORetransmissionTypes )
IMPORT_C TInt SetupConnection (const TBTDevAddr &)
IMPORT_C TInt SetupConnection (const TBTDevAddr &, const TUint16 )
IMPORT_C TInt SetupConnection (const TBTDevAddr &, const TBTSyncPackets &)
RSocketServ & SocketServer ()
Private Member Functions
CBluetoothSynchronousLink ( MBluetoothSynchronousLinkNotifier &, RSocketServ &)
void ConstructL ()
void LinkDown ()
TInt LinkUp ( TBTDevAddr )
void UpdateLinkParams ( TSCOType )
Inherited Functions
CBase::CBase()
CBase::Delete(CBase *)
CBase::Extension_(TUint,TAny *&,TAny *)
CBase::operator new(TUint)
CBase::operator new(TUint,TAny *)
CBase::operator new(TUint,TLeave)
CBase::operator new(TUint,TLeave,TUint)
CBase::operator new(TUint,TUint)
CBase::~CBase()
Private Attributes
CBTSynchronousLinkAccepter * iBTSynchronousLinkAccepterESCO
CBTSynchronousLinkAccepter * iBTSynchronousLinkAccepterSCO
CBTSynchronousLinkAttacher * iBTSynchronousLinkAttacherESCO
CBTSynchronousLinkAttacher * iBTSynchronousLinkAttacherSCO
CBTSynchronousLinkBaseband * iBTSynchronousLinkBaseband
CBTSynchronousLinkDetacher * iBTSynchronousLinkDetacherESCO
CBTSynchronousLinkDetacher * iBTSynchronousLinkDetacherSCO
CBTSynchronousLinkReceiver * iBTSynchronousLinkReceiverESCO
CBTSynchronousLinkReceiver * iBTSynchronousLinkReceiverSCO
CBTSynchronousLinkSender * iBTSynchronousLinkSenderESCO
CBTSynchronousLinkSender * iBTSynchronousLinkSenderSCO
RBTBaseband iBaseband
TBuf8 < 1 > iDummySCOShutdownDescriptor
RSocket iESCOSocket
RSocket iListeningESCOSocket
RSocket iListeningSCOSocket
TBTeSCOLinkParams iNegotiatedLink
MBluetoothSynchronousLinkNotifier * iNotifier
TBool iOpenedSCO
TBool iOpeningESCO
TBool iOpeningSCO
TBTeSCOLinkParams iRequestedLink
RSocket iSCOSocket
TUint8 iSCOTypes
TBTSockAddr iSockAddr
RSocketServ & iSockServer

Constructor & Destructor Documentation

CBluetoothSynchronousLink(MBluetoothSynchronousLinkNotifier &, RSocketServ &)

CBluetoothSynchronousLink ( MBluetoothSynchronousLinkNotifier & aNotifier,
RSocketServ & aServer
) [private]

Parameters

MBluetoothSynchronousLinkNotifier & aNotifier
RSocketServ & aServer

~CBluetoothSynchronousLink()

IMPORT_C ~CBluetoothSynchronousLink ( )

Destructor

Member Functions Documentation

AcceptConnection()

IMPORT_C TInt AcceptConnection ( )

Prepare for a remote device to set up a synchronous link on the local device.

Whilst this facility is set, a response can be sent to a remote device trying to set up a synchronous link, allowing that synchronous link to be brought up. This object will represent that synchronous link locally when/if it does come up.

AcceptConnection(const TBTSyncPackets &)

IMPORT_C TInt AcceptConnection ( const TBTSyncPackets & aPacketTypes )

Prepare for a remote device to set up a synchronous link on the local device.

Whilst this facility is set, a response can be sent to a remote device trying to set up a synchronous link, allowing that synchronous link to be brought up. This object will represent that synchronous link locally when/if it does come up.

TBTPacketType

Parameters

const TBTSyncPackets & aPacketTypes Bitmask of supported packets.

Bandwidth()

IMPORT_C TBTSyncBandwidth Bandwidth ( )

Return the negotiated bandwidth.

Baseband()

RBTBaseband & Baseband ( )

CancelAccept()

IMPORT_C void CancelAccept ( )

Cancel ability to respond to a remote request to set up a synchronous link. It is possible for a race condition to mean that a connection has been established, but as this call consumes the callback, for this fact not to reach the caller. For this reason, it may be desirable to follow a call to CancelAccept with a call to Disconnect. CBluetoothSynchronousLink::Disconnect

CancelReceive()

IMPORT_C void CancelReceive ( )

Cancel receiving data.

CancelSend()

IMPORT_C void CancelSend ( )

Cancel sending data.

CancelSetup()

IMPORT_C void CancelSetup ( )

Cancel creating a synchronous link. This cancels the asynchronous request to prevent the callback reaching the client. It makes no claims about the resultant state of the CBluetoothSynchronousLink . If a client wishes to continue using the CBluetoothSynchronousLink it is strongly recommended to follow a call to CancelSetup with a call to Disconnect, which will ensure that any established connection is tidied up. CBluetoothSynchronousLink::Disconnect

Coding()

IMPORT_C TUint16 Coding ( )

Return the air coding portion only of the coding specified on the link. See section 6.12 in Bluetooth Core Specification v1.2, Vol. 2, Part E.

ConstructL()

void ConstructL ( ) [private]

Disconnect()

IMPORT_C TInt Disconnect ( )

Disconnect a synchronous link.

The physical link will remain unless no other services are running on it.

ESCOSocket()

RSocket & ESCOSocket ( )

HandleAcceptConnectionCompleteL(TInt, TSCOType)

void HandleAcceptConnectionCompleteL ( TInt aErr,
TSCOType aSCOType
)

Parameters

TInt aErr
TSCOType aSCOType

HandleDisconnectionCompleteL(TInt)

void HandleDisconnectionCompleteL ( TInt aErr )

Parameters

TInt aErr

HandleReceiveCompleteL(TInt)

void HandleReceiveCompleteL ( TInt aErr )

Parameters

TInt aErr

HandleSendCompleteL(TInt)

void HandleSendCompleteL ( TInt aErr )

Parameters

TInt aErr

HandleSetupConnectionCompleteL(TInt, TSCOType)

void HandleSetupConnectionCompleteL ( TInt aErr,
TSCOType aSCOType
)

Parameters

TInt aErr
TSCOType aSCOType

Latency()

IMPORT_C TUint16 Latency ( )

Return the negotiated latency in miliseconds (rounded up if non-integer on the link).

LinkDown()

void LinkDown ( ) [private]

LinkUp(TBTDevAddr)

TInt LinkUp ( TBTDevAddr aAddr ) [private]

Parameters

TBTDevAddr aAddr

ListeningESCOSocket()

RSocket & ListeningESCOSocket ( )

ListeningSCOSocket()

RSocket & ListeningSCOSocket ( )

NewL(MBluetoothSynchronousLinkNotifier &, RSocketServ &)

IMPORT_C CBluetoothSynchronousLink * NewL ( MBluetoothSynchronousLinkNotifier & aNotifier,
RSocketServ & aServer
) [static]

Allocate and open a socket sub-session for Bluetooth SCO

capability
LocalServices

Parameters

MBluetoothSynchronousLinkNotifier & aNotifier Notifier object which will receive callbacks after asynchronous requests
RSocketServ & aServer Handle to a currently connected session on the socket server

NewLC(MBluetoothSynchronousLinkNotifier &, RSocketServ &)

IMPORT_C CBluetoothSynchronousLink * NewLC ( MBluetoothSynchronousLinkNotifier & aNotifier,
RSocketServ & aServer
) [static]

Allocate and open a socket sub-session for Bluetooth SCO

capability
LocalServices

Parameters

MBluetoothSynchronousLinkNotifier & aNotifier Notifier object which will receive callbacks after asynchronous requests
RSocketServ & aServer Handle to a currently connected session on the socket server

Notifier()

MBluetoothSynchronousLinkNotifier & Notifier ( )

Receive(TDes8 &)

IMPORT_C TInt Receive ( TDes8 & aData )

Receive data over synchronous link. It is worth noting that Bluetooth hardware may have dedicated pins to supply synchronous data, and the RSocket interface cannot provide the synchronous requirements of the SCO link. As a result of this, the CBluetoothSynchronousLink class may only provide the control plane of a SCO connection. In this situation, Receive returns KErrNotSupported via the MBluetoothSynchronousLinkNotifier::HandleReceiveCompleteL callback.

Parameters

TDes8 & aData

RemoteName(TSockAddr &)

IMPORT_C void RemoteName ( TSockAddr & aAddr )
Gets the socket address of the remote Bluetooth device.
panic
ESock_client 17 Raised when the link is not connected so there is no valid remote name to return.

Parameters

TSockAddr & aAddr The socket address.

RetransmissionEffort()

IMPORT_C TUint8 RetransmissionEffort ( )

Return an estimate of the retransmission policy on the link. Estimate is calculated by taking the size of the retransmission window, estimating the packet type based on packet length and calculating the number of packet retransmissions which are possible. This number is then returned by this function.

SCOSocket()

RSocket & SCOSocket ( )

Send(const TDesC8 &)

IMPORT_C TInt Send ( const TDesC8 & aData )

Send data over synchronous link. It is worth noting that Bluetooth hardware may have dedicated pins to supply synchronous data, and the RSocket interface cannot provide the synchronous requirements of the SCO link. As a result of this, the CBluetoothSynchronousLink class may only provide the control plane of a SCO connection. In this situation, Receive returns KErrNotSupported via the MBluetoothSynchronousLinkNotifier::HandleSendCompleteL callback.

Parameters

const TDesC8 & aData

SetCoding(TUint16)

IMPORT_C void SetCoding ( TUint16 aVoiceSetting )

Specify Voice Setting. See section 6.12 in Bluetooth Core Specification v1.2, Vol. 2, Part E.

Parameters

TUint16 aVoiceSetting

SetMaxBandwidth(TBTSyncBandwidth)

IMPORT_C void SetMaxBandwidth ( TBTSyncBandwidth aMaximum )

Specify maximum bandwidths in octets/second.

Parameters

TBTSyncBandwidth aMaximum

SetMaxLatency(TUint16)

IMPORT_C void SetMaxLatency ( TUint16 aLatency )

Specify maximum acceptable latency in milliseconds.

Parameters

TUint16 aLatency

SetNotifier(MBluetoothSynchronousLinkNotifier &)

IMPORT_C void SetNotifier ( MBluetoothSynchronousLinkNotifier & aNotifier )

Set the object to be notified of synchronous link events. This does not take ownership. This notifier will replace the current one.

SetRetransmissionEffort(TBTeSCORetransmissionTypes)

IMPORT_C void SetRetransmissionEffort ( TBTeSCORetransmissionTypes aRetransmissionEffort )

Specify link retransmission policy.

Parameters

TBTeSCORetransmissionTypes aRetransmissionEffort

SetupConnection(const TBTDevAddr &)

IMPORT_C TInt SetupConnection ( const TBTDevAddr & aDevAddr )

Create a synchronous link (e.g. voice) on an EXISTING physical link.

Parameters

const TBTDevAddr & aDevAddr Bluetooth address of remote device (specifying existing physical link)

SetupConnection(const TBTDevAddr &, const TUint16)

IMPORT_C TInt SetupConnection ( const TBTDevAddr & aDevAddr,
const TUint16 aPacketTypes
)

Create a synchronous link (e.g. voice) on an EXISTING physical link. TBTPacketType

Parameters

const TBTDevAddr & aDevAddr Bluetooth address of remote device (specifying existing physical link)
const TUint16 aPacketTypes Bitmask of the SCO packet types required on this connection Use only the three SCO specific packet type enums E.g. EPacketsHV1|EPacketsHV2|EPacketsHV3 (EAnySCOPacket) specifies all the three packet types are allowed. OR if ESCO is supported three ESCO specific packet type enums

SetupConnection(const TBTDevAddr &, const TBTSyncPackets &)

IMPORT_C TInt SetupConnection ( const TBTDevAddr & aDevAddr,
const TBTSyncPackets & aPacketTypes
)

Parameters

const TBTDevAddr & aDevAddr
const TBTSyncPackets & aPacketTypes

SocketServer()

RSocketServ & SocketServer ( )

UpdateLinkParams(TSCOType)

void UpdateLinkParams ( TSCOType aSCOType ) [private]

Parameters

TSCOType aSCOType

Member Data Documentation

CBTSynchronousLinkAccepter * iBTSynchronousLinkAccepterESCO

CBTSynchronousLinkAccepter * iBTSynchronousLinkAccepterESCO [private]

CBTSynchronousLinkAccepter * iBTSynchronousLinkAccepterSCO

CBTSynchronousLinkAccepter * iBTSynchronousLinkAccepterSCO [private]

CBTSynchronousLinkAttacher * iBTSynchronousLinkAttacherESCO

CBTSynchronousLinkAttacher * iBTSynchronousLinkAttacherESCO [private]

CBTSynchronousLinkAttacher * iBTSynchronousLinkAttacherSCO

CBTSynchronousLinkAttacher * iBTSynchronousLinkAttacherSCO [private]

CBTSynchronousLinkBaseband * iBTSynchronousLinkBaseband

CBTSynchronousLinkBaseband * iBTSynchronousLinkBaseband [private]

CBTSynchronousLinkDetacher * iBTSynchronousLinkDetacherESCO

CBTSynchronousLinkDetacher * iBTSynchronousLinkDetacherESCO [private]

CBTSynchronousLinkDetacher * iBTSynchronousLinkDetacherSCO

CBTSynchronousLinkDetacher * iBTSynchronousLinkDetacherSCO [private]

CBTSynchronousLinkReceiver * iBTSynchronousLinkReceiverESCO

CBTSynchronousLinkReceiver * iBTSynchronousLinkReceiverESCO [private]

CBTSynchronousLinkReceiver * iBTSynchronousLinkReceiverSCO

CBTSynchronousLinkReceiver * iBTSynchronousLinkReceiverSCO [private]

CBTSynchronousLinkSender * iBTSynchronousLinkSenderESCO

CBTSynchronousLinkSender * iBTSynchronousLinkSenderESCO [private]

CBTSynchronousLinkSender * iBTSynchronousLinkSenderSCO

CBTSynchronousLinkSender * iBTSynchronousLinkSenderSCO [private]

RBTBaseband iBaseband

RBTBaseband iBaseband [private]

TBuf8< 1 > iDummySCOShutdownDescriptor

TBuf8 < 1 > iDummySCOShutdownDescriptor [private]

RSocket iESCOSocket

RSocket iESCOSocket [private]

RSocket iListeningESCOSocket

RSocket iListeningESCOSocket [private]

RSocket iListeningSCOSocket

RSocket iListeningSCOSocket [private]

TBTeSCOLinkParams iNegotiatedLink

TBTeSCOLinkParams iNegotiatedLink [private]

MBluetoothSynchronousLinkNotifier * iNotifier

MBluetoothSynchronousLinkNotifier * iNotifier [private]

TBool iOpenedSCO

TBool iOpenedSCO [private]

TBool iOpeningESCO

TBool iOpeningESCO [private]

TBool iOpeningSCO

TBool iOpeningSCO [private]

TBTeSCOLinkParams iRequestedLink

TBTeSCOLinkParams iRequestedLink [private]

RSocket iSCOSocket

RSocket iSCOSocket [private]

TUint8 iSCOTypes

TUint8 iSCOTypes [private]

TBTSockAddr iSockAddr

TBTSockAddr iSockAddr [private]

RSocketServ & iSockServer

RSocketServ & iSockServer [private]