Recent Posts

Pages: [1] 2 3 ... 10
1
Bluetooth Framework / Bluetooth Framework 7.9.0.0 has been released
« Last post by Mike Petrichenko on August 09, 2020, 01:01:24 PM »
2
Bluetooth Framework / Re: Incorrect Device Names
« Last post by Mike Petrichenko on July 30, 2020, 07:44:25 AM »
Hello,

It is normal for Windows. It appears because Windows does not resolve device names during discovering and does not send actual HCI GetDeviceName command when you query a device's name from an application. (If we are talking about MS drivers).

There are 2 solutions (depending on the device type):

1. If your device is classic then try to resolve device's name after discovering completed (as it is shown in BluetoothManager demo app).
2. If your device is LE one use BeaconWatcher instead (refer to Beacons demo or better to this code: https://github.com/btframework/WeDo/blob/master/NET%20Edition/WeDo%20Framework/wclWeDoWatcher.cs)

3
Bluetooth Framework / Incorrect Device Names
« Last post by tomitrescak on July 30, 2020, 06:55:25 AM »
Hello, I am currently evaluating your product, which we are thinking of using in our research project.
It seems that this is the only library that actually works in Unity on PC ATM, so great job,

My issue is that the demo you provide is not very usable, as instead of Device Names and Capability Names, we receieve addresses.
I tried to use the GetRemoteName, which comes up with a cryptic name "Bluetooth:{Address}", instead of actual name.
Only one of the devises actually showed its name.

This is the slightly modified code from the original Unity demo that I found in your github page:

Code: [Select]
private void FManager_OnDeviceFound(System.Object sender, IntPtr Radio, long Address)
{
        string name;
        FManager.GetRemoteName(Radio, Address, out name);

        Debug.Log($"Device '{name}' found: " + Address.ToString("X12"));

        // Add device into found devices list.
        FDevices.Add(Address);
}

This is what I see in Unity Log

Code: [Select]
Device 'Bluetooth 2c:41:a1:99:02:3b' found: 2C41A199023B
Same situation with capabilities.
Any advice on how to get redable names?
4
I created a simple application that shows how to do what you need with Bluetooth Framework: https://github.com/btframework/PairedGatt

Copy Bluetooth Framework DLLs into Lib folder.
5
Of course it does not because device is turned off. You have to enumerate paired devices. Refer to Bluetooth Manager to find out how to enumerate paired devices.

6
Bluetooth Framework / Re: Getting services from a device which is not connected
« Last post by decay on July 24, 2020, 08:39:36 PM »
If I check "Connect On Read" in the demo app, it still does not show up in discovery. 

Unfortunately, I don't think the library is going to work for our use case. 

As far as working with paired devices on Windows, it has been both very stable in UWP (see Windows Bluetooth LE Explorer) and the lower level Win32 BLE code.  It is just a lot of extra code I was hoping to avoid, especially if we bring regular Bluetooth devices under our umbrella.  I was initially trying this in Linux, and it was losing pairing on a regular basis.  I have had no such problems in Windows.

Thanks for your help.
7
That is absolutely correct behaviour when ConnectOnRead is set to false. Because Bluetooth Framework executes real connection to device. So if device is truend off it can't connect to it.

Set ConnectOnRead  to true and then connection will work. However read services will be failed if device is turned off.

P.S. It is bad idea to work with paired device on Windows platform. Pair with it only when it is really required. Andpair only when needed. Do not pair with any other cases.
8
Bluetooth Framework / Re: Getting services from a device which is not connected
« Last post by decay on July 24, 2020, 08:01:25 PM »

First make sure that the Connect On Read is not checked (in demo app).

It's not.  It is paired with the computer and does not show up unless it is powered up before the discovery process.

Quote
The WCL_E_CONNECTION_NOT_ACTIVE erro rmeans that you did not connected to device (https://www.btframework.com/errors.htm). It may appears when you call ReadService right after Connect() and does not wait for OnConnect event.

You should always process OnConnect and analize connection result (the Error parameter) and only if Error is WCL_E_SUCCESS you can read services and other things.


The OnConnect event fires just fine, but the Error parameter is 331868 when the device is powered off


Quote
You can take a look on how it should be done by this link: https://github.com/btframework/WeDo/blob/master/NET%20Edition/WeDo%20Framework/wclWeDoHub.cs
Also there you can find how to find BLE devices without discovering: https://github.com/btframework/WeDo/blob/master/NET%20Edition/WeDo%20Framework/wclWeDoWatcher.cs

I will look.  Thanks.
9
Hello,

First make sure that the Connect On Read is not checked (in demo app).

Bluetooth Framework provides 2 "connection methods". The first one (when ConnectOnRead is false) executes real connection to the device during connection procedure. The second one (when ConnectOnRead is true and this is default behaviour of any Windows GATT API) when connection executed on first service read attempt.


The WCL_E_CONNECTION_NOT_ACTIVE erro rmeans that you did not connected to device (https://www.btframework.com/errors.htm). It may appears when you call ReadService right after Connect() and does not wait for OnConnect event.

You should always process OnConnect and analize connection result (the Error parameter) and only if Error is WCL_E_SUCCESS you can read services and other things.

You can take a look on how it should be done by this link: https://github.com/btframework/WeDo/blob/master/NET%20Edition/WeDo%20Framework/wclWeDoHub.cs
Also there you can find how to find BLE devices without discovering: https://github.com/btframework/WeDo/blob/master/NET%20Edition/WeDo%20Framework/wclWeDoWatcher.cs
10
Bluetooth Framework / Getting services from a device which is not connected
« Last post by decay on July 24, 2020, 09:57:49 AM »
I am trying out the library (.Net version), and I know the device I want to connect to by MAC address, and when I call
Code: [Select]
wclGattClient.Connect it works fine and returns no error even when the device is not turned on, but when I go to retrieve services from the device via
Code: [Select]
wclGattClient.ReadServices() with the flag
Code: [Select]
wclGattOperationFlag.goReadFromCache or any of the other two flags, the returned services are null and the error returned is
Code: [Select]
WCL_E_CONNECTION_NOT_ACTIVE.  If the device is powered on, then it gets services.  The problem is that this device will be powered off most of the time, and then turned on.  I want to read a characteristic from the device when it executes its function after it is turned on.

In the demo app, I noticed the discovery process does not pick up the device even when I specify reading from cache.

Using the standard UWP and even the native Win32 BLE, this is not a problem, but it is a lot more code, which is why I am exploring this library.  For instance, the Windows 10 BLE Explorer sees the device during enumeration when it is not turned on.  Is this a limitation of BTFramework? Or I am missing something

Thanks.
Pages: [1] 2 3 ... 10