Skip to content
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

Add bindings for IOBluetooth framework #381

Closed
ronaldoussoren opened this issue Aug 20, 2021 · 5 comments
Closed

Add bindings for IOBluetooth framework #381

ronaldoussoren opened this issue Aug 20, 2021 · 5 comments
Labels
enhancement New feature or request

Comments

@ronaldoussoren
Copy link
Owner

See #380, the framework has Python users.

@ronaldoussoren ronaldoussoren added the enhancement New feature or request label Aug 20, 2021
@dlech
Copy link

dlech commented Jan 8, 2023

Hi @ronaldoussoren,

How hard would this be for someone not named Ronald to implement?

@ronaldoussoren
Copy link
Owner Author

Fairly hard, for two reasons:

  1. The tooling I use is currently tuned for my laptop and workflow (and AFAIK it is not in sync with the public version of that tooling)
  2. IOBluetooth contains a number of APIs that require manual bindings (such as IOBluetoothPackData).

That said, the headers look less daunting than when I first looked at them, other than the sheer size. There might be a dependency on IOKit.framework, but on first glance it should be possible create bindings without creating full IOKit bindings first.

@ronaldoussoren
Copy link
Owner Author

Sigh, I also need to tweak the tooling, there's at least one struct containing a union that confuses the metadata scanning tool, seemingly due to getting bogus data from clang.

ronaldoussoren added a commit that referenced this issue Jan 14, 2023
At this point incomplete and untested: scan of the headers
with ignores for two problematic structs.

Missing are:
- tests
- metadata overrides for input/output parameters
- documentation update, pyobjc/setup.py update
ronaldoussoren added a commit that referenced this issue Jan 14, 2023
ronaldoussoren added a commit that referenced this issue Jan 14, 2023
Issue #381

The bindings are mostly complete, except for
a number of legacy APIs that require manual bindings
due to interface that are more complex than the
bridge metadata can handle.
@ronaldoussoren
Copy link
Owner Author

The trunk now contains bindings for IOBluetooth and IOBluetoothUI.

@dlech: If you want to test these bindings you can easily install them on top of the current release of PyObjC:

  • Check out the repository
  • Change the VERSION in pyobjc-framework-UIBluetooth and "python setup.py install"
  • Change the VERSION in pyobjc-framework-UIBluetoothUI and "python setup.py install"

You can also perform a full install using the "install.py" or "develop.py" scripts, but that takes a while.

The bindings are as complete as I can make them at this time, in particular the bindings for IOBluetooth are incomplete due to a number of APIs that require manual bindings because they cannot be described by the metadata system (most importantly due to using a struct that contains a C union, but also a varargs function with a format string).

If you do end up testing this: please let me know if one of the missing APIs is necessary to actually use these APIs. I'm hoping they are not because most if not all of them are deprecated for a long time.

@dlech
Copy link

dlech commented Jan 15, 2023

So far, so good, thanks! I've just been working with RFCOMM so far but haven't run into anything missing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants