Re: P2 protocol question

William Shipley <[email protected]>
Newsgroups gmane.comp.science.openeeg.general
Message-ID <CAFYD1PpZdwph-2yxnaXE6wicokX3gsS0AbUzGgXAB8hcmrePUQ@mail.gmail.com>
Well, if you're dealing with BigEndian vs LittleEndian, all that's
happening is that the bytes come in a different order for each number.
Thankfully, these numbers are only two bytes long, so it's easy.

Easy C one-liner:

swapped = (num>>8) | (num<<8)


where 'num' is your input int and 'swapped' is your output. It's simply
putting the last 8 bits before the first 8. Incidentally, that brings your
values in that list to:

90
1023
995
832
690
587

which are all under 1024. Basically, you're being sent a 12-bit number, but
it's enclosed in a 16-bit shell. The reason it's higher than 1023 is
because you haven't converted your endianness.

Hope that helps!

On Mon, Dec 10, 2012 at 1:33 AM, Savchenko Dmitry <[email protected]>wrote:

> Hello!
>
> Can you describe values in `uint16_t data[6]` sent in ModEEG package?
> And have I convert these values from BigEndian to LittleEndian?
>
> --
> Best regards, Dmitry Savchenko
>
>
> ------------------------------------------------------------------------------
> LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
> Remotely access PCs and mobile devices and provide instant support
> Improve your efficiency, and focus on delivering more value-add services
> Discover what IT Professionals Know. Rescue delivers
> http://p.sf.net/sfu/logmein_12329d2d
> _______________________________________________
> Openeeg-list mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openeeg-list
> Go to the above address to change your
> subscription options, e.g unsubscribe.
>
>

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.