uk.co.silentsoftware.ui.views
Class MainView

java.lang.Object
  extended by javax.microedition.lcdui.Displayable
      extended by javax.microedition.lcdui.Canvas
          extended by uk.co.silentsoftware.ui.views.AbstractCanvasView
              extended by uk.co.silentsoftware.ui.views.MainView
All Implemented Interfaces:
java.lang.Runnable, javax.microedition.lcdui.CommandListener, GPSDataView

public class MainView
extends AbstractCanvasView
implements GPSDataView, java.lang.Runnable

Simple main menu - provides options to access other views and has a ticker to show current latitude/longitude since it is also a GPSDataView Note that the design has tight integration between this and the midlet because this view provides access to all of the functionality of the application. As the phone is not a compass the arrow only points in the correct direction once the user has started moving, i.e. by staying at a fixed point a satellite would not know which way the user is facing and so cannot tell North. Once the user moves a certain direction it can determine North from the directional vector.


Field Summary
 
Fields inherited from class javax.microedition.lcdui.Canvas
DOWN, FIRE, GAME_A, GAME_B, GAME_C, GAME_D, KEY_NUM0, KEY_NUM1, KEY_NUM2, KEY_NUM3, KEY_NUM4, KEY_NUM5, KEY_NUM6, KEY_NUM7, KEY_NUM8, KEY_NUM9, KEY_POUND, KEY_STAR, LEFT, RIGHT, UP
 
Constructor Summary
MainView(javax.microedition.midlet.MIDlet m)
          Default constructor takes the parent midlet for close call back later and inits the commands on this canvas
 
Method Summary
 void commandAction(javax.microedition.lcdui.Command c, javax.microedition.lcdui.Displayable d)
          Command handler for this view
 void discoverOptionVisible(boolean visible)
          Switch to show/hide the bluetooth discover option on the menu (used when connected/disconnecting)
 void process(javax.microedition.location.Location loc)
          Processes the current location object data and sets this canvas' ticker with the processed data Note this is not synchronized because we need the performance, and frankly it's not an issue if a couple of threads at once access this method.
 void process(java.lang.String data)
          Processes raw GPS data Finds out if the data is the type it wants (fix) and grabs lock Splits data, retrieves NMEA formatted lat/long Converts NMEA formatted data into degreeminute(DM) lat/long suitable for maps/streetmap.co.uk etc Sets this canvas' ticker with the processed data Note this is not synchronized because we need the performance, and frankly it's not an issue if a couple of threads at once access this method.
 void run()
          Method to update the ticker after a fixed amount of time (TICKER_TIME) with a status or bearing message.
 void shutdown()
          Shuts down the repaint thread
 
Methods inherited from class javax.microedition.lcdui.Canvas
getGameAction, getKeyCode, getKeyName, hasPointerEvents, hasPointerMotionEvents, hasRepeatEvents, isDoubleBuffered, repaint, repaint, serviceRepaints, setCommandListener, setFullScreenMode
 
Methods inherited from class javax.microedition.lcdui.Displayable
addCommand, getHeight, getTicker, getTitle, getWidth, isShown, removeCommand, setTicker, setTitle
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MainView

public MainView(javax.microedition.midlet.MIDlet m)
Default constructor takes the parent midlet for close call back later and inits the commands on this canvas

Parameters:
m -
Method Detail

shutdown

public void shutdown()
Shuts down the repaint thread


discoverOptionVisible

public void discoverOptionVisible(boolean visible)
Switch to show/hide the bluetooth discover option on the menu (used when connected/disconnecting)

Parameters:
visible -

commandAction

public void commandAction(javax.microedition.lcdui.Command c,
                          javax.microedition.lcdui.Displayable d)
Command handler for this view

Specified by:
commandAction in interface javax.microedition.lcdui.CommandListener
Overrides:
commandAction in class AbstractCanvasView

process

public void process(java.lang.String data)
Processes raw GPS data
  1. Finds out if the data is the type it wants (fix) and grabs lock
  2. Splits data, retrieves NMEA formatted lat/long
  3. Converts NMEA formatted data into degreeminute(DM) lat/long suitable for maps/streetmap.co.uk etc
  4. Sets this canvas' ticker with the processed data
Note this is not synchronized because we need the performance, and frankly it's not an issue if a couple of threads at once access this method.

Specified by:
process in interface GPSDataView

process

public void process(javax.microedition.location.Location loc)
Processes the current location object data and sets this canvas' ticker with the processed data Note this is not synchronized because we need the performance, and frankly it's not an issue if a couple of threads at once access this method.

Specified by:
process in interface GPSDataView
Parameters:
loc -

run

public void run()
Method to update the ticker after a fixed amount of time (TICKER_TIME) with a status or bearing message.

Specified by:
run in interface java.lang.Runnable