goToMain / libosdp

Implementation of IEC 60839-11-5 OSDP (Open Supervised Device Protocol); provides a C library with support for C++, Rust and Python3
https://libosdp.sidcha.dev
Apache License 2.0
137 stars 71 forks source link

Enhance Python API to not expose bit masks #114

Closed Stuckya closed 11 months ago

Stuckya commented 1 year ago

Describe the bug The Python bindings no longer expose is_sc_active() The sample code encourages users to call a missing method on line 105 of cp_app.py:

    if (count % 100) == 99 and cp.is_sc_active(PD_0):

Expected behavior The ability to educate users of this library which python method to call for checking if a PD is active.

Observed behavior Runtime error when attempting to run the sample.

Additional context While trying to find alternatives, the following code was successful:

    if (count % 100) == 99 and bool(cp.sc_status() & 1 << PD_0):

Will open a PR to fix.

sidcha commented 1 year ago

Will keep this issue open to track the change: enhance the API to abstract bitmask details.

sidcha commented 11 months ago

This will be handled in a different approach. The idea is to promote tests/pytest/testlib into a proper python module. Closing this for now.