Author Topic: Java/ J2ME mobile orbiter  (Read 312530 times)

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: Java/ J2ME mobile orbiter
« Reply #240 on: November 29, 2008, 12:35:37 am »
Hi,

I've made some progress. I've implemented handling of repeated key presses. I uploaded the files to the same location as previously.
(Also added preliminary handling of the left soft key of my SE phone)

crudpuppy: I plan on making a patch for the current SVN as soon as I get the time.

My next task after that will be adding a working key mapping for my SE W580 phone (and K800i). I also have some problems with the orbiter disconnecting (both at the phone/server side and at the MD/client side), which I haven't solved yet.

Regarding jsr075:
If I understand correctly, won't the VMC need to store files on the phone also? (Maybe that's what you were referring to in your last post, hari.) Haven't really looked into what VMC is, but my understanding is that it uses WAP for communications and displays pictures stored at the phone. Am I imagining things, or am I on to something  ;)

sambuca

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Java/ J2ME mobile orbiter
« Reply #241 on: November 29, 2008, 09:45:47 am »
for vmc we should use the datastore. I was refering to using jsr75 for spitting out logfiles.

br, Hari
rock your home - http://www.agocontrol.com home automation

crudpuppy

  • Newbie
  • *
  • Posts: 10
  • Hitec Redneck
    • View Profile
    • Infinifire - Freelance Web development
Re: Java/ J2ME mobile orbiter
« Reply #242 on: November 29, 2008, 02:34:08 pm »
I'm not sure all of what I would put in it but I'm thinking of doing out a "Settings" set of screens.  One thing I know might be beneficial would be settings for the image quality etc for slower(or faster) bluetooth systems on certain phones.  I can use the datastore on the phone for storing these but was thinking for defaults about loading from a config.xml kinda thing....pretty sure I would have to use jsr075 to read that though. 

Sambuca,

What files are you/have you changed?  I could work seperatly as I'm not really changing the "server interaction" classes it more about UI for me right now.

Sambuca and Hari,

I would have to edit most all files to implement the jsr075 logging properly.  I would of cource create a logger class kinda thing and have it driven off the availablity and maybe a setting as well.  Would default back to doing printlns in case jsr075 not there. I don't want to run into issues with trying to merge or mess up each others code.

I work for myself and my schedule is a bit "wierd" so I prolly wont have much more extra time to do this stuff then you guys.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java/ J2ME mobile orbiter
« Reply #243 on: November 29, 2008, 03:51:53 pm »
I meant to write this yesterday, but got sidetracked....

VMC stands for VIP Menu Container, and has its roots in a Pluto business venture called PlutoVIP.

Huh? Let me explain.

Pluto had envisioned a system where PlutoMO was at the center. You would be at home, and your mobile orbiter would control the house. During the connection exchange, the core would send the latest VMC file. This would be the file for your house containing a set of predefined orbiter scenarios arranged into menus that you could use outside your home, so that you can for example, turn on and off your lights, view cameras, set security mode, etc.

Once you left the house and went into certain business and shopping establishments, the phone would sense VIPEstablishment installations, and your phone would connect with them in the same way that it connects with your house, and would send another VMC file to your phone, containing a nicely generated menu of things you could do in and out of the establishment. It would also notify the establishment that you were in the shop/business, and their computers would do the right thing and bring up customer data etc.

The VMC files themselves, could be done by each business using the VIPDesign program, to create graphic files with text and menu options that could dynamically change, which would point to WAP pages for your cell phone.

This would leave a number of VMC files on your phone, which you could select when you start the PlutoMO orbiter program, and would automatically be selected for you when you approached an establishment as part of the orbiter connect exchange.

Basically, this was a personalized business transaction system that never got past the proof of concept stage.

It is useful directly for our purposes for offline menu use, but we could extend it to other things as well.

-Thom



crudpuppy

  • Newbie
  • *
  • Posts: 10
  • Hitec Redneck
    • View Profile
    • Infinifire - Freelance Web development
Re: Java/ J2ME mobile orbiter
« Reply #244 on: November 29, 2008, 04:27:30 pm »
So if I understadn VMC would for this/us be a great way to "cache" the menu systems?  If so I would think jsr075 would be good for that purpose as well.

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java/ J2ME mobile orbiter
« Reply #245 on: November 29, 2008, 04:29:39 pm »
No, VMC is meant entirely for a different purpose, and is static by nature. Don't go there. *smack-hand-with-ruler* :P

-Thom

crudpuppy

  • Newbie
  • *
  • Posts: 10
  • Hitec Redneck
    • View Profile
    • Infinifire - Freelance Web development
Re: Java/ J2ME mobile orbiter
« Reply #246 on: November 29, 2008, 04:46:53 pm »
ouch that smack hurt....sorry still new to the under pinnings of this all.  I've been using the system from end user side for a while...still don't get all the pieces running the back fully. 

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Java/ J2ME mobile orbiter
« Reply #247 on: November 29, 2008, 05:28:25 pm »
crude puppy, please forget that jsr75. It is not supported by most phones. VMC shall go into the datastore.

br, Hari
rock your home - http://www.agocontrol.com home automation

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: Java/ J2ME mobile orbiter
« Reply #248 on: November 29, 2008, 06:27:53 pm »
crudpuppy,

I did a few changes to some of the gui classes also. Also I added a common logging method, which could be extended more. I guess some static logger class might be the way to go. (I use this concept in J2EE). This would allow us to set it up to log to screen, file, another bluetooth connection, or whatever.

Btw, have you checked if there exists some kind of logging support already in J2ME?

Sorry if I am holding you up, I'll see if I can make a patch tomorrow.

br,
sambuca

crudpuppy

  • Newbie
  • *
  • Posts: 10
  • Hitec Redneck
    • View Profile
    • Infinifire - Freelance Web development
Re: Java/ J2ME mobile orbiter
« Reply #249 on: November 29, 2008, 07:05:52 pm »
I've done similar in J2EE thus where I got the premise for a static class as well ;-)

J2ME has problems with any logging since even System.out is not usable in many mobile devices.  There are a couple of "log frameworks" out there including ones based on log4j

No biggie on the hold up...like I said my time to work is also limited so I can understand.  What changes did you make to the GUI classes so far?  This thing could really use a UI overhaul.   This is the first J2ME I've done and have already realized the UI side of it is rather a pain.  My rust from 2 years off from java is wearing off quick though...like riding a bike...hehe

sambuca

  • Guru
  • ****
  • Posts: 462
    • View Profile
Re: Java/ J2ME mobile orbiter
« Reply #250 on: November 30, 2008, 08:19:49 pm »

Here is my patch, finally ;)
I threw together a quick static logging class, and switched my new logging to use it. I thought it might be easier to change it to a logging framework later on when done like this. Not sure how big these frameworks are, and if we want to add it to the MO though. We could probably disable them at build time however...
 
Code: [Select]
Index: Makefile
===================================================================
--- Makefile (revision 21508)
+++ Makefile (working copy)
@@ -28,6 +28,8 @@
  ${JAVAC} ${CFLAGS} com/linuxmce/javamo/BD_CP_ShowImage.java
  ${JAVAC} ${CFLAGS} com/linuxmce/javamo/BD_CP_ShowList.java
  ${JAVAC} ${CFLAGS} com/linuxmce/javamo/BD_CP_Dummy.java
+ ${JAVAC} ${CFLAGS} com/linuxmce/javamo/log/MOLogger.java
+ ${JAVAC} ${CFLAGS} com/linuxmce/javamo/log/Logger.java
  ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.${MIDLETNAME}
  ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.${MIDLETNAME}\$$DrawImageCanvas
  ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.${MIDLETNAME}\$$ListCommandListener
@@ -47,6 +49,8 @@
  ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.BD_CP_ShowImage
  ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.BD_CP_ShowList
  ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.BD_CP_Dummy
+ ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.log.MOLogger
+ ${WTKPATH}/bin/preverify -classpath ${API} com.linuxmce.javamo.log.Logger
  mkdir -p output/com/linuxmce/javamo/res
  cp res/icon.png output/com/linuxmce/javamo/res
  cd output && jar cvfm ${MIDLETNAME}.jar Manifest.mf ./com
Index: com/linuxmce/javamo/BDCommandProcessor.java
===================================================================
--- com/linuxmce/javamo/BDCommandProcessor.java (revision 21508)
+++ com/linuxmce/javamo/BDCommandProcessor.java (working copy)
@@ -19,11 +19,14 @@
 
 package com.linuxmce.javamo;
 
-import javax.microedition.lcdui.*;
-import javax.microedition.midlet.*;
 import javax.microedition.io.StreamConnection;
+
+import com.linuxmce.javamo.log.MOLogger;
+
 import java.util.*;
-import java.io.*;
+import java.io.OutputStream;
+import java.io.InputStream;
+import java.io.IOException;
 
 /**
  * Class to process BDCommands
@@ -46,12 +49,13 @@
  this.mJavaMO = javamo;
  this.m_connection = connection;
  connected = true;
- commandQueue = new Vector();
+ commandQueue = new Vector(20);
  try {
  m_os = m_connection.openOutputStream();
  m_is = m_connection.openInputStream();
  } catch (IOException e) {
- System.err.println(e);
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, e.toString());
  }
  processorThread = new Thread(this);
  processorThread.start();
@@ -92,29 +96,25 @@
  m_os.flush();
  System.out.println("SendLong:" + output);
  } catch (IOException e) {
- System.err.println(e);
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, e.toString());
  connected = false;
  }
  }
 
- private long ReceiveLong() {
+ private long ReceiveLong() throws IOException {
  long output = 0;
  int a1,a2,a3,a4;
- try {
- a1 = (int)m_is.read();
- // System.out.println("ReceiveLong: got byte: " + a1);
- a2 = (int)m_is.read();
- // System.out.println("ReceiveLong: got byte: " + a2);
- a3 = (int)m_is.read();
- // System.out.println("ReceiveLong: got byte: " + a3);
- a4 = (int)m_is.read();
- // System.out.println("ReceiveLong: got byte: " + a4);
- output = (a1) + (a2*0x100) + (a3*0x10000) + (a4*0x1000000);
- System.out.println("ReceiveLong: long result: " + output);
- } catch (IOException e) {
- System.err.println(e);
- connected = false;
- }
+ a1 = (int)m_is.read();
+ // System.out.println("ReceiveLong: got byte: " + a1);
+ a2 = (int)m_is.read();
+ // System.out.println("ReceiveLong: got byte: " + a2);
+ a3 = (int)m_is.read();
+ // System.out.println("ReceiveLong: got byte: " + a3);
+ a4 = (int)m_is.read();
+ // System.out.println("ReceiveLong: got byte: " + a4);
+ output = (a1) + (a2*0x100) + (a3*0x10000) + (a4*0x1000000);
+ System.out.println("ReceiveLong: long result: " + output);
  return output;
  }
 
@@ -126,27 +126,41 @@
  }
  m_os.flush();
  } catch (IOException e) {
- System.err.println(e);
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, e.toString());
  connected = false;
  }
  }
 
+ private void readFully(byte[] data) throws IOException {
+ int i = 0;
+ while(i < data.length) {
+ int count = m_is.read(data, i, data.length - i);
+ if (count > 0) {
+ i += count;
+ }
+ }
+ }
+
  private byte[] ReceiveData() {
  int size;
- size = (int)ReceiveLong();
+ try {
+ size = (int)ReceiveLong();
 
- if (size < 0) {
- size=0;
+ if (size < 0) {
+ size=0;
+ connected = false;
+ }
+ } catch (IOException e) {
  connected = false;
+ size = 0;
  }
-
  byte[] data = new byte[size];
  try {
- for (int i=0;i<size;i++) {
- data[i] = (byte)m_is.read();
- }
+ readFully(data);
  } catch (IOException e) {
- System.err.println(e);
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BDCommandProcessor.ReceiveData() : " + e.toString());
  connected = false;
  }
  return data;
@@ -182,7 +196,6 @@
 
  public void run() {
  BDCommand l_BDResponseCommand;
-       int data;
  int counter = 0;
  long commandtype;
  BD_PC_WhatDoYouHave l_BD_PC_WhatDoYouHave;
@@ -199,7 +212,7 @@
  l_BD_PC_ReportMyVersion = null;
 
  /* set quality to 100 (png) */
- commandToSend = new BD_PC_SetImageQuality(100);
+ commandToSend = new BD_PC_SetImageQuality(30);
  commandToSend.ConvertCommandToBinary();
  sendCommand(commandToSend);
  commandToSend.ReceiveData(ReceiveData());
@@ -207,57 +220,75 @@
  commandToSend = null;
 
  while (connected) {
-
- if (commandQueue.isEmpty()) {
- if (counter++ == 5) {
- counter = 0;
- /* no outgoing commands in the queue, send BD_PC_WHAT_DO_YOU_HAVE */
- l_BD_PC_WhatDoYouHave = new BD_PC_WhatDoYouHave();
- l_BD_PC_WhatDoYouHave.ConvertCommandToBinary();
- sendCommand(l_BD_PC_WhatDoYouHave);
-
- /* if commandtype != 100 (BD_CP_WE_HAVE_NOTHING) build command and handle it */
- commandtype = ReceiveLong();
- if (commandtype != 100) {
- l_BDResponseCommand = buildCommandFromData(commandtype);
- l_BDResponseCommand.ReceiveData(ReceiveData());
- l_BDResponseCommand.parseCommand();
- l_BDResponseCommand.processCommand(mJavaMO);
- l_BDResponseCommand.ConvertAckToBinary();
- sendAck(l_BDResponseCommand);
- l_BDResponseCommand = null;
- } else {
- /* handle BD_CP_WE_HAVE_NOTHING */
- ReceiveLong();
- sendAck(l_BD_PC_WhatDoYouHave);
+ try {
+ if (commandQueue.isEmpty()) {
+ if (counter++ == 5) {
+ counter = 0;
+ /* no outgoing commands in the queue, send BD_PC_WHAT_DO_YOU_HAVE */
+ l_BD_PC_WhatDoYouHave = new BD_PC_WhatDoYouHave();
+ l_BD_PC_WhatDoYouHave.ConvertCommandToBinary();
+ sendCommand(l_BD_PC_WhatDoYouHave);
+
+ commandtype = ReceiveLong();
+ // If read return -1 (EOF) we should not try to do anything
+ if (commandtype >= 0) {
+ /* if commandtype != 100 (BD_CP_WE_HAVE_NOTHING) build command and handle it */
+ if (commandtype != 100) {
+ mJavaMO.addMessage("Got command " + commandtype);
+ l_BDResponseCommand = buildCommandFromData(commandtype);
+ l_BDResponseCommand.ReceiveData(ReceiveData());
+ l_BDResponseCommand.parseCommand();
+ l_BDResponseCommand.processCommand(mJavaMO);
+ l_BDResponseCommand.ConvertAckToBinary();
+ sendAck(l_BDResponseCommand);
+ l_BDResponseCommand = null;
+
+ // We got one command, lets see if there is anything else right away
+ counter = 5;
+ } else {
+ /* handle BD_CP_WE_HAVE_NOTHING */
+ ReceiveLong();
+ sendAck(l_BD_PC_WhatDoYouHave);
+ }
+ }
+ l_BD_PC_WhatDoYouHave = null;
  }
- l_BD_PC_WhatDoYouHave = null;
- // this.currentThread().sleep(100);
- }
- /* go to sleep to save power */
- try {
- processorThread.sleep(100);
- } catch (InterruptedException e) {
+ /* go to sleep to save power */
+ try {
+ Thread.sleep(100);
+ } catch (InterruptedException e) {
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BDCommandProcessor.run(): " + e.getMessage());
+ }
+ } else {
+ /* pop command from the queue */
+ commandToSend = (BDCommand) commandQueue.firstElement();
+ commandQueue.removeElement((Object) commandToSend);
+
+ /* send the command */
+ commandToSend.ConvertCommandToBinary();
+ sendCommand(commandToSend);
+ commandToSend.ReceiveData(ReceiveData());
+ commandToSend.parseAck();
+ commandToSend = null;
+
+ /* send what do you have without further sleeping after sending a command */
+ counter = 5;
  }
-
- } else {
- /* pop command from the queue */
- commandToSend = (BDCommand) commandQueue.firstElement();
- commandQueue.removeElement((Object) commandToSend);
-
- /* send the command */
- commandToSend.ConvertCommandToBinary();
- sendCommand(commandToSend);
- commandToSend.ReceiveData(ReceiveData());
- commandToSend.parseAck();
- commandToSend = null;
-
- /* send what do you have without further sleeping after sending a command */
- counter = 5;
+ } catch (IOException e) {
+ // Catch IOException, so we skip processing relying on received data
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BTCommandProcessor.run() : " + e.toString());
+ connected = false;
+ } catch (Exception e) {
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BTCommandProcessor.run() : " + e.toString());
+ // Not necessarily disconnected, but we should probably restart
+ connected = false;
  }
-
-
  }
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BDCommandProcessor.run(): Not connected anymore");
 
  }
 
Index: com/linuxmce/javamo/BTServer.java
===================================================================
--- com/linuxmce/javamo/BTServer.java (revision 21508)
+++ com/linuxmce/javamo/BTServer.java (working copy)
@@ -37,6 +37,8 @@
 
 import javax.bluetooth.*;
 
+import com.linuxmce.javamo.log.MOLogger;
+
 /**
  * Bluetooth server for J2ME using JSR82
  */
@@ -119,7 +121,7 @@
  /* listen for connections */
  conn = notifier.acceptAndOpen();
 
- parent.showAlert("CONNECT",3000);
+ parent.addMessage("Connected");
 
  /* BD Command processor to handle commands */
  System.out.println("BTServer: starting BDCommandProcessor...");
@@ -132,16 +134,27 @@
  System.out.println("BTServer: waiting for BDCommandProcessor to finish...");
  m_BDCommandProcessor.processorThread.join();
  } catch (InterruptedException e) {
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BTServer.run() : " + e.getMessage());
  }
 
- m_BDCommandProcessor = null;
- conn.close();
- parent.showAlert("DISCONNECT",3000);
- parent.showForm();
-
  } catch (IOException e) {
  // wrong client or interrupted - continue anyway
- continue;
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BTServer.run() : " + e.getMessage());
+ } finally {
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "Disconnect!");
+ parent.showForm();
+ m_BDCommandProcessor = null;
+ if (conn != null) {
+ try {
+ conn.close();
+ } catch (Exception e) {
+ if (MOLogger.DEBUG)
+ MOLogger.log(0, "BTServer.run() : " + e.toString());
+ }
+ }
  }
  // processor.addConnection(conn);
 
Index: com/linuxmce/javamo/JavaMO.java
===================================================================
--- com/linuxmce/javamo/JavaMO.java (revision 21508)
+++ com/linuxmce/javamo/JavaMO.java (working copy)
@@ -22,15 +22,8 @@
 import javax.microedition.lcdui.*;
 import javax.microedition.midlet.*;
 
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-
-import javax.microedition.io.Connector;
-import javax.microedition.io.StreamConnection;
-import javax.microedition.io.StreamConnectionNotifier;
-import javax.microedition.rms.*;
+import com.linuxmce.javamo.log.Logger;
+import com.linuxmce.javamo.log.MOLogger;
 
 /**
  * Java Mobile Orbiter for LinuxMCE/Plutohome
@@ -40,7 +33,7 @@
  */
 public class JavaMO
     extends MIDlet
-    implements CommandListener {
+    implements CommandListener, Logger {
 
  private Canvas mCanvas;   
  private Image mImage;
@@ -57,6 +50,8 @@
 
  mMainForm = new Form("JavaMO");
 
+ MOLogger.setLogger(this);
+
  /* check for jsr082 */
  try {
  Class.forName("javax.bluetooth.LocalDevice");
@@ -129,22 +124,22 @@
  } else {
  listActive = false;
  }
+ turnBackLightOn();
  }
 
  /**
  * Shows a list with media elements
  */
  public void showList(String[] list) {
- mList = new List ("Media", List.IMPLICIT);
- for (int i=0; i < list.length; i++) {
- mList.append(list[i], null);
- }
- // Command selectCommand = new Command("Select", Command.ITEM, 1);
- // mList.setSelectCommand(selectCommand);
+ mList = new List ("Media", List.IMPLICIT, list, null);
+ Command selectCommand = new Command("Select", Command.ITEM, 1);
+ mList.setSelectCommand(selectCommand);
  mList.setCommandListener(new ListCommandListener());
+ mList.addCommand(new Command("Exit", Command.BACK, 2));
+
  Display.getDisplay(this).setCurrent(mList);
  listActive = true;
-
+ turnBackLightOn();
  }
 
  /**
@@ -176,6 +171,8 @@
  return 32; /* BUTTON_Asterisk_CONST */
  case Canvas.KEY_POUND:
  return 33; /* BUTTON_Pound_CONST */
+ case -6: // Sony Ericsson left soft key
+ return 30; // Soft left key
  case -7: /* mpp sim right soft key */
  case -8: /* Nokia N73 C key */
  return 26; /* BUTTON_Phone_C_CONST */
@@ -247,6 +244,8 @@
  * Canvas class to show the image on the screen and report keystrokes back
  */
  private class DrawImageCanvas extends Canvas {
+ private int lastKeyCode = 0;
+
  public void paint(Graphics g) {
  g.drawImage(mImage, 0, 0, Graphics.TOP | Graphics.LEFT);
  }
@@ -260,18 +259,24 @@
  }
 
  protected void keyReleased(int keyCode) {
+ if (lastKeyCode == 0) {
  //if (keyCode > 0) {
  // commandProcessor.addCommandToQueue(new BD_PC_KeyWasPressed(translateKey(keyCode),0));
  commandProcessor.addCommandToQueue(new BD_PC_KeyWasPressed(translateKey(keyCode),2));
  System.out.println("keyReleased " + ((int)keyCode));
  //} else {
  // System.out.println("keyReleased action " + getGameAction(keyCode));
- //}
+ //}
+ }
+ lastKeyCode = 0;
  }
 
  protected void keyRepeated(int keyCode) {
- commandProcessor.addCommandToQueue(new BD_PC_KeyWasPressed(translateRepeatedKey(keyCode),1));
- System.out.println("repeatedKeyReleased " + ((int)keyCode));
+ if (keyCode != lastKeyCode) {
+ lastKeyCode = keyCode;
+ commandProcessor.addCommandToQueue(new BD_PC_KeyWasPressed(translateRepeatedKey(keyCode),1));
+ System.out.println("repeatedKeyReleased " + ((int)keyCode));
+ }
 
  }
  protected void pointerPressed(int x, int y) {
@@ -281,6 +286,24 @@
  }
  }
 
+ public void addMessage(String message) {
+ while (mMainForm.size() > 20) {
+ mMainForm.delete(mMainForm.size()-1);
+ }
+ mMainForm.insert(0, new StringItem(null, message));
+ }
+
+ public void log(int level, String message) {
+ addMessage(message);
+ }
+
+ /**
+ * Turns backlign on
+ */
+ public void turnBackLightOn() {
+ Display.getDisplay(this).flashBacklight(1);
+ }
+
  /**
  * Command listener for the list
  */
@@ -289,7 +312,7 @@
  public void commandAction (Command c, Displayable d) {
  long item = -1;
  List list;
- if (c == List.SELECT_COMMAND) {
+ if (c == List.SELECT_COMMAND || c.getLabel().equals("Select")) {
  listActive = false;
  list = (List) d;
  item = list.getSelectedIndex();
@@ -299,6 +322,10 @@
  commandProcessor.addCommandToQueue(new BD_PC_SelectedFromList(item));
  // send enter
  commandProcessor.addCommandToQueue(new BD_PC_KeyWasPressed(5,2));
+ } else if (c.getLabel().equals("Exit")) {
+ listActive = false;
+ // Send C key
+ commandProcessor.addCommandToQueue(new BD_PC_KeyWasPressed(26,2));
  }
  }
  }
Index: com/linuxmce/javamo/log/Logger.java
===================================================================
--- com/linuxmce/javamo/log/Logger.java (revision 0)
+++ com/linuxmce/javamo/log/Logger.java (revision 0)
@@ -0,0 +1,6 @@
+package com.linuxmce.javamo.log;
+
+public interface Logger {
+
+ public void log(int level, String message);
+}
Index: com/linuxmce/javamo/log/MOLogger.java
===================================================================
--- com/linuxmce/javamo/log/MOLogger.java (revision 0)
+++ com/linuxmce/javamo/log/MOLogger.java (revision 0)
@@ -0,0 +1,20 @@
+package com.linuxmce.javamo.log;
+
+public class MOLogger {
+
+ static public final boolean DEBUG = true;
+ static Logger logger;
+
+ static public void setLogger(Logger logr) {
+ logger = logr;
+ }
+
+ static public void log(int level, String message) {
+ if (logger != null) {
+ logger.log(level, message);
+ } else {
+ System.out.println(message);
+ }
+ }
+
+}

Hari, just ask if you see anything fishy.

crudpuppy, the UI displayed is mostly just images sent over bluetooth from the MD. As such, you need to use the HADesigner to change the orbiter GUI. If that was what you were thinking of?

br, sambuca

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Java/ J2ME mobile orbiter
« Reply #251 on: November 30, 2008, 08:33:26 pm »
Hari, just ask if you see anything fishy.
I'll commit it anyway so I can use trac to see the changes :-)

Committed revision 21528.
Committed revision 21529.

br, Hari
rock your home - http://www.agocontrol.com home automation

crudpuppy

  • Newbie
  • *
  • Posts: 10
  • Hitec Redneck
    • View Profile
    • Infinifire - Freelance Web development
Re: Java/ J2ME mobile orbiter
« Reply #252 on: November 30, 2008, 08:39:15 pm »
Well here is my thing on the UI...I know the images for the UI of controlling the media director are basically hard set coming from the media directory themselves.  I was thinking though there would be a great use for a "Intro" page that allowed a user to goto a settings page(for key mappings and/or whatever else we may think of), an about page(with tribute to hari :-P), and then a connect button etc....With the current setup would be problamatic to put into place a "Settings" area with it connecting immediatly to the orbiter.  I may be crazy but that is the idea.

Let me know thoughts.

hari

  • Administrator
  • LinuxMCE God
  • *****
  • Posts: 2428
    • View Profile
    • ago control
Re: Java/ J2ME mobile orbiter
« Reply #253 on: November 30, 2008, 08:44:03 pm »
when the phone has a bluetooth_dongle instance connected, we should do what the server tells us. Without connection, we should show the VMC menu. We could add a special "Setup" option there.

br, Hari
rock your home - http://www.agocontrol.com home automation

tschak909

  • LinuxMCE God
  • ****
  • Posts: 5549
  • DOES work for LinuxMCE.
    • View Profile
Re: Java/ J2ME mobile orbiter
« Reply #254 on: November 30, 2008, 08:44:43 pm »
Well, this would be an extension of the VMC page currently on the Symbian and Windows Smartphone orbiters.

On the standard PlutoMO orbiters when offline, you get the opportunity to select a VMC to use. It could be extended here.

-Thom