OpenBluetoothToolbox / SimpleBLE

SimpleBLE - the all-in-one Bluetooth library for MacOS, iOS, Windows, Linux and Android.
https://www.simpleble.org
Other
675 stars 115 forks source link

Characteristic read on MacOS broken since #255 #277

Closed thegecko closed 2 months ago

thegecko commented 10 months ago

The rewrite in https://github.com/OpenBluetoothToolbox/SimpleBLE/pull/255 has introduced a bug where characteristic reads on MacOS are no longer working.

This was detected when running tests after a SimpleBLE update in https://github.com/thegecko/webbluetooth/pull/131

I've had a dig about, but I'm not an ObjectiveC expert. I think there are two problems:

Any ideas @kdewald ?

dennisppaul commented 8 months ago

i can confirm that commit e047d4cf235b46ce89776ec5757fd2e24d794da6 ( 2023-08-10 23:25 ) also breaks notify(,,) every time with segmentation fault on macOS:

Model Name: MacBook Pro
Model Identifier: Mac15,7
Model Number: Z1AF000J3D/A
Chip: Apple M3 Pro

ProductName: macOS
ProductVersion: 14.2.1
BuildVersion: 23C71
JoeHowse commented 7 months ago

I believe this issue is still present in the 0.7.1 release of SimplePyBLE. Calls to notify always segfault. Tested on MacBook Pro mid-2015, macOS 12.7.3.

kdewald commented 7 months ago

Yes, you'll notice in the changelog that no new fixes have been added since prior to the license change. The goal right now is to get that right to ensure there is actually a viable path towards growing SimpleBLE sustainably.

JoeHowse commented 5 months ago

I believe this issue is still present in the 0.7.1 release of SimplePyBLE. Calls to notify always segfault. Tested on MacBook Pro mid-2015, macOS 12.7.3.

I believe this issue is still present in the 0.7.1 release of SimplePyBLE. Calls to notify always segfault. Tested on MacBook Pro mid-2015, macOS 12.7.3.

Same in the 0.7.3 release of SimplePyBLE, with the same system.

Symbitic commented 5 months ago

Yes, you'll notice in the changelog that no new fixes have been added since prior to the license change. The goal right now is to get that right to ensure there is actually a viable path towards growing SimpleBLE sustainably.

@kdewald does that mean you don't want a fix?

kdewald commented 5 months ago

Hey! Just to keep everybody here posted on the latest updates:

The transition to a commercial license is coming along better than anticipated, which in turn means that we have a lot more work ahead of us. Our company incorporation is underway, legal docs are being reviewed and the team is also starting to grow, with Pedro Dans being our first addition and a few others in the pipeline (yay!).

Development is still ongoing, in particular focused on getting Android support of the ground. This would go faster if it weren't for some very poor API decisions on Google's end, so I'll need everybody to stay patient for a bit longer until my pathfinder implementation is ready, which is when I'll be able to start delegating tasks and focus on fixing these lingering bugs.

This process will get better, right now we're transitioning from almost nonexistent work to growing pains in the span of a few weeks, but I can promise that the end result will be a kickass library everybody will be able to enjoy.

kdewald commented 4 months ago

Okay, after carving out some time I can at least say that I was able to replicate the bug locally, which means it will definitely be fixed for the 0.8 release.

On some other notes: Company is incorporated, commercial license is ready and we're currently in the process of onboarding customers, so things have been excitedly busy.

@Symbitic @thegecko, as a reminder, we want to make sure you can use SimpleBLE for webbluetooth and thus want to provide the license to you for free, no strings attached.

thegecko commented 4 months ago

@Symbitic @thegecko, as a reminder, we want to make sure you can use SimpleBLE for webbluetooth and thus want to provide the license to you for free, no strings attached.

Will the license allow any commercial users of webbluetooth to use this library without charge? Some clear guidance on usage would be helpful.

kdewald commented 4 months ago

@thegecko Strong yes!

We've spent a lot of time (and money) on our legal reviews to make sure this use case is supported. The TL;DR is that SimpleBLE can be bundled as part of MIT/Apache licensed projects by adding a notice to users that the bundled version of SimpleBLE can only be used as part of that downstream project and can't be extracted to use on other things.

Some of our customers are building MIT-licensed libraries (which include SimpleBLE for BLE support) for their products, and this approach is working for them.

TellowKrinkle commented 4 months ago

The notify crash seems to be caused by .uuid() returning full length UUIDs, while the characteristicExtras dictionary seems to contain short UUIDs, so the [self.characteristicExtras objectForKey:characteristic_uuid] lookup fails to find the key.

kdewald commented 3 months ago

Hey all!

The fix for this issue is up in https://github.com/OpenBluetoothToolbox/SimpleBLE/pull/326 I still need to do some cleanup and update the README, but it should be landed soon. Full distribution across all channels will take a bit longer as we have many pieces of work going into this next release.

We're moving as fast as we can :P

kdewald commented 3 months ago

Also, thanks a lot to @TellowKrinkle for that hint. It made the solution very fast to find.

kdewald commented 2 months ago

Fix has been merged. Closing issue.

thegecko commented 2 months ago

Fix has been merged. Closing issue.

Great! let us know when you plan on doing a release