Author Topic: Touch Orbiter for WinCE 5.0 - Why not port it to your favourite Device/OS?  (Read 44548 times)

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
Hi Andrew,

I started on a version yesterday for Android and have a couple of questions for you.
Thats great. We really need and Android version.
Quote

1. What changes have been made to Proxy_Orbiter? Is it just the 'ANYNEWS?' command support. The reason I ask is that me server is still 7.10 so has the old version. This should still be usable, correct?
You really do need to use an updated proxy_orbiter binary for Touch Orbiter or Web Orbiter 2.0 as they both rely heavily on the new features in proxy_orbiter. See posde's post re his 7.10 version here; http://forum.linuxmce.org/index.php?topic=10483.0
Quote

2. I am having problems with the Image returned. It currently will not decode. I am also getting problems if I try to open the PNG file generated by Proxy Orbiter  (mine is 64_web.png) on my dev machine. It complains that it is an invalid PNG file (when opened by Ubuntu 10.04) however seems to open in Firefox OK. Any suggestions?
I'll point my colleague Uplink at your question above and get him to give you some assistance... he wrote the Touch Orbiter for WinCE 5.0.
Quote

regards
Darren
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

uplink

  • Administrator
  • Guru
  • *****
  • Posts: 192
  • Linux and LinuxMCE witchdoctor
    • View Profile
2. I am having problems with the Image returned. It currently will not decode. I am also getting problems if I try to open the PNG file generated by Proxy Orbiter  (mine is 64_web.png) on my dev machine. It complains that it is an invalid PNG file (when opened by Ubuntu 10.04) however seems to open in Firefox OK. Any suggestions?

Be aware that Proxy_Orbiter returns JPEG images if the "ImageQuality" Device Data is anything but 100. This value defaults to 70 and is passed to the JPEG encoding library. If it's 100, PNG images are generated instead.

Marie.O

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 3676
  • Wastes Life On LinuxMCE Since 2007
    • View Profile
    • My Home
1. What changes have been made to Proxy_Orbiter? Is it just the 'ANYNEWS?' command support. The reason I ask is that me server is still 7.10 so has the old version. This should still be usable, correct?

I build a version for 710. It is linked from a sticky forum post.

mihajzm

  • Regular Poster
  • **
  • Posts: 43
    • View Profile
I answer your first question:
You must install the new ProxyOrbiter to your server. Simply follow the instructions in this thread: http://forum.linuxmce.org/index.php?topic=10483.0

mihajzm

coley

  • Guru
  • ****
  • Posts: 492
    • View Profile
I took mihajzm's code and I've just compiled this for N900 - it being arm wasn't too hard a task  :) Doing it on Nokia/Windys SDK was the hardest part!
Once I get my packaging dependencies sorted I can generate a deb file.

-Coley.

ah might check Maemo orbiter pkg gen for dependency stuff.
 -stupid busted SDK  >:( , I can only create rudimentary deb, gonna have to move it over to linux to create proper deb.
« Last Edit: August 20, 2010, 05:32:56 pm by coley »

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
I took mihajzm's code and I've just compiled this for N900 - it being arm wasn't too hard a task  :) Doing it on Nokia/Windys SDK was the hardest part!
Once I get my packaging dependencies sorted I can generate a deb file.

-Coley.

ah might check Maemo orbiter pkg gen for dependency stuff.

Hey thats cool :-)

Can I ask everyone who is working on a version of Touch Orbiter to make sure they create a ticket for it and attach the source code to it, create a basic Wiki page for your version (and link to it from the main Touch Orbiter wiki page too). I'd like to make sure that finding your version and getting working is as easy and documented as possible.

Its exciting to see so much great work going on around Touch Orbiter :-)

All the best


Andrew
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
1. What changes have been made to Proxy_Orbiter? Is it just the 'ANYNEWS?' command support. The reason I ask is that me server is still 7.10 so has the old version. This should still be usable, correct?

I build a version for 710. It is linked from a sticky forum post.


Thanks posde, I had already downloaded the version that you posted some time back but it doesn't seem to support ANYNEWS?

I am constantly getting ERROR returned.

