|
|
|
|
Location:
bt_sock.h
Link against: bluetooth.lib
class CBluetoothSocket : public CBase;
This allows Bluetooth ACL socket-based services to be run.
It allows all user-plane data flow to occur, plus control-plane Bluetooth baseband modification capabilities.
For a more detailed description of RBTBaseband functionality see the class and function documentation for RBTPhysicalLinkAdapter.
This class doesn't provide the functionality to directly activate Active mode (this is implementated in class RBTPhysicalLinkAdapter.)
CBase - Base class for all classes to be instantiated on the heapCBluetoothSocket - This allows Bluetooth ACL socket-based services to be runDefined in CBluetoothSocket:
Accept(), Accept(), ActivateBasebandEventNotifier(), ActivateParkRequester(), ActivateSniffRequester(), AllowLowPowerModes(), AllowRoleSwitch(), AsyncDelete(), AutomaticSniffMode(), Bind(), CancelAccept(), CancelAll(), CancelBasebandEventNotifier(), CancelConnect(), CancelIoctl(), CancelLowPowerModeRequester(), CancelRead(), CancelRecv(), CancelSend(), CancelWrite(), Connect(), Connect(), Connect(), GetDisconnectData(), GetOpt(), GetOpt(), Info(), Ioctl(), Ioctl(), Listen(), Listen(), Listen(), LocalName(), LocalPort(), Name(), NewL(), NewL(), NewL(), NewL(), NewL(), NewLC(), NewLC(), NewLC(), NewLC(), NewLC(), PhysicalLinkState(), PreventLowPowerModes(), PreventRoleSwitch(), Read(), Recv(), Recv(), RecvFrom(), RecvFrom(), RecvOneOrMore(), RemoteName(), RequestChangeSupportedPacketTypes(), RequestMasterRole(), RequestSlaveRole(), Send(), Send(), SendTo(), SendTo(), SetAutomaticSniffMode(), SetAutomaticSniffMode(), SetLocalPort(), SetNotifier(), SetOpt(), SetOpt(), SetOption(), Shutdown(), Shutdown(), Transfer(), Write(), ~CBluetoothSocket()
Inherited from CBase:
Delete(),
Extension_(),
operator new()
| Capability: | LocalServices |
static IMPORT_C CBluetoothSocket *NewL(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, TUint aSockType, TUint aProtocol);
A session on the socket server has been started.
Standard Bluetooth socket NewL constructor.
Opens a Bluetooth socket. The constructor identifies the server, socket type, and bluetooth protocol to be used for the socket, as well as an asynchronous notifier.
|
|
|
| Capability: | LocalServices |
static IMPORT_C CBluetoothSocket *NewLC(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, TUint aSockType, TUint aProtocol);
Standard Bluetooth socket NewLC constructor.
Opens a Bluetooth socket as with the NewL() above, but leaves the returned CBluetoothSocket object on the cleanup stack.
|
|
| Capability: | LocalServices |
static IMPORT_C CBluetoothSocket *NewL(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, TUint aSockType, TUint aProtocol, RConnection &aConnection);
A session on the socket server has been started.
Opens a Bluetooth socket on a specified connection.
|
|
|
| Capability: | LocalServices |
static IMPORT_C CBluetoothSocket *NewLC(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, TUint aSockType, TUint aProtocol, RConnection &aConnection);
This constructor opens a Bluetooth socket on a specified connection.
Leaves the socket on the cleanup stack.
|
|
| Capability: | LocalServices |
static IMPORT_C CBluetoothSocket *NewL(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, const TDesC &aName);
A session on the socket server has been started.
Bluetooth socket named protocol NewL() constructor.
Opens a Bluetooth socket over a specified named protocol, such as "L2CAP".
|
|
|
| Capability: | LocalServices |
static IMPORT_C CBluetoothSocket *NewLC(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, const TDesC &aName);
Bluetooth socket named protocol NewLC() constructor.
Opens a Bluetooth socket over a specified named protocol, such as "L2CAP". Leaves returned CBluetoothSocket object on the cleanup stack.
|
|
static IMPORT_C CBluetoothSocket *NewL(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer);
A session on the socket server has been started.
Bluetooth blank socket NewL() constructor.
Opens a blank socket to be used when accepting an incoming connection. This socket should be used as the parameter when a listening socket calls CBluetoothSocket::Accept(CBluetoothSocket& aBlankSocket). When that connection completes this blank socket becomes the Bluetooth socket for that connection.
|
|
|
static IMPORT_C CBluetoothSocket *NewLC(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer);
A session on the socket server has been started.
Bluetooth blank socket NewLC() constructor
Opens a blank socket to be used when accepting an incoming connection. This socket should be used as the parameter when a listening socket calls CBluetoothSocket::Accept(CBluetoothSocket& aBlankSocket). When that connection completes this blank socket becomes the Bluetooth socket for that connection.
Leaves returned CBluetoothSocket object on the cleanup stack.
|
|
|
static IMPORT_C CBluetoothSocket *NewL(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, RSocket &aSocket);
A session on the socket server has been started, and aSocket is open and is set as "Transferable" through the KSOEnableTransfer SetOpt.
Bluetooth socket using an existing RSocket instance constructor.
Takes ownership of an existing socket to be used as the underlying connection for this Socket wrapper. This should be used where an existing API returned a RSocket representing a Bluetooth connection.
|
|
|
static IMPORT_C CBluetoothSocket *NewLC(MBluetoothSocketNotifier &aNotifier, RSocketServ &aServer, RSocket &aSocket);
A session on the socket server has been started, and aSocket is open and is set as "Transferable" through the KSOEnableTransfer SetOpt.
Bluetooth socket using an existing RSocket instance constructor.
Takes ownership of an existing socket to be used as the underlying connection for this Socket wrapper. This should be used where an existing API returned a RSocket representing a Bluetooth connection.
Leaves returned CBluetoothSocket object on the cleanup stack.
|
|
|
IMPORT_C ~CBluetoothSocket();
Destructor
Cancels any outstanding Bluetooth socket functions and closes the socket. Note sockets should be closed or shutdown before destructor is called.
IMPORT_C TInt Send(const TDesC8 &aDesc, TUint someFlags);
Sends data to a remote bluetooth device.
The Send() operation checks that another Send() operation isn't already in progress before sending.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleSendCompleteL(TInt aErr).
If Automatic Sniff Mode is active, using this function will not automatically put the link into active mode. If it is required that the link be taken out of sniff mode automatically when data is to be sent then the CBluetoothSocket::Write(const TDesC8& aDesc) function should be used instead.
|
|
IMPORT_C TInt Send(const TDesC8 &aDesc, TUint someFlags, TSockXfrLength &aLen);
Sends data to a remote bluetooth device.
The Send() operation checks that another Send() operation isn't already in progress before sending.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleSendCompleteL(TInt aErr)
If Automatic Sniff Mode is active, using this function will not automatically put the link into active mode. If it is required that the link be taken out of sniff mode automatically when data is to be sent then the CBluetoothSocket::Write(const TDesC8& aDesc) function should be used instead.
|
|
IMPORT_C void CancelSend();
Cancels an outstanding Bluetooth Send() operation.
Calling the function will cause an outstanding Bluetooth Send() operation to complete prematurely.
IMPORT_C TInt Recv(TDes8 &aDesc, TUint flags);
Receives data from a remote Bluetooth device.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleReceiveCompleteL(TInt aErr)
|
|
IMPORT_C TInt Recv(TDes8 &aDesc, TUint flags, TSockXfrLength &aLen);
Receives data from a remote Bluetooth device.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleReceiveCompleteL(TInt aErr)
|
|
IMPORT_C TInt RecvOneOrMore(TDes8 &aDesc, TUint flags, TSockXfrLength &aLen);
Receives data from a remote Bluetooth device, completing when data is available.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleReceiveCompleteL(TInt aErr).
|
|
IMPORT_C void CancelRecv();
Cancels an outstanding Recv() operation.
Calling this function will cause any outstanding receive operation to cancel.
IMPORT_C TInt Read(TDes8 &aDesc);
Receives data from a remote Bluetooth host.
Read() is only used with a connected Bluetooth host.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleReceiveCompleteL(TInt aErr)
|
|
IMPORT_C void CancelRead();
Cancels an outstanding Read() operation.
Calling this function will cause any outstanding Read() operation to cancel.
IMPORT_C TInt Write(const TDesC8 &aDesc);
Writes to a remote Bluetooth device
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleSendCompleteL(TInt aErr)
If Automatic Sniff Mode is active on this socket instance, then upon calling this function the link will be put into active mode. If no CBluetoothSocket::Write() calls are made for a period of the timeout specified during activation of the automatic sniffing then the link will be put back into sniff mode.
|
|
IMPORT_C void CancelWrite();
Cancels an outstanding Write() operation.
Calling this operation will cause any outstanding Write() operation to cancel.
IMPORT_C TInt SendTo(const TDesC8 &aDesc, TSockAddr &aSockAddr, TUint flags);
Sends the aDesc data to the aAddr specified and applies the flags indicated to the operation.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleSendCompleteL(TInt aErr)
If Automatic Sniff Mode is active, using this function will not automatically put the link into active mode. If it is required that the link be taken out of sniff mode automatically when data is to be sent then the CBluetoothSocket::Write(const TDesC8& aDesc) function should be used instead.
|
|
IMPORT_C TInt SendTo(const TDesC8 &aDesc, TSockAddr &aSockAddr, TUint flags, TSockXfrLength &aLen);
Sends the aDesc data to the aAddr specified and applies the flags indicated to the operation.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleSendCompleteL(TInt aErr)
If Automatic Sniff Mode is active, using this function will not automatically put the link into active mode. If it is required that the link be taken out of sniff mode automatically when data is to be sent then the CBluetoothSocket::Write(const TDesC8& aDesc) function should be used instead.
|
|
IMPORT_C TInt RecvFrom(TDes8 &aDesc, TSockAddr &aSockAddr, TUint flags);
Receives aDesc data from the named remote aAddr Bluetooth device using the flags indicated.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleReceiveCompleteL(TInt aErr)
|
|
IMPORT_C TInt RecvFrom(TDes8 &aDesc, TSockAddr &aSockAddr, TUint flags, TSockXfrLength &aLen);
Receives aDesc data from the named remote aAddr Bluetooth device using the flags indicated.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleReceiveCompleteL(TInt aErr)
|
|
IMPORT_C TInt Connect(TBTSockAddr &aSockAddr);
Opens a connection to a specific Bluetooth device by its address.
The address represents the address of the remote Bluetooth device. A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready to send or receive data. If a socket is unbound - i.e. Bind() has not been called yet - then it will automatically have a local address allocated.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleConnectCompleteL(TInt aErr)
|
|
IMPORT_C TInt Connect(TBTSockAddr &aSockAddr, const TDesC8 &aConnectDataOut, TDes8 &aConnectDataIn);
Connects to a remote Bluetooth device by address with a defined data-out and data-in descriptor.
The address provided specifies the address of the remote Bluetooth host. Data can be sent in connect request packets, which may be provided in the data-out descriptor, or connect responses, which may be collected in the data-in descriptor.
A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready to send or receive data. If a socket is unbound - i.e. Bind() has not been called yet - then it will automatically have a local address allocated.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleConnectCompleteL(TInt aErr).
|
|
IMPORT_C TInt Connect(TBTSockAddr &aAddr, TUint16 aServiceBits);
Sets the Service bits in the Class Of Device. If this is successful, the socket then opens a connection to a specific Bluetooth device by its address.
The address represents the address of the remote Bluetooth device. A socket may only have one connect operation outstanding at any one time. Once the connect is completed, the socket is ready to send or receive data. If a socket is unbound - i.e. Bind() has not been called yet - then it will automatically have a local address allocated.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleConnectCompleteL(TInt aErr)
|
|
IMPORT_C TInt Bind(TSockAddr &aSockAddr);
Sets a Bluetooth socket address.
Sets the local address of a socket. When a socket is opened it has no name associated with it, and binding is required so data can be routed to the socket. Bind() should be called before Listen() or Connect().
|
|
IMPORT_C TInt SetLocalPort(TInt aPort);
Sets the local port of a Bluetooth socket.
Setting the local port is equivalent to calling Bind() with only the port set in the address.
|
|
IMPORT_C TInt Accept(CBluetoothSocket &aBlankSocket);
Accepts a connection from a remote Bluetooth socket.
The call extracts the first pending connection on a queue of sockets, the queue size being previously specified by Listen(). On successful completion the blank socket is given the handle of the new socket and it may then be used to transfer data. After completion the accept socket may be used to make further connections with new blank sockets (see Open() on how to open a blank socket).
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleAcceptCompleteL(TInt aErr)
|
|
IMPORT_C TInt Accept(CBluetoothSocket &aBlankSocket, TDes8 &aConnectData);
Reserved for future.
|
|
IMPORT_C TInt Listen(TUint qSize);
Sets up a socket to listen for incoming connections.
Before calling this procedure a socket should be opened using Open() and be bound to a local address using Bind().
Listen() creates a queue to hold incoming connections which can be married with blank sockets using Accept().
Once a listen queue has been created it will continue to allow peers to connect until it is full, at which point it will reject any incoming connections as specified by protocol behaviour. When a socket is accepted by the client a space is made available in the queue.
|
|
IMPORT_C TInt Listen(TUint qSize, const TDesC8 &aConnectData);
Reserved for future.
|
|
IMPORT_C TInt Listen(TUint qSize, TUint16 aServiceBits);
Sets the Service bits in the Class Of Device. If this is successful, the socket will then be set to Listen for incoming connections.
Before calling this procedure a socket should be opened using Open() and be bound to a local address using Bind().
Listen() creates a queue to hold incoming connections which can be married with blank sockets using Accept().
Once a listen queue has been created it will continue to allow peers to connect until it is full, at which point it will reject any incoming connections as specified by protocol behaviour. When a socket is accepted by the client a space is made available in the queue.
|
|
IMPORT_C TInt SetOpt(TUint aOptionName, TUint aOptionLevel, TInt aOption);
Sets a socket option.
The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be set with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
IMPORT_C TInt SetOption(TUint aOptionName, TUint aOptionLevel, const TDesC8 &aOption);
Sets a socket option.
The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be set with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
IMPORT_C TInt GetOpt(TUint aOptionName, TUint aOptionLevel, TDes8 &aOption);
Gets a socket option.
The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be got with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
IMPORT_C TInt GetOpt(TUint aOptionName, TUint aOptionLevel, TInt &aOption);
Gets a socket option.
The socket server has options which are generic to all sockets and protocols may add specific options.
Options available for all protocols can be got with anOptionLevel set to KSOLSocket. See individual protocol notes for other socket options.
|
|
IMPORT_C TInt Ioctl(TUint aLevel, TUint aCommand, TDes8 *aDesc);
Applies an asynchronous control operation on a socket.
Data may be passed and received if a descriptor address is provided as an argument. Only one Ioctl() operation may be outstanding for each socket.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleIoctlCompleteL(TInt aErr)
|
|
IMPORT_C void CancelIoctl();
Cancels the Ioctl() asynchronous control operation.
IMPORT_C TInt GetDisconnectData(TDes8 &aDesc);
|
|
IMPORT_C void LocalName(TSockAddr &aSockAddr);
Gets the local address of a socket.
The local address is set either by calling Bind() or it is automatically set when Connect() is called. If a socket is created through Accept() then a socket will inherit the port of its parent unless otherwise specified by a protocol's behaviour.
|
IMPORT_C TUint LocalPort();
Gets the local port of a socket.
Similar to LocalName().
|
IMPORT_C void RemoteName(TSockAddr &aSockAddr);
Gets the remote address of a socket.
The remote name (address) of a socket is associated with the remote host the socket is connected to. The remote name is only valid for a connected socket. A socket is either connected through calling Connect() or Accept().
|
IMPORT_C TInt Shutdown(RSocket::TShutdown aHow);
Shuts down a connected socket. (The socket cannot be null. The shutdown method allows input and output to be individually stopped for a protocol endpoint.
When this request completes, notification is sent to the MBluetoothSocketNotifier object supplied when this CBluetoothSocket was constructed. This is done in the function MBluetoothSocketNotifier::HandleShutdownCompleteL(TInt aErr)
|