Bluetooth Class of Device - KBA230689

Version 2

    Author: AnjanaM_61       Version: **

    Question:
    How do I set Bluetooth Class of Device for BTBLE chips

     

    Answer:

     

    What is Bluetooth Class of Device?

    Bluetooth Class of Device is a parameter received during the device discovery procedure on the BR/EDR physical transport, indicating the type of device. The Class of Device parameter is only used on BR/EDR and BR/EDR/LE devices using the BR/EDR physical transport. It is also called as Bluetooth CoD.

    The Bluetooth CoD is made up of Major Service Class, Major Device Class, and Minor Service Class designations. A detailed list of CoD bit details as well as links to other Bluetooth related specifications can be found on the Bluetooth Special Interest Group’s website: https://www.bluetooth.com/specifications/assigned-numbers/baseband/

    The Bluetooth CoD is typically displayed in hex; however it is formulated using binary. There are so many third-party converter tools available to convert hex to binary and binary to hex to figure out Bluetooth CoD of your device or peer device.

     

    How to set Bluetooth CoD?

    The Bluetooth CoD is always 24 bits. For our BT chips, we can set it in the SDK application code by setting the wiced_bt_dev_class_t parameter of wiced_bt_cfg_settings_t structure.

    Example:

    Suppose the CoD hex value is 0x000104 (Binary 000000000000000100000100), then you must set the device class parameter of wiced_bt_cfg_settings_t as below

     

    const wiced_bt_cfg_settings_t wiced_bt_cfg_settings =

    {

    :

    .device_class= {0x00, 0x01, 0x04},

    :

    }

     

    How to get CoD of peer BT device?

    Peer device class is one of the event parameters for BTM_PIN_REQUEST_EVT.

    For new chips like CYW20719B2, CYW20721B2, a new API has been added in the SDK to get the Class of Device (CoD) of a peer device.

     

    Note that the CoD of a peer device is received when the FHS packet of the peer device is received. The FHS packet of a peer device is received during Inquiry or during Incoming connection. If the CoD of a peer device is unknown, the API will return a
    CoD = 00 00 00.

    The prototype of the API is:

    wiced_result_t wiced_bt_dev_get_device_class(wiced_bt_device_address_t bdaddr, wiced_bt_dev_class_t *p_class_of_device);

     

    References:

    Community: https://community.cypress.com/message/211034#211034

    BT Core Spec: https://www.bluetooth.com/specifications/bluetooth-core-specification/