Skip to content

C++ SDK and BLE Lib Update

Compare
Choose a tag to compare
@mbientlab mbientlab released this 13 Jun 23:11
· 54 commits to master since this release

v0.4.0 updates the underlying C++ SDK it is binding (v0.13.4) and replaces gattlib with our own BLE wrapper library, enabling the Python SDK to be used on Windows 10 (min FCU) devices as well.

Changes

Due to the aforementioned updates, there are breaking changes in this release.

C++ SDK

C++ SDK v0.12.0 added an extra void* parameter to functions / types containing function pointers (see specifics in the SDK release notes). As this SDK is a wrapper around the underlying C++ code, developers must update their bindings with the new types and parameters. Python does not require use of the new context parameter so it can be set to None.

See the diff for multi_device.py for an example of the change.

MetaWear Class

The new Linux ble library chooses hci devices based on their mac address instead of their name. To accommodate this change, the device option for the MetaWear constructor function has been renamed to hci_mac.

For example, given this hciconfig out:

hci0:	Type: Primary  Bus: USB
	BD Address: 9C:B6:D0:15:FC:A0  ACL MTU: 1024:8  SCO MTU: 50:8
	UP RUNNING 
	RX bytes:71588 acl:18 sco:0 events:2181 errors:0
	TX bytes:2187 acl:18 sco:0 commands:127 errors:0

You would create a MetaWear object for that hci device as follow:

device = MetaWear(address, **{'hci_mac': '9C:B6:D0:15:FC:A0'})

BLE Scanning

As with previous releases, scanning is done using the underlying BLE library. Refer to the updated scan_connect.py and PyWarble's lescan.py scripts for examples.