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 a python-interface section #301

Closed
wants to merge 1 commit into from
Closed

Add a python-interface section #301

wants to merge 1 commit into from

Conversation

Ircama
Copy link

@Ircama Ircama commented Feb 25, 2023

Thanks for this repo.

This PR proposes adding a python-interface section, which provides Python components to represent the data model of the custom firmware, as well as a documented interface and a testing tool to decode, show and edit the BLE advertisements delivered via the custom firmware.

The main element is the symmetric Python library that declaratively defines a data structure describing all the advertisement frames produced by the custom firmware.

The testing tool is an easy-to-use BLE Advertisement Browser GUI.

@pvvx
Copy link
Owner

pvvx commented Feb 26, 2023

How to enable Bluetooth 5.1 support in Windows and Linux?
https://learn.microsoft.com/en-us/windows-hardware/drivers/bluetooth/bluetooth-support-in-previous-windows-versions#which-bluetooth-versions-do-previous-versions-of-windows-support
It is required to initialize the adapter to work in 1M and Coded PHY.

Bleak does not know how.
hbldh/bleak#1225

@Ircama
Copy link
Author

Ircama commented Feb 26, 2023

Closing this PR as a similar code has been committed here.

@Ircama Ircama closed this Feb 26, 2023
@Ircama Ircama deleted the ircama-python-interface branch February 26, 2023 14:41
@Ircama
Copy link
Author

Ircama commented May 14, 2023

How to enable Bluetooth 5.1 support in Windows and Linux? https://learn.microsoft.com/en-us/windows-hardware/drivers/bluetooth/bluetooth-support-in-previous-windows-versions#which-bluetooth-versions-do-previous-versions-of-windows-support It is required to initialize the adapter to work in 1M and Coded PHY.

Bleak does not know how. hbldh/bleak#1225

@pvvx I'm not sure if Windows allows this (easily). I cannot understand this from your link.

You are sending HCI commands via hcitool to preconfigure the BLE device to accept LE Coded advertisements. I think that this will affect all subsequent BLE operations on the configured device.

Bleak is just a Python BLE client interface that relies on backends. I do not think device configuration could be within its scope and still cannot issue HCI commands directly.

I'm afraid Windows doesn't have an equivalent tool to hcitool.

@pvvx
Copy link
Owner

pvvx commented May 15, 2023

The BLE adapter from BT5.0 version is assigned primary and secondary PHY for any operation.
Bluetooth 5.0 was not provided in Linux, so the interface and API (Bluez) did not have setting the primary PHY. Only secondary PHY.
Now it's built into the Bluez API. And there is an interface, via DBUS-mgmt-Bluez for Bleak.

Today - the availability of the PHY switching / configuration API for working with commands for the BT adapter:

  1. Android - ok, there are a long time
  2. Linux - ok, recently, year
  3. Windows - ?

@pvvx
Copy link
Owner

pvvx commented May 15, 2023

You are sending HCI commands via #297 (comment) to preconfigure the BLE device to accept LE Coded advertisements.

The scan command in BT5.0+ requires the assignment of a secondary and primary PHY. If this is not the case, then there is no support for BT 5.0 (2016).

Linux simply doesn't have a command-line interface to work with the new parameters.

https://git.kernel.org/pub/scm/bluetooth/bluez.git/commit/?id=b1eb2c4cd057624312e0412f6c4be000f7fc3617

This marks the following tools as deprecated as they are not longer
maintained or have been replaced by other tools:

  hciattach hciconfig hcitool hcidump rfcomm sdptool ciptool gatttool

The old ones are outdated (2017), but the new ones haven't been created yet.

@Ircama
Copy link
Author

Ircama commented May 16, 2023

  1. Android - ok, there are a long time

I think that also the Android smartphone needs to be able to scan using the primary Coded PHY. Possibly few devices really support this. Not Motorola Edge 20 Lite for instance.

Also:
4. iOS might not support Coded PHY (not with nRF Connect).

FaBjE pushed a commit to FaBjE/ATC_MiThermometer that referenced this pull request May 28, 2023
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.

2 participants