Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-08 Thread Kent Johnson
Michael Cotherman wrote: > The c code seems to be walking through the list moving > bytes from src to dst, but the python code below seems > to take one byte from src, start counitng up to the > value from 1 and appending each and every value along > the way to dst, no? Ah, right you are. You are

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-07 Thread Michael Cotherman
The c code seems to be walking through the list moving bytes from src to dst, but the python code below seems to take one byte from src, start counitng up to the value from 1 and appending each and every value along the way to dst, no? -mike --- Alan Gauld <[EMAIL PROTECTED]> wrote: > > I am a

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-07 Thread Kent Johnson
Michael Cotherman wrote: >>... is the decoding code, it does what you >>describe below. It is adding the zeros back in, that >>is the dst.append('\0') >> >>Kent > > Really??? I am a noob, but it looks like it only puts > a \0 at the end if code (the length) is less than 255, > as the if statem

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-06 Thread Michael Cotherman
> ... is the decoding code, it does what you > describe below. It is adding the zeros back in, that > is the dst.append('\0') > > Kent Really??? I am a noob, but it looks like it only puts a \0 at the end if code (the length) is less than 255, as the if statement is out of the for loop? thi

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Kent Johnson
Michael Cotherman wrote: > def UnStuffData(src,dst,len): > >for code in src: > for i in range(1,code): > dst.append(i) > > if code < 0xff > dst.append('\0') > > the above is the below code uncommented... > it(and the original code) just seem to find the end

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
def UnStuffData(src,dst,len): for code in src: for i in range(1,code): dst.append(i) if code < 0xff dst.append('\0') the above is the below code uncommented... it(and the original code) just seem to find the end and puts a zero there... I do not see the exis

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Michael Cotherman
This is exactly what i was looking for For those following, the \x00 added at the end of the packet is just imaginary and represents in the meantime, I made the following that just 'decobs' a series of packets (only 8-10 bytes) that are coming in over the com port. (my incoming packets also b

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Kent Johnson
Alan Gauld wrote: >> return (UINT)(dst - dstStart); >> } > > > This looks odd, I don't think I understand what it does. > It seems to return an address thats potentially (probably?!) > before the start of the original dst... It's returning the length of dst. Kent __

Re: [Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS)algorithm help]

2005-10-05 Thread Alan Gauld
> I am a noob to converting pointers in C++ to arrays in > python, although the first time I see it done, I will > have no problem. Can you help converting the below > (what I think is the 'decoder' section) to python? It won't be working code but I think this is whats happening... > UINT CCobsPa

[Tutor] [Fwd: Re: Consistant Overhead Byte Stuffing (COBS) algorithm help]

2005-10-05 Thread Kent Johnson
Forwarding to the list Original Message Subject: Re: [Tutor] Consistant Overhead Byte Stuffing (COBS) algorithm help Date: Tue, 4 Oct 2005 13:20:18 -0700 (PDT) From: Michael Cotherman <[EMAIL PROTECTED]> To: Kent Johnson <[EMAIL PROTECTED]> Thanks for the response, the .NET code