padenot / monome-rs

Talk to monome grid and arc devices in rust
Other
37 stars 2 forks source link

monome-rs assumes that serialoscd is running on localhost #2

Closed samaaron closed 4 years ago

samaaron commented 4 years ago

In my case I have serialoscd running on a different machine to the one where I'm running the rust code. Is this something you'd be willing to support?

padenot commented 4 years ago

Thanks for the issue! I reckon this is kind of a blind spot in the API. Probably because I'm running everything on the same host in my setup.

Anyways, this is fixed in https://github.com/padenot/monome-rs/commit/08b3c65409fd078a1c266d0bff8b5a517019fa22, I tagged and released 1.1 that has this change (and other things that are not important).

There are new APIs to talk to a serialoscd that is not running on localhost:

register_device_change_callback_with_host_and_port(...)
register_device_change_callback_with_host(...)
enumerate_devices_with_host_and_port(...)
enumerate_devices_on_host(...)

I updated an example to demonstrate it (and there are docs), but it goes like this:

let enumeration = 
    Monome::enumerate_devices_with_host_and_port("192.168.1.12".parse().unwrap(), 12012);

This is non breaking, in the sense that all the previous methods works in exactly the same way (and still exist), but there are new one to accommodate this use case.

Let me know if it works for you!

samaaron commented 4 years ago

Lovely thanks! I look forward to playing with it :-)