Export (0) Print
Expand All

Bluetooth Packet Buffering and Fragmentation (Windows Embedded CE 6.0)

1/6/2010

Data packets are sent to the HCI layer by using theHCI_DataPacketDown_In interface and the HCI_DataPacketDown_Out callback function.

The following code shows the function pointer declarations for HCI_DataPacketDown_In and HCI_DataPacketDown_Out.

typedef int (*HCI_DataPacketDown_In) (
  HANDLE         hDeviceContext,
  void          *pCallContext,
  unsigned short connection_handle,
  BD_BUFFER     *pBuffer
);
typedef int (*HCI_DataPacketDown_Out) (
  void    *pCallContext,
  int      iError
);

Both data and command packets are placed in the HCI queue. The upper layers of the Bluetooth stack do not control data packet fragmentation, which occurs automatically.

To reassemble data on the way up, it is required that the size of the total packet is known. If the protocol follows the L2CAP packet format ( the data is length-prefixed), then reassembly is handled by the HCI, and the packet is delivered. Reassembled data packets are notified by the HCI by using the HCI_DataPacketUp event.

The following code shows the function pointer declaration for HCI_DataPacketUp.

typedef int (*HCI_DataPacketUp) (
  void             *pUserContext,
  unsigned short    connection_handle,
  BD_BUFFER        *pBuffer
);

To indicate pre-reassembly data packets, the HCI uses the HCI_DataPacketUpAclUnbuffered event. However, if upper interface exposes the HCI_DataPacketUpAclUnbuffered, it is expected to handle the buffering of incoming asynchronous connection-less (ACL) packets, which will be reported to it immediately. In this case, there are no restrictions on the packet format.

The following code shows the function pointer declaration for HCI_DataPacketUpAclUnbuffered.

typedef int (*HCI_DataPacketUpAclUnbuffered) (
  void             *pUserContext,
  unsigned short    connection_handle,
  unsigned char     boundary,
  unsigned char     broadcast,
  BD_BUFFER        *pBuffer
);

See Bt_ddi.h for complete specifications of the HCI interface.

Community Additions

ADD
Show:
© 2014 Microsoft