HCI_EstablishDeviceContext (Windows CE 5.0)
This function is used to establish a connection to HCI stack layer.
Int HCI_EstablishDeviceContext( Void* pUserContext, UINT uiControl, BD_ADDR* pba, UINT class_of_device, UCHAR link_type, HCI_EVENT_INDICATION* pInd, HCI_CALLBACKS* pCall, HCI_INTERFACE* pInt, int* pcDataHeaders, int* pcDataTrailers, HANDLE* phDeviceContext );
- [in] Pointer to the user context information. It is used in asynchronous event indications.
- [in] Defines which filter to use, as shown in the following table.
Filter Value BTH_CONTROL_ROUTE_ALL 0x00000001 BTH_CONTROL_DEVICEONLY 0x00001000
The value can also be a combination of the following filters.
Filter Value BTH_CONTROL_ROUTE_BY_ADDR 0x00000010 BTH_CONTROL_ROUTE_BY_COD 0x00000020 BTH_CONTROL_ROUTE_BY_LINKTYPE 0x00000040 BTH_CONTROL_ROUTE_HARDWARE 0x00000100 BTH_CONTROL_ROUTE_SECURITY 0x00000080
- [in] Pointer to the Bluetooth device address, if BTH_CONTROL_ROUTE_BY_ADDR.
- [in] Device class, if BTH_CONTROL_ROUTE_BY_COD.
- [in] Link type, if BTH_CONTROL_ROUTE_BY_LINKTYPE.
- [in] Pointer to the event interface table.
- [in] Pointer to the callback table.
- [out] Pointer to HCI command interface table.
- [out] Size of data headers used internally by HCI to be pre-allocated in data packets.
- [out] Size of data trailers used internally by HCI to be pre-allocated in data packets.
- [out] Pointer to the device context handle.
ERROR_SUCCESS indicates successful completion.
If the stack wants to only accept connections from one device, it issues BTH_CONTROL_ROUTE_BY_ADDR and provides a pointer to pba. If it is prepared to accept only SCO connections, it provides the appropriate link_type and BTH_CONTROL_ROUTE_BY_LINKTYPE. The same hold true for class of device.
BTH_CONTROL_ROUTE_SECURITY is specifically implemented to support security manager layers. If a layer installs itself with this flag, the link key/pin requests for all connections are forwarded to it.
BTH_CONTROL_ROUTE_ALL is reserved for the default handler. Only one stack layer can be a default handler. In the Bluetooth stack, this role is handled by L2CAP.
BTH_CONTROL_ROUTE_DEVICEONLY is specifically reserved for management layers that do not accept incoming connections at all. There may be more than one of these.
Every event that is generated by Bluetooth hardware — such as a connection request, command completion event, or command status event — is routed to the stack layer that specifies it in the StackEvent call.
Output parameters pcDataHeaders and pcDataTrailers define how many bytes must be reserved in the data packet by upper layer for HCI level protocol headers and trailers. Incoming data packets must have BD_BUFFER::cStart to be set to *pcDataHeaders, and BD_BUFFER::cEnd to be equal to BD_BUFFER::cSize - *pcDataHeaders.
OS Versions: Windows CE .NET 4.0 and later.
Link Library: Btd.lib.
Send Feedback on this topic to the authors