NordicSemiconductor / pc-ble-driver-py

Python bindings for the ble-driver library
Other
126 stars 115 forks source link

Return Python list for on_gatts_evt_write() data #196

Closed dangu closed 2 years ago

dangu commented 3 years ago

It's much more convenient for on_gatts_evt_write() to return a Python list directly. Otherwise, the user is forced to do the conversion anyway to use the data in Python code.

jornbh commented 2 years ago

Will this break anything if the user expects the old kind of list? We really don't want to unexpectedly break any of our users' code.

dangu commented 2 years ago

Yes. If the user does the conversion in their own code their code will break. The returned type is now a Python list instead of a swig object.

What would be the preferred way to deal with this? I see some possibilities:

Edit: Oh, wait. This was so long ago: This was not about the return of a method but the call to a user defined observer. Then my possibilities above will not work.

jornbh commented 2 years ago

As things are right now, this will be too big of a change compared to the gain for the user, so it will not be added unless we were to do a big, already breaking change to pc-ble-driver-py.