Recent

Author Topic: Lazarus and BLE - Pascal Bindings for SimpleBLE Library  (Read 1484 times)

ER!K

  • Newbie
  • Posts: 4
Lazarus and BLE - Pascal Bindings for SimpleBLE Library
« on: November 04, 2022, 02:47:07 pm »
Hey guys,

a while ago I came across the SimpleBLE project on github (https://github.com/OpenBluetoothToolbox/SimpleBLE), which is a cross-platform BLE library project implemented in C/C++. Since it provides a C API, I thought it should be possible to create Pascal bindings for this. I gave it a try and put together a Pascal unit, which exposes all relevant functions from the C API into Pascal.

SimpleBLE comes with some example projects, which I ported to Lazarus/FreePascal and these work fine. They involve BLE scanning, connect/disconnect as well as querying services and characteristics from a peripheral's GATT table and subscribing to notifications. Even though SimpleBLE is still work in progress (see issues on github), it looks quite promising to me and at least the basic BLE stuff seem to work properly.

I put everything on github at https://github.com/eriklins/Pascal-Bindings-For-SimpleBLE-Library in case someone else finds this useful and would like to give it a try. I also added a release package including the Pascal unit as well as precompiled shared libraries (currently just DLLs for Windows 64 bit).

I'm far from being a Pascal expert, so any suggestions/feedback is more than welcome!

Cheers,
ER!K

steve13cn

  • Newbie
  • Posts: 1
Re: Lazarus and BLE - Pascal Bindings for SimpleBLE Library
« Reply #1 on: June 26, 2023, 05:26:41 am »
good work.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lazarus and BLE - Pascal Bindings for SimpleBLE Library
« Reply #2 on: June 28, 2023, 11:45:17 pm »
Might be useful someday for IoT projects, bookmarking.

af0815

  • Hero Member
  • *****
  • Posts: 1291
Re: Lazarus and BLE - Pascal Bindings for SimpleBLE Library
« Reply #3 on: June 29, 2023, 10:11:21 am »
Interesting, can it work with sport watches or dial gauge (because some have BTLE IMHO eg. Mahr digital gauge or measuring stick) ?
Might be useful someday for IoT projects, bookmarking.

Quote
simpleble-c.dll, simpleble.dll, fmt.dll: The three shared libraries with all the SimpleBLE functionality in. You need all three of them.
If i download the precompiled releases, i miss the fmt.dll (in win64 zip file). Does anybody know if it is really needed ?
regards
Andreas

Thaddy

  • Hero Member
  • *****
  • Posts: 14364
  • Sensorship about opinions does not belong here.
Re: Lazarus and BLE - Pascal Bindings for SimpleBLE Library
« Reply #4 on: June 29, 2023, 10:18:35 am »
No. fmt.dll is just a formatting library, so it is more involved in creating whitespace, which is ignored by compilers anyway  8-) O:-) :o
Object Pascal programmers should get rid of their "component fetish" especially with the non-visuals.

Leledumbo

  • Hero Member
  • *****
  • Posts: 8757
  • Programming + Glam Metal + Tae Kwon Do = Me
Re: Lazarus and BLE - Pascal Bindings for SimpleBLE Library
« Reply #5 on: July 01, 2023, 03:35:16 am »
Interesting, can it work with sport watches or dial gauge (because some have BTLE IMHO eg. Mahr digital gauge or measuring stick) ?
Logically, just find a documentation for the protocol on top of the BLE connection.

 

TinyPortal © 2005-2018