This is the relevant parts from the log files;
05      08/20/10 19:03:24.552           ^[[33;1mReceived ANYNEWS?, but device hasn't identified itself yet.^[[0m <0xb41e6b90>
05      08/20/10 19:03:24.552           ^[[33;1mReceived: ANYNEWS?^[[0m <0xb41e6b90>
05      08/20/10 19:03:24.552           ^[[33;1mNot a valid communication tokey. Check the specs. Sending error...^[[0m <0xb41e6b90>

I have definitely replaced the executable with the one that you provided but it doesn't appear to support ANYNEWS?

Any suggestions?

Regards
Darren

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Hi,

Can someone do me a favour and check the status of their proxy_orbiter - particularly if it is the 7.10 version that posde built.

You should be able to telnet to the server on the proxy_orbiter port (3461 by default I think) and issue ANYNEWS? and get a valid response.

I am consistently getting an ERROR response and from the log fragment I posted before it appears to be unsupported.

I have tried building me own version but are getting seg faults on it at the moment and havn't had a chance to look any further.

I am still having problems dealing with the IMAGE stream that is sent back to. I have my code working with static files (PNG or JPG) and I also made it work with a http streamed version of the file (similar to how I did the Chumby orbiter - see wiki). The android BitmapFactory doesn't give a lot of error feedback - you seem to get a valid object or NULL.

I will try a few more things but open to suggestions....

Regards
Darren

uplink

  • Administrator
  • Guru
  • *****
  • Posts: 192
  • Linux and LinuxMCE witchdoctor
    • View Profile
What characters are you sending after "ANYNEWS?" and "IMAGE"? Can you verify the string you send ends just with \n, not \r\n? I didn't look in the code right now, so I'm just throwing a guess, but maybe Proxy_Orbiter is picky about that. Do you have any source code I can look at?

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
What characters are you sending after "ANYNEWS?" and "IMAGE"? Can you verify the string you send ends just with \n, not \r\n? I didn't look in the code right now, so I'm just throwing a guess, but maybe Proxy_Orbiter is picky about that. Do you have any source code I can look at?

From the code; I think I was using a PrintWriter and using println - so that should be '\n' on a linux dev box.

From Telnet; Telnetting from a local shell (on Ubuntu 10.04 machine) and just pressing enter, which again should just send '\n'

Both return the data for IMAGE (just can't seem to use it) and both return 'ERROR' for 'ANYNEWS?'

The code is at home so I will confirm and post what it is doing. Don't think it is a problem though; the ProxyOrbiter code is 'else if (sLine.substr(0, 8) == "ANYNEWS?")' so shouldn't care about extra characters.

Hopefully get another look at it tonight when I get home. For the IMAGE problem : Might try and stream the IMAGE to a file and then compare it with the server file. For ANYNEWS? problem : Might see if I can get my own version running .

Thanks for helping.

Darren

totallymaxed

  • LinuxMCE God
  • ****
  • Posts: 4660
  • Smart Home Consulting
    • View Profile
    • Dianemo - at home with technology
What characters are you sending after "ANYNEWS?" and "IMAGE"? Can you verify the string you send ends just with \n, not \r\n? I didn't look in the code right now, so I'm just throwing a guess, but maybe Proxy_Orbiter is picky about that. Do you have any source code I can look at?

From the code; I think I was using a PrintWriter and using println - so that should be '\n' on a linux dev box.

From Telnet; Telnetting from a local shell (on Ubuntu 10.04 machine) and just pressing enter, which again should just send '\n'

Both return the data for IMAGE (just can't seem to use it) and both return 'ERROR' for 'ANYNEWS?'

The code is at home so I will confirm and post what it is doing. Don't think it is a problem though; the ProxyOrbiter code is 'else if (sLine.substr(0, 8) == "ANYNEWS?")' so shouldn't care about extra characters.

Hopefully get another look at it tonight when I get home. For the IMAGE problem : Might try and stream the IMAGE to a file and then compare it with the server file. For ANYNEWS? problem : Might see if I can get my own version running .

Thanks for helping.

Darren

Hi Darren,

I'd recommend persisting as I am pretty sure that your problems are local to you. Also proxy_orbiter is going to get more enhancements in the future to support enhanced UI features on the device running Touch Orbiter etc.

If you can't work out whats happening post your code here or get a preliminary version into the svn so that we can grab it and look it over to help you.

All the best


Andrew
Andy Herron,
CHT Ltd

For Dianemo/LinuxMCE consulting advice;
@herron on Twitter, totallymaxed+inquiries@gmail.com via email or PM me here.

Get Dianemo-Rpi2 ARM Licenses http://forum.linuxmce.org/index.php?topic=14026.0

Get RaspSqueeze-CEC or Raspbmc-CEC for Dianemo/LinuxMCE: http://wp.me/P4KgIc-5P

Facebook: https://www.facebook.com/pages/Dianemo-Home-Automation/226019387454465

http://www.dianemo.co.uk

uplink

  • Administrator
  • Guru
  • *****
  • Posts: 192
  • Linux and LinuxMCE witchdoctor
    • View Profile
I guess you're using this: http://developer.android.com/reference/android/graphics/BitmapFactory.html and decodeFile works but decodeByteArray isn't? That would be strange. Save those bytes to file and see what you get different. Those exact same bytes are written to file before serving the web browser.

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
I guess you're using this: http://developer.android.com/reference/android/graphics/BitmapFactory.html and decodeFile works but decodeByteArray isn't? That would be strange. Save those bytes to file and see what you get different. Those exact same bytes are written to file before serving the web browser.

Yeah basically... I saved the byte array to a file last night and compared the file to the image file on the server. The result; Not even close and no similarities. Chekced for bits being reversed per byte and per word but nothing to align the two at all. And the biggest problem was that the received byte array was quite short. They were both the same physical size (this is expected as the buffer is built from the size parameter passed back - which is right ) but the received array only occupies the first couple of hundred bytes, the rest being null.

I have looked at the server code and it seems to just read the server file and stream it across the socket so there is not much that can go wrong there. So I am supspect of the stream itself.

Next thing to try is a local coded client to stream the file from the socket (and write to a file). Will try a java one first and C one if necessary - if that works fine then it is definately something to do with the Android code.

I am still suspect of the endianess being different so I will have to look into that but the fact that the size of the stream received seemsto be so small is a worry. (Keep in mind I am running on the Android emulator which I think emulates ARM )

Anyway - Still on it. Hope to get it working over the weekend.

Darren

uplink

  • Administrator
  • Guru
  • *****
  • Posts: 192
  • Linux and LinuxMCE witchdoctor
    • View Profile
When you set the quality to 100, does your array even start with the PNG signature, even if it's truncated, or does it start with garbage? If you do get the PNG signature, then check if your read function doesn't return early (which means you'll have to loop to get the rest of the bytes).

Here's what you should be looking for: http://en.wikipedia.org/wiki/Portable_Network_Graphics#File_header

A PNG file starts with an 8-byte signature. The hexadecimal byte values are 89 50 4E 47 0D 0A 1A 0A; the decimal values are 137 80 78 71 13 10 26 10. Each of the header bytes is there for a specific reason:[4]

Bytes                    Purpose
89Has the high bit set to detect transmission systems that do not support 8 bit data and to reduce the chance that a text file is mistakenly interpreted as a PNG, or vice versa.
50 4E 47In ASCII, the letters PNG, allowing a person to identify the format easily if it is viewed in a text editor.
0D 0AA DOS-style line ending (CRLF) to detect DOS-UNIX line ending conversion of the data.
1AA byte that stops display of the file under DOS when the command type has been used—the end-of-file character
0AA UNIX-style line ending (LF) to detect UNIX-DOS line ending conversion.
« Last Edit: August 27, 2010, 01:16:37 am by uplink »

darrenmason

  • Addicted
  • *
  • Posts: 529
    • View Profile
Thanks uplink...

Some progress ... Wrote a test Java client to stream the image and write to file. Had a couple of issues but got to a point where it worked fine and the image is what is expected.

So I know the Proxy_orbiter is at least delivering a valid image on my machine so there is no problem there. Moving effectively the same code to Android gave me some progress but not a result yet. Ran out of time but at least I can do side by side comparisons of the stream reading code (which is almost identical) to see exactly what is happening. Have already discovered that some of the InputStream classes were not doing what I expected.

Will update when I know a bit more...