Author Topic: Encoding used for JSON serial data  (Read 684 times)

irkgreen

  • Newbie
  • *
  • Posts: 48
Encoding used for JSON serial data
« on: May 17, 2010, 11:02:08 AM »
What encoding is used for the serialdata property of the JSON object for the serial API?  My object is:

{"serialObject":{"serial":"24000320","channel":"2","datetime":"1274089483110","s
treamID":"kS8mef3gJ0yn","SerialData":":╧☻ :╧☻ :╧☻ :╧☻ :╧☻ "}}

Is that? 0x3A 0xCF 0x?? 0x20

The data I expect is:

0x8B 0x84 0x80 0x7F
0x8B 0x84 0x80 0x7F
0x8B 0x84 0x80 0x7F
0x8B 0x84 0x80 0x7F
0x8B 0x84 0x80 0x7F



iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
Re: Encoding used for JSON serial data
« Reply #1 on: May 23, 2010, 11:57:51 AM »
Web is going to try to display ASCII, which I think is why the characters are all messed up - it's not readable.

If a serial device read that in, it would be the correct bytes.

WHat are you finding out?

ioBridge Support
Community Team

irkgreen

  • Newbie
  • *
  • Posts: 48
Re: Encoding used for JSON serial data
« Reply #2 on: May 23, 2010, 12:09:08 PM »
I think that is the problem.  However, I am seeing ":" which is 3A in the JSON object and I'm not sure why (my data doesn't contain 3A).  Also several of the chars seem to be extended ASCII but they don't seem to match popular Extended ASCII encoding. 

I have a W800RF32 plugged up to the serial board of the ioBridge.  Monitoring the widget or reading the JSON object both show consistent results but undecipherable (I think some non-printable chars are being sent, like acknowledge).

If I plug the W800 up to an AVR I can read in the bytes and covert them to text versions of the HEX codes and send that to the ioBridge. It has some issues, but I think that might be my only solution.

Am I missing  something?

iobridge

  • Administrator
  • Hero Member
  • *****
  • Posts: 669
    • ioBridge Support
Re: Encoding used for JSON serial data
« Reply #3 on: May 23, 2010, 12:16:56 PM »
I will double check on the encoding for you. The environment for the web services is set to "UTF-8".

However, hardware to hardware serial should be raw. We encoded only a handful of characters, but they get decoded on the output. It is transparent to the hardware.
ioBridge Support
Community Team

irkgreen

  • Newbie
  • *
  • Posts: 48
Re: Encoding used for JSON serial data
« Reply #4 on: May 23, 2010, 12:39:41 PM »
That makes sense, however, since the JSON object has to report the data in a string then it must be encoding everything.  Unfortunately, the x10 devices that communicate with the W800RF32 just don't play nice and most of the data is extended or non-printable ASCII.

There is no way the JSON object could also send hex strings of the data is there?
« Last Edit: May 23, 2010, 01:17:00 PM by irkgreen »