Performing Low-level Configuration

The Bluetooth specification defines commands and options that can be used with the various layers of the protocol.

How to perform low-level configuration

The Bluetooth Sockets API provides some of the commands and options for configuring Sockets at various layers as described below:

Socket Configuration Options

The following Socket configuration options are provided by the Bluetooth Sockets API:

  1. Host Controller Interface (HCI) commands : provide a command interface to the baseband controller and link manager. These are provided through asynchronous I/O control (ioctl) commands on an L2CAP or RFCOMM socket, as there is no direct Symbian platform interface to the HCI. Ioctls are issued through RSocket::Ioctl() . For details, see the reference for the KHCIxxx constants, such as KHCIAddSCOConnIoctl .

  2. L2CAP-level options : these are also issued through ioctls on an L2CAP socket. For details, see the reference for the KL2CAPxxx constants, such as KL2CAPEchoRequestIoctl .

  3. RFCOMM commands and options : these are issued through ioctls on an RFCOMM socket, and sockets option settings ( RSocket::GetOpt() and RSocket::GetOpt() ). For details, see the reference for the KRFCOMMxxx constants, such as KRFCOMMModemStatusCmdIoctl .

Example: Reading L2CAP Socket Class of Device

The following example shows the HCI command Read_Class_of_Device being issued on an L2CAP socket. The ioctl for this is KHCIReadDeviceClassIoctl , which returns a THCIDeviceClassIoctl object packaged in a THCIDeviceClassBuf package buffer. The example extracts the device class into a variable majorClass .

       
        
       
       THCIDeviceClassBuf codbuf;
TRequestStatus status;
socket.Ioctl(KHCIReadDeviceClassIoctl, status, &codbuf, KSolBtHCI);
User::WaitForRequest(status);
TUint16 majorClass = codbuf().iMajorDeviceClass;
      

Where Next?

This tutorial set takes you through all the steps involved in setting up and communicating over a Bluetooth connection.