Symbian
Symbian Developer Library

SYMBIAN OS V9.4

Feedback

[Index] [Previous] [Next]

#include <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:

Inherited from CBase:


Construction and destruction


NewL(MBluetoothSynchronousLinkNotifier &,RSocketServ &)

Capability: LocalServices

IMPORT_C static 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(MBluetoothSynchronousLinkNotifier &,RSocketServ &)

Capability: LocalServices

IMPORT_C static 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(const TBTDevAddr &)

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(const TBTDevAddr &,const TUint16)

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

Return value

TInt

Error code


SetupConnection(const TBTDevAddr &,const TBTSyncPackets &)

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.

See also:


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(const TDesC8 &)

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(TInt) callback.

Parameters

const TDesC8 &aData

Return value

TInt

Error code


CancelSend()

IMPORT_C void CancelSend();

Description

Cancel sending data.


Receive(TDes8 &)

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(TInt) 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(const TBTSyncPackets &)

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


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.

See also:


SetCoding(TUint16)

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(TBTSyncBandwidth)

IMPORT_C void SetMaxBandwidth(TBTSyncBandwidth aMaximum);

Description

Specify maximum bandwidths in octets/second.

Parameters

TBTSyncBandwidth aMaximum


SetMaxLatency(TUint16)

IMPORT_C void SetMaxLatency(TUint16 aLatency);

Description

Specify maximum acceptable latency in milliseconds.

Parameters

TUint16 aLatency


SetRetransmissionEffort(TBTeSCORetransmissionTypes)

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(TSockAddr &)

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(MBluetoothSynchronousLinkNotifier &)

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