Issuing Hardware-Dependent Commands through HCI (Windows Embedded CE 6.0)
1/6/2010
The HCI can be used to issue a hardware-dependent command by using the PacketMarker structure.
This structure is used do a select command if it is differentiated by some of its parameters. For example, if there are five outstanding HCI_CreateConnection commands to different Bluetooth devices, then for each command, PacketMarker contains a BTH_MARKER_ADDRESS and the address of the target device.
PacketMarker is used in conjunction with the HCI_CustomCode_In interface to match its asynchronous event with the command itself. Use HCI_CustomCode_In with caution, because issuing commands through a command-specific interface can have a side effect not created by a HCI_CustomCode_In command.
The following code example shows PacketMarker definition and the function pointer declaration for HCI_CustomCode_In.
#define BTH_MARKER_NONE 0
#define BTH_MARKER_CONNECTION 1
#define BTH_MARKER_ADDRESS 2
typedef struct _packet_marker {
unsigned int fMarker;
union {
BD_ADDR ba;
unsigned short connection_handle;
};
} PacketMarker;
typedef int (*HCI_CustomCode_In) (
HANDLE hDeviceContext,
void *pCallContext,
unsigned short usOpCode,
unsigned short cPacketSize,
unsigned char *pPacket,
PacketMarker *pMarker,
unsigned char cEvent
);