Recent Posts

Pages: 1 ... 8 9 [10]
91
Bluetooth Framework / Re: wclThread c++ example
« Last post by MFC on November 15, 2021, 04:22:26 PM »
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


92
Bluetooth Framework / Re: wclThread c++ example
« Last post by Mike Petrichenko on November 10, 2021, 05:45:57 PM »
Hello,

Unfortunately there is no example however usage the class is very simple.

Create descendant class and override 2 methods: OnInitialize() and OnTerminate(). Inside OnInitialize() create GattClient and start connection. Inside OnTerminate() call disconnect.

From the main thread create your class and call Run() to start thread and Terminate() to stop thread.
93
Bluetooth Framework / wclThread c++ example
« Last post by MFC on November 10, 2021, 04:58:25 PM »
Where can I find an example on how to use wclThread (I'm using the C++ Edition)? (I would like to use the functions of CwclGattClient inside a thread)

Thanks
Marco
94
Bluetooth Framework / Re: Discovering BLE Device with Bluetooth Manager Demo
« Last post by Mike Petrichenko on October 23, 2021, 05:02:36 AM »
Internally LE discovering implemented through BeaconWatcher (Windows and Bluetooth Framework). If you run Discover for BLE devices (not for Classic) and your device has Discoverable flag set - it should be discovered by BluetoothManager demo. If the device has not Discoverable flag set BluetoothManager will not find it.
95
Bluetooth Framework / Re: Discovering BLE Device with Bluetooth Manager Demo
« Last post by briandunham on October 23, 2021, 04:59:10 AM »
My laptop can discovery my unpaired smartphone through the Windows 10 Bluetooth settings. So shouldn't the Bluetooth Manager Demo (running on that same laptop) be able to discovery my smartphone also?
96
Bluetooth Framework / Re: Discovering BLE Device with Bluetooth Manager Demo
« Last post by Mike Petrichenko on October 22, 2021, 05:16:19 AM »
Hello,

It depends on how your smartphone advertises. The Discover() shows only devices that have Discoverable flags set.

For LE devices its better to use BeaconWatcher.
97
Bluetooth Framework / Discovering BLE Device with Bluetooth Manager Demo
« Last post by briandunham on October 22, 2021, 01:55:43 AM »
When using the Bluetooth Manager Demo, I am not able to discover a specific BLE device (Galaxy S9 smartphone). However, I can get it to show up in the list once I manually pair the devices either through the Windows 10 Bluetooth settings or through my smartphones settings. Why is it that the demo application can discover other unpaired BLE devices but can only discover my smartphone once it is paired?
98
Bluetooth Framework / Re: Subscribe and event receiving data
« Last post by Mike Petrichenko on September 30, 2021, 07:27:45 PM »
Yes, use RemotePair method to pair with your device. With lot of devices it is better to pair after connect. However, some device may require pairing before connect. So it depends on your device. Try pair after connect first and if it does not work, try pair before connect. Also, if your device has random MAC do not forget to unpair after disconnect and pair again when next time connect to device because its MAC changed.
99
Bluetooth Framework / Re: Subscribe and event receiving data
« Last post by gn_torino on September 30, 2021, 07:24:36 PM »
OK, thanks a lot.
If I pair with my OS (Windows) it works.
To pairing it with the method , should I call RemotePairing before of after the connect Method ?

If I use both I receive a connected and disconnected event one just after the other and the device seems remaining disconnected.

Thanks
Best regards
G.
100
Bluetooth Framework / Re: Subscribe and event receiving data
« Last post by Mike Petrichenko on September 30, 2021, 06:58:01 PM »
Hello,

The error code 0x00051004 is WCL_E_BLUETOOTH_LE_INSUFFICIENT_AUTHENTICATION (Attribute server does not support the request received from the client.) https://www.btframework.com/errors.htm

It looks like your device requires authentication and may be pairing.
Pages: 1 ... 8 9 [10]