Closed quartzjer closed 10 years ago
Heya @soldair whatcha think? This should ideally make any js hq "server" code 100% re-usable for serial bridging, since it's just the hq wire protocol back and forth :)
This looks solid. This'll let us solve the fragmentation/chunking stuff for BLE bridging as well I think? And puts us in a good spot for other bridge mode types like GSM/cellular or ethernet backpacks. slick!
Looks good. So to write input data I call hq.bridge(data).
Looks like it doesn't read off of WiFi while it's bridged though. right?
Right, because the wifi/backpack logic needs to be more deeply decoupled from isLeadScout(), which IMO is beyond the scope of this as a first-pass MVP :)
I've been wondering if "[hq-bridge]" is the right escaping to use here. It sounds like you might actually somehow include the text "[hq-bridge]" in regular bitlash output at some point, which would horribly break things. Furthermore, using a newline as the message terminator prevents having a newline inside the message (which should be acceptable for JSON, but it might be better to make the protocol binary-safe at this level?).
Also, having a bitlash function for the PC -> scout channel is easy, but also seems a bit fragile. Having some kind of escape sequence for these messages also makes sense to me.
Having said this, it probably makes sense to merge this now and continue experimenting like this. We can later switch over to something more robust (which probably requires fixing #132 as well first).
We can change the byte sequence to something more novel but we already have a working implementation and it works well. On Jun 30, 2014 2:33 AM, "Matthijs Kooijman" notifications@github.com wrote:
I've been wondering if "[hq-bridge]" is the right escaping to use here. It sounds like you might actually somehow include the text "[hq-bridge]" in regular bitlash output at some point, which would horribly break things. Furthermore, using a newline as the message terminator prevents having a newline inside the message (which should be acceptable for JSON, but it might be better to make the protocol binary-safe at this level?).
Also, having a bitlash function for the PC -> scout channel is easy, but also seems a bit fragile. Having some kind of escape sequence for these messages also makes sense to me.
Having said this, it probably makes sense to merge this now and continue experimenting like this. We can later switch over to something more robust (which probably requires fixing #132 https://github.com/Pinoccio/library-pinoccio/issues/132 as well first).
— Reply to this email directly or view it on GitHub https://github.com/Pinoccio/library-pinoccio/pull/147#issuecomment-47512133 .
I def hope we can get to a more "pure" serial level binary safe escaping in both directions, but it's def a future step after #132 :)
im going to merge this eod if no one has any issues. im going to send instructions for testing within the hour
This implements a bridging mode where it fully becomes the lead scout and just sends the hq json wire protocol over serial instead of a socket. Should be very re-usable for BLE bridging too, and easier to refactor in the future.