Symbian
Symbian OS Library

SYMBIAN OS V9.3

[Index] [Spacer] [Previous] [Next]



Location: bt_sock.h
Link against: bluetooth.lib

Class CBluetoothSynchronousLink

class CBluetoothSynchronousLink : public CBase;

Description

Provides Bluetooth SCO functionality.

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

Derivation

Members

Defined in CBluetoothSynchronousLink:
AcceptConnection(), AcceptConnection(), Bandwidth(), CancelAccept(), CancelReceive(), CancelSend(), CancelSetup(), Coding(), Disconnect(), Latency(), NewL(), NewLC(), Receive(), RemoteName(), RetransmissionEffort(), Send(), SetCoding(), SetMaxBandwidth(), SetMaxLatency(), SetNotifier(), SetRetransmissionEffort(), SetupConnection(), SetupConnection(), SetupConnection(), ~CBluetoothSynchronousLink()

Inherited from CBase:
Delete(), Extension_(), operator new()


Construction and destruction


NewL()

Capability: LocalServices

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

Description

Allocate and open a socket sub-session for Bluetooth SCO

Parameters

MBluetoothSynchronousLinkNotifier &aNotifier

Notifier object which will receive callbacks after asynchronous requests

RSocketServ &aServer

Handle to a currently connected session on the socket server

Return value

CBluetoothSynchronousLink *

Newly allocated CBluetoothSynchronousLink object


NewLC()

Capability: LocalServices

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

Description

Allocate and open a socket sub-session for Bluetooth SCO

Parameters

MBluetoothSynchronousLinkNotifier &aNotifier

Notifier object which will receive callbacks after asynchronous requests

RSocketServ &aServer

Handle to a currently connected session on the socket server

Return value

CBluetoothSynchronousLink *

Newly allocated CBluetoothSynchronousLink object


~CBluetoothSynchronousLink()

IMPORT_C ~CBluetoothSynchronousLink();

Description

Destructor

[Top]


Member functions


SetupConnection()

IMPORT_C TInt SetupConnection(const TBTDevAddr &aDevAddr);

Description

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)

Return value

TInt

Error code


SetupConnection()

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

Description

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)

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 E.g. ESyncPacketsEV3|ESyncPacketsEV4|ESyncPacketsEV5 (EAnyESCOPacket)

Return value

TInt

Error code

See also:


SetupConnection()

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

Description

Parameters

const TBTDevAddr &aDevAddr

const TBTSyncPackets &aPacketTypes

Return value

TInt


CancelSetup()

IMPORT_C void CancelSetup();

Description

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.


Disconnect()

IMPORT_C TInt Disconnect();

Description

Disconnect a synchronous link.

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

Return value

TInt

Error code


Send()

IMPORT_C TInt Send(const TDesC8 &aData);

Description

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

Return value

TInt

Error code


CancelSend()

IMPORT_C void CancelSend();

Description

Cancel sending data.


Receive()

IMPORT_C TInt Receive(TDes8 &aData);

Description

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

Return value

TInt

Error code


CancelReceive()

IMPORT_C void CancelReceive();

Description

Cancel receiving data.


AcceptConnection()

IMPORT_C TInt AcceptConnection();

Description

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.

Return value

TInt

Error code


AcceptConnection()

IMPORT_C TInt AcceptConnection(const TBTSyncPackets &aPacketTypes);

Description

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.

Parameters

const TBTSyncPackets &aPacketTypes

Bitmask of supported packets.

Return value

TInt

Error code

See also:


CancelAccept()

IMPORT_C void CancelAccept();

Description

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.


SetCoding()

IMPORT_C void SetCoding(TUint16 aVoiceSetting);

Description

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

Parameters

TUint16 aVoiceSetting


SetMaxBandwidth()

IMPORT_C void SetMaxBandwidth(TBTSyncBandwidth aMaximum);

Description

Specify maximum bandwidths in octets/second.

Parameters

TBTSyncBandwidth aMaximum


SetMaxLatency()

IMPORT_C void SetMaxLatency(TUint16 aLatency);

Description

Specify maximum acceptable latency in milliseconds.

Parameters

TUint16 aLatency


SetRetransmissionEffort()

IMPORT_C void SetRetransmissionEffort(TBTeSCORetransmissionTypes aRetransmissionEffort);

Description

Specify link retransmission policy.

Parameters

TBTeSCORetransmissionTypes aRetransmissionEffort


Coding()

IMPORT_C TUint16 Coding();

Description

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.

Return value

TUint16


Bandwidth()

IMPORT_C TBTSyncBandwidth Bandwidth();

Description

Return the negotiated bandwidth.

Return value

TBTSyncBandwidth


Latency()

IMPORT_C TUint16 Latency();

Description

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

Return value

TUint16


RetransmissionEffort()

IMPORT_C TUint8 RetransmissionEffort();

Description

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.

Return value

TUint8


RemoteName()

IMPORT_C void RemoteName(TSockAddr &aAddr);

Description

Gets the socket address of the remote Bluetooth device.

Parameters

TSockAddr &aAddr

The socket address.

Panic codes

ESock_client

17 Raised when the link is not connected so there is no valid remote name to return.


SetNotifier()

IMPORT_C void SetNotifier(MBluetoothSynchronousLinkNotifier &aNotifier);

Description

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

Parameters

MBluetoothSynchronousLinkNotifier &aNotifier