8000 Mojave / Catalina support by ccollins476ad · Pull Request #67 · go-ble/ble · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Mojave / Catalina support #67

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 19, 2021
Merged

Conversation

ccollins476ad
Copy link

This PR replaces the use of XPC services with the "cbgo" library
(CoreBluetooth Go). This PR consists of a single massive commit and for that I apologize.

The cbgo library (https://github.com/JuulLabs-OSS/cbgo) is new and likely buggy. As the README indicates, there are definitely memory leaks that will need to be fixed. That said, I have tested this PR with the go-ble example apps and the newtmgr tool (https://github.com/apache/mynewt-newtmgr) without issue.

This commit replaces the use of XPC services with the "cbgo" library
(CoreBluetooth Go).
@deadprogram
Copy link

This is very exciting contribution, and I look forward to testing it out. Thanks for working on it @ccollins476ad

This fixes what seems to be a Catalina-specific issue.

Pre-Catalina: The DidUpdateState delegate callbacks get called *after*
the delegate properties gets assigned.

Catalina: DidUpdateState gets called immediately upon construction of
the manager objects (CBCentralManager and CBPeripheralManager).

Prior to this commit, the code assumed it could assign the delegate
properties and then listen for the transition to the powered-on state.
This works for older versions of macOS, but with Catalina the code
blocks forever, waiting for an event that has already occurred.

The fix is to use the following procedure:

(for each manager object):
1. Assign the delegate.
2. Check the state.  If the state is not "unknown" then the procedure is
done.
3. Else, wait up to one second for a state change event.
@alexhowarth
Copy link
alexhowarth commented Jun 3, 2020

This is very exciting contribution, and I look forward to testing it out. Thanks for working on it @ccollins476ad

+1

I'm currently using the https://github.com/JuulLabs-OSS/ble fork on macOS Catalina.

@phelpsw
Copy link
phelpsw commented Sep 5, 2020

Any updates here? This would be great to merge.

@estutzenberger
Copy link

Apologies for the long delay in responding to this PR. This work looks good. I'm not easily able to test it but I'm happy to merge it based on the feedback I have seen thus far on the PR and issue.

@estutzenberger estutzenberger merged commit 4bfb849 into go-ble:master May 19, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants
0