Share via


HCI Callbacks

Other versions of this page are also available for the following:

Windows Mobile Not SupportedWindows Embedded CE Supported

8/28/2008

The HCI_CALLBACKS structure declared in bt_ddi.h declares an entry point for each HCI command defined by the Bluetooth Core Specification. For more information about HCI commands, see the Host Controller Interface Functional Specification at this Official Bluetooth Wireless Info Web site.

Every _In command declared in HCI_INTERFACE has a corresponding _Out command that is declared in HCI_CALLBACKS.

The following code example shows the function pointer declaration for the callback, HCI_CreateConnection_Out of the HCI_CreateConnection_In command described in HCI Commands.

typedef int (*HCI_CreateConnection_Out)
   (void *pCallContext, 
   unsigned char status);

Callbacks can be divided into the following categories:

  • Callbacks that only return status information.
    Callbacks that are associated with commands that have an immediate effect and terminate with HCI_CommandCompleteEvent such as HCI_Inquiry, fall into this category. The following code example shows the function pointer declaration for the HCI_Inquiry callback.

    typedef int (*HCI_Inquiry_Out) (
    void          *pCallContext,
    unsigned char  status
    );
    

    Commands that terminate with HCI_CommandStatusEvent execute a boilerplate completion routine that only returns status information. If the status is success, the command terminates when the appropriate event is raised.

  • Callbacks that return data in addition to status information.
    The following code example shows a command that carries meaningful output values.

    typedef int (*HCI_ReadPINType_Out)(
    void          *pCallContext,
    unsigned char  status,
    unsigned char  PIN_type
    );
    

See Also

Other Resources

Host Controller Interface
Bluetooth OS Design Development
Bluetooth Protocol Stack