micropython-osc icon indicating copy to clipboard operation
micropython-osc copied to clipboard

[FR] Support for Serial

Open timonsku opened this issue 7 years ago • 2 comments

One of the nicest features of the Arduino OSC library was the support for all kind of transports, including Serial. Its great for non networked MCUs to have a good high level protocol to speak to a PC. The node.js (and by that also the node-red) OSC library supports it for that reason as well.

What would you think about adding Serial support to the library?

timonsku avatar Nov 15 '18 22:11 timonsku

Thank you for the suggestion. I think this could be added relatively easily.

For the client side, the client.Client class would need to be changed, to use a Transport class instance instead of a socket directly. The Transport class would need to provide a send and a close method. The default transport would be a UDPTransport class, which wraps the socket access.

For the server side, the server.run_server function would need to adapted, to use a Transport class instance as well, which provides a recv method (possibly in a blocking and non-blocking variant), and the server.handle_osc function needs to be adapted slightly as well.

I'll give it go when I have the time, but if you (or someone else) want to submit a PR, that would be even better! :)

SpotlightKid avatar Nov 16 '18 10:11 SpotlightKid

Sounds relatively straight forward. I'm not yet very proficent in developing libraries for MicroPython, I might find time next year to get into it if you don't find the time or motivation :) Will ask in here again if nothing happened by anyone by then before coding something to avoid dupe work.

timonsku avatar Nov 16 '18 10:11 timonsku