Skip to content
This repository has been archived by the owner on Feb 19, 2024. It is now read-only.

Feature/s132v5 py3 #48

Closed

Conversation

jorgenmk
Copy link
Contributor

@jorgenmk jorgenmk commented Dec 1, 2017

Python 3 support
s132_v5 API support

@CLAassistant
Copy link

CLAassistant commented Dec 1, 2017

CLA assistant check
All committers have signed the CLA.

tomchy and others added 6 commits January 16, 2018 18:05
SWIG has an issue with unions that are named.
See swig/swig#1305.

In pc-ble-driver there are several structs that use named unions.

For example:

typedef struct
{
  uint16_t conn_handle;
  union common_evt_params_union
  {
    ble_evt_tx_complete_t           tx_complete;
    ble_evt_user_mem_request_t      user_mem_request;
    ble_evt_user_mem_release_t      user_mem_release;
  } params;
} ble_common_evt_t;

SWIG is not able to add a params struct member with this syntax.
However, removing common_evt_params_union works.

This commit circumvent this by inlining structs using this syntax before
the include is done.
@mstratford-c
Copy link

mstratford-c commented Nov 14, 2018

Hi there! I'm trying to use this branch to get my NRF51 dongle to work with Python3.7, have you managed to do something similar?

Currently with the heart_rate_collector example, i'm hitting the following:

  File ".\heart_rate_collector.py", line 187, in <module>
    main(serial_port)
  File ".\heart_rate_collector.py", line 151, in main
    conn_handle = collector.connect_and_discover()
  File ".\heart_rate_collector.py", line 92, in connect_and_discover
    self.adapter.service_discovery(new_conn)
  File "C:\Users\XXX\AppData\Roaming\Python\Python37\site-packages\wrapt\wrappers.py", line 562, in __call__
    args, kwargs)
  File "C:\Python37\lib\site-packages\pc_ble_driver_py\ble_driver.py", line 124, in wrapper
    raise NordicSemiException('Failed to {}. Error code: {}'.format(wrapped.__name__, err_code), error_code=err_code)
pc_ble_driver_py.exceptions.NordicSemiException: Failed to service_discovery. Error code: BLEGattStatusCode.invalid_handle

It appears that the handles that come back are really strange (and typically large) numbers, instead of 2,4,6... that I get with the pip package and Python 2.7. On our actual development code, if I request a characteristic handle I know is present, I get a Python list of the first two characters in ASCII, then a load of incorrect garbage afterwards also.

Any tips/guesses on what I could be doing wrong?

Cheers!

@kenr kenr closed this May 22, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants