Lazarus
Programming => Operating Systems => Windows => Topic started by: mas steindorff on January 26, 2022, 03:06:18 am
-
Does anyone have a recommendation as to the best approach to accessing Bluetooth LE hardware in windows? I saw the Bluetooth page at
https://wiki.freepascal.org/Bluetooth (https://wiki.freepascal.org/Bluetooth)
but I need to access the BLE at the characteristic level.
Thank you
MAS
-
Is there a soloution for this without pascal ? Prefered is C-only libs.
I was searching for it on Linux, but i found no working sample for my devices. All the python scripts were experimental and not working with my device.
-
I don't know anything ready to use right now, but you can try to translate the C code mentioned here (https://social.msdn.microsoft.com/Forums/en-US/bad452cb-4fc2-4a86-9b60-070b43577cc9/is-there-a-simple-example-desktop-programming-c-for-bluetooth-low-energy-devices?forum=wdk).
-
I believe Delphi has support for classic Bluetooth and Bluetooth LE but as you've found, native Lazarus support in Windows is non-existent and support in Linux is limited to an 8 year old BT only library.
I ended up using this: https://www.nsoftware.com/ipworks/ble/ (https://www.nsoftware.com/ipworks/ble/). It says it's for Delphi but it works in Lazarus too. But it's only a Windows solution and it is expensive. Not as expensive as Delphi, but more than you'd want to spend on a small project.
For Linux I'm not sure how to handle it. I think I'm going to need to learn about DBus for the notifications and BlueZ for the communications but I'm not looking forward to any of that!
-
thanks everyone.
I may be able to interface to a Nordic driver
https://www.nordicsemi.com/Products/Development-tools/nrf-connect-for-desktop (https://www.nordicsemi.com/Products/Development-tools/nrf-connect-for-desktop)
My backup plan = PascalDragon recommendation and build a unit that interfaces directly with windows but I have not done that before in the 64 bit world so more homework is in order.
I'll also check out Graham1 suggestion. if it works for win10 & up then that may be a better use of my time.
I'll post my results back here when I finally start on the project in a few weeks. I've been wanting to contribute to FPC, perhaps this interface will be the unit!
MAS
-
Update: I found a Bluetooth library that also supports BLE at www.btFramework.com. The libraries are reasonably priced, Licensed, and they have converted their Delph code so it supports FPC. The Delph demo code is free but will have a popup on run. I suggest you take a look.
MAS
-
Interesting, but note where the company is based: Krychaw, Mogilev Province, Belarus
Personally, I won't use any software from Russia or Belarus.
-
Interesting, but note where the company is based: Krychaw, Mogilev Province, Belarus
Personally, I won't use any software from Russia or Belarus.
Apparently they have the same opinion as you as far as Russia goes according to the big red letters on their web site. Even so, this is a small company which is not on the "Do not do business with" list given to our company from the US government.
Do what you will, but I'll direct my anger toward the Russian government, not towards it's people.
Mas
-
I came across this project:
https://forum.lazarus.freepascal.org/index.php/topic,61140.0.html (https://forum.lazarus.freepascal.org/index.php/topic,61140.0.html)
It works really well in Win64 and Linux but currently has a problem with Win32 builds. This might be due to the DLL's being built in MSVS - could that cause issues with Pascal? Anyway, hopefully that issue will be resolved soon.
If you are interested in BLE in Pascal it would be worth joining the SimpleBLE Discord channel (from the project's main page, not Erik's Pascal bindings page) and letting Kevin know you're following it as he is currently deciding whether to incorporate Erik's Pascal bindings into the main project and include Lazarus as one of the supported platforms.