paho-mqtt for MicroPython
Posted: Mon Oct 19, 2015 2:14 pm
I took a quick look at current implementation of paho-mqtt for Python. It has following dependencies:
errno - several error codes used in the code (following module could be extended with necessary error codes and imported https://github.com/micropython/micropyt ... o/errno.py)
platform - platform.system() used once to detect if running on Windows, can be omitted
random - used once to generate client_id, I guess that pyb.rng() could be used
select - available in MicroPython
socket - usocket available - not sure if all required functions are supported (setsockopt() seems to be supported; getfqdn() is used to determine local domain, seems to be missing but not mandatory; other unsupported function is create_connection() - it seems to be higher-level function based on connect(), bind() and settimeout() functions (https://docs.python.org/2/library/socke ... connection) - I guess that missing function create_connection() could be defined additionally or in better case implemented usocket direcly
)
struct - available in MicroPython
sys - available in MicroPython (only values version and version_info are used)
time - available in MicroPython
threading - this is what I am afraid of, Lock() and Thread() functions used, could uasyncio module be used instead of threading?
Thanks a lot for your opinion.
errno - several error codes used in the code (following module could be extended with necessary error codes and imported https://github.com/micropython/micropyt ... o/errno.py)
platform - platform.system() used once to detect if running on Windows, can be omitted
random - used once to generate client_id, I guess that pyb.rng() could be used
select - available in MicroPython
socket - usocket available - not sure if all required functions are supported (setsockopt() seems to be supported; getfqdn() is used to determine local domain, seems to be missing but not mandatory; other unsupported function is create_connection() - it seems to be higher-level function based on connect(), bind() and settimeout() functions (https://docs.python.org/2/library/socke ... connection) - I guess that missing function create_connection() could be defined additionally or in better case implemented usocket direcly

struct - available in MicroPython
sys - available in MicroPython (only values version and version_info are used)
time - available in MicroPython
threading - this is what I am afraid of, Lock() and Thread() functions used, could uasyncio module be used instead of threading?
Thanks a lot for your opinion.