Author Topic: TED 5000 API Updates?  (Read 4585 times)

checkers1811

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
TED 5000 API Updates?
« on: June 06, 2011, 06:05:55 PM »
Is there any chance that you could publish a more recent version of the TED 5000 API document?


checkers1811

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: TED 5000 API Updates?
« Reply #1 on: June 06, 2011, 07:45:03 PM »
Here is one reason why a new document is needed.

The documentation for history/rawsecondhistory.raw shows only 16 bytes of data returned from the MTU
But there are 24 bytes returned and the time bytes are shifted left 4 bytes and encoded.

Here is the last 11 seconds before the minute changes - I added spaces to separate the minutes and seconds bytes (best guess)

Minutes changes : M to Q
Seconds change : 'z 0 1 2 3 4 5 6 7 A'

CwYGCy Q A NyQAAF0AAADuCA==
CwYGCy M 7 NyQAAF0AAADuCA==
CwYGCy M 6 NyQAAF0AAADuCA==
CwYGCy M 5 PiQAAF0AAADsCA==
CwYGCy M 4 PiQAAF0AAADsCA==
CwYGCy M 3 PiQAAF0AAADsCA==
CwYGCy M 2 PiQAAF0AAADsCA==
CwYGCy M 1 PiQAAF0AAADsCA==
CwYGCy M 0 PiQAAF0AAADsCA==
CwYGCy M z nB8AAFEAAAD1CA==

Has anyone decoded this mess yet?

The document referenced is TED5000-API-R330.pdf posted at the top of the Developer Support thread list.

TedDev

  • TED Software Developent
  • Administrator
  • Full Member
  • *****
  • Posts: 158
  • Karma: +0/-0
Re: TED 5000 API Updates?
« Reply #2 on: June 06, 2011, 10:12:35 PM »
These are base64 encoded binary arrays. Once you base64 decode these arrays, they will be 16 bytes.

More information on base64 available here: http://en.wikipedia.org/wiki/Base64

Once you get a binary array after decoding each string, you will be able to parse the values from the array w/ the locations specified in the API.

Most languages/SDK's have built in functions for base64 decoding and encoding, so you shouldn't have to implement a decoder from scratch.
« Last Edit: June 06, 2011, 10:17:25 PM by TedDev »

checkers1811

  • Newbie
  • *
  • Posts: 13
  • Karma: +0/-0
Re: TED 5000 API Updates?
« Reply #3 on: June 10, 2011, 11:19:17 PM »
Unfortunately, there is more to it than that. I read the data from the MTU/Gateway using a local program written in Flash actionscript which then forwarded the data to an internet server using PHP/MySql. Somewhere in the handoff from one computer to the next all of the + characters were replaced with <space> characters.

I said all of that because the base64_decode() function in PHP translated all of the data as 0.00 values. In other words, the data was corrupt but I did not know it. I suppose, to be correct, the URL string calling the PHP script should have been encoded to replace the + characters with %2B.

So, if you write a script to send data from your local PC to an internet server PHP script, be sure to URLencode it first. See http://www.w3schools.com/tags/ref_urlencode.asp for some details.

devguy

  • Newbie
  • *
  • Posts: 5
  • Karma: +0/-0
Re: TED 5000 API Updates?
« Reply #4 on: June 12, 2011, 05:22:59 AM »
checkers,

I have encountered a problem regarding random characters(not all of them) in flash (cs3 I believe) turning into spaces on a completely different project (not using teds). Not sure if we have the same error, but I remember fixing it by changing a text setting in flash. It might of been switching from dynamic text to static which in this case you probably can't do. Sorry I don't remember exactly what it was, it was a long time ago. I remember finding the solution through Google.

Phoenix84

  • Newbie
  • *
  • Posts: 4
  • Karma: +0/-0
Re: TED 5000 API Updates?
« Reply #5 on: July 06, 2011, 07:31:12 AM »
Unfortunately, there is more to it than that. I read the data from the MTU/Gateway using a local program written in Flash actionscript which then forwarded the data to an internet server using PHP/MySql. Somewhere in the handoff from one computer to the next all of the + characters were replaced with <space> characters.

I said all of that because the base64_decode() function in PHP translated all of the data as 0.00 values. In other words, the data was corrupt but I did not know it. I suppose, to be correct, the URL string calling the PHP script should have been encoded to replace the + characters with %2B.

So, if you write a script to send data from your local PC to an internet server PHP script, be sure to URLencode it first. See http://www.w3schools.com/tags/ref_urlencode.asp for some details.

I couldn't tell if you solved this issue or not, but it does sound like URL encoding issue to me. I attached a simple perl script I wrote to fetch the information (perl makes it stupid simple ;D). All it does is get the raw second data, and insert it into a mysql database. It may or may not be useful to you, but perhaps it'll help you figure it out.
« Last Edit: July 06, 2011, 10:58:01 AM by Phoenix84 »