On Thu, Jun 6, 2013 at 3:58 AM, Dmitry Eremin-Solenikov <dbarysh...@gmail.com> wrote: > > 1) I suggest for 's' to be used only as a packet start character. > Let's pick up something like > SLIP/PPP have: > > For transmitter: > 's' = start of the packet. If it happens in the packet, transmitter > should replace it. 's' => 'ec' > 'e' = escape char. If it happens in the packet, replace it with 'e' => 'ee' > > For the receiver: > 's' => start of the packet. If it is found, finish the current packet > (possibly truncated/damaged) > and start parsing new packet > 'e' => escape char. Replace: > 'ee' => 'e' > 'ec' => 's' > > After 's' comes protocol version ('s' '2'). > > 2) Packet length. I would suggest to change the protocol a bit: > After command id comes packet length (after unescaping all characters > if we agree to escape them). > Thus it will be possible to skip 'till the next packet'. > > Examples: > Command: 0x00[=NOOP] 0x00[=no args] > Response: 0x80[=rNOOP] 0x01[=1 byte] 0x80[=SUCCESS] > > Command: 0x04[=XMIT] 0x33[=len] .....[=0x33 bytes] > Response: 0x84[=rXMIT] 0x02[=2 bytes] 0x80[=status] 0xed[=level] >
I've recently heard about using COBS for this: http://en.wikipedia.org/wiki/Consistent_Overhead_Byte_Stuffing I've heard about people using this on the econotags for offloading serial data and it has worked well for them. -Mar. ------------------------------------------------------------------------------ How ServiceNow helps IT people transform IT departments: 1. A cloud service to automate IT design, transition and operations 2. Dashboards that offer high-level views of enterprise services 3. A single system of record for all IT processes http://p.sf.net/sfu/servicenow-d2d-j _______________________________________________ Linux-zigbee-devel mailing list Linux-zigbee-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/linux-zigbee-devel