Dear Mike,
I implemented the functions as you suggested, but I have a problem: the following is the implementation I used for the OnInitialize() function
bool CBLEthread::OnInitialize()
{
wclBluetoothManager.Open();
FCharacteristics.clear();
FDescriptors.clear();
FServices.clear();
CwclBluetoothRadio* radio = GetRadio();
wclGattClient.SetAddress(0xcf1a325d9c9d);
wclGattClient.SetConnectOnRead(false);
int Res = wclGattClient.Connect(radio);
wclClientState a;
do
{
Sleep(500);
a = wclGattClient.GetState();
TRACE("GetState 0x%x\n", a);
} while(a != csConnected);
return true;
}
The function GetState, in the wait loop, returned the value 2=csConnecting but never the value 3=csConnected.
If instead I eliminate the wait loop, the connection is established but I don't know when the connection takes place.
I tried to use the hook to the function OnConnect
__hook(&CwclGattClient::OnConnect, &wclGattClient, &CBLEthread::wclBluetoothManagerOnConnect);
but the behavior is the same: the function OnConnect is called only when the wait loop ends.
how can i fix this problem?
Thanks
Marco