Bluetooth - Use of HCI layer
I am using Microsoft bluetooth stack and Windows Pocket PC 2003.
I need to handle bluetooth connection on a very low level. I tried to use HCI layer directly calling
HCI_EstablishDeviceContext method. It returns "The service has not been started" error. I need my device to report as device with some specific Code of Device. I am able to change COD using system bluetooth function, but i do not know how to accept connection on very low level.
Is it possible to use HCI layer directly ?
It's not my post, but I'll happly take his lead.
I'm interested in getting the connections' RSSI.
I'm trying to HCI_EstablishDeviceContext, but I'm missing something. I always get a 1062: "The service has not been started". Should I init something first?
Besides the code listed bellow, I also tried to use "in the hand"'s BluetoothDeviceInfo.Rssi Property and it fails. Is it possible for this property to fail but still be possible to get the RSSI from the HCI?
Thanks for you attention!
I've tried the following:
HCI_EVENT_INDICATION hei; {
memset(&
amp;hei,0,sizeof(HCI_EVENT_INDICATION));
hei.hci_StackEvent = _koch_bt_STACK_EVENT_IND; //pointer is ok
}
HCI_INTERFACE hi;
HCI_CALLBACKS hc; {
memset(&hc,0,sizeof(HCI_CALLBACKS));
hc.hci_CallAborted = _koch_bt_LAYER_CALL_ABORTED; //pointer is ok
hc.hci_ReadRSSI_Out = rssi_out; //pointer is ok
}
HANDLE phDeviceContext; {
memset(&phDeviceContext,0,sizeof(HANDLE));
}
int pcDataHeaders = 0;
int pcDataTrailers = 0;
int result = HCI_EstablishDeviceContext(
&g_hInst, //some global I had
0×00001000,
NULL,
0×00,
0×00,
&hei,
&hc,
&hi,
&pcDataHeaders,
&pcDataTrailers,
&phDeviceContext
);
if(result != ERROR_SUCCESS){
printf(”No luck: %d\n”, result); //always ends up here with a 1062: "The service has not been started"
}else{
printf(”Success!\n”, result);
HCI_CloseDeviceContext(phDeviceContext);
}