Class LeGaMidlet

java.lang.Object
  extended byMIDlet
      extended byLeGaMidlet

public class LeGaMidlet
extends MIDlet

Application entry point and core Midlet class. Responsibilites include listening for commands, parsing of messages and program control flow.

See Also:
Serialized Form

Field Summary
protected  int answerIndex
           
protected  ClientNetworkThread clientNetwork
           
private  boolean CommandCreated_NewUser
           
private  boolean CommandCreated_Retry
           
protected  boolean connectionOK
           
protected  long deleteMe
           
protected  TextField input
           
protected  Form inputForm
           
 int inputState
           
protected  java.lang.String lectureCode
           
protected  Form messageFrm
           
protected  java.lang.Thread networkThread
           
protected  java.lang.String nickName
           
protected  Command okCommand
           
protected  LeGaGameCanvas okForm
           
protected  java.lang.Thread okThread
           
protected  java.lang.String passWord
           
protected  Form questionForm
           
private  boolean readyToClose
           
 
Constructor Summary
LeGaMidlet()
           
 
Method Summary
 void commandAction(Command command, Displayable displayable)
          Triggered through the commandlistener interface and performs the respective actions, such as changing the state of the program flow, or sending data over the network to the server.
protected  void destroyApp(boolean b)
          Closes the application and exits to the OS of the the device.
protected  void forcedLogin()
          Initiates the login seuence.
 void networkFailure()
          Displays an error on screen if the network connection is not properly initilized.
 void networkStatus(boolean connectionOK)
          Sets the appropriate state of the network.
 void parse(java.lang.String received)
          Parses the incoming network messages, nad performs the appropriate actions according to the recieved data.
protected  void pauseApp()
          Not implemented.
 void readyToClose()
          Sets a flag that indicates q wish to close the apllication.
protected  void startApp()
          Initialize members, network connection, and start login sequence.
 void timesUp()
          Calles from external TimerTask thread whenever the timelimit for answering a question is exceeded.
private  void waitIDLE()
          Makes the running thread sleep indefinietely, and wakes the other thread.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

clientNetwork

protected ClientNetworkThread clientNetwork

networkThread

protected java.lang.Thread networkThread

okCommand

protected Command okCommand

connectionOK

protected boolean connectionOK

input

protected TextField input

inputForm

protected Form inputForm

questionForm

protected Form questionForm

messageFrm

protected Form messageFrm

inputState

public int inputState

okForm

protected LeGaGameCanvas okForm

answerIndex

protected int answerIndex

okThread

protected java.lang.Thread okThread

nickName

protected java.lang.String nickName

passWord

protected java.lang.String passWord

lectureCode

protected java.lang.String lectureCode

deleteMe

protected long deleteMe

readyToClose

private boolean readyToClose

CommandCreated_Retry

private boolean CommandCreated_Retry

CommandCreated_NewUser

private boolean CommandCreated_NewUser
Constructor Detail

LeGaMidlet

public LeGaMidlet()
Method Detail

startApp

protected void startApp()
                 throws MIDletStateChangeException
Initialize members, network connection, and start login sequence.

Throws:
MIDletStateChangeException

forcedLogin

protected void forcedLogin()
Initiates the login seuence.


pauseApp

protected void pauseApp()
Not implemented. PArt of midlet interface.


destroyApp

protected void destroyApp(boolean b)
                   throws MIDletStateChangeException
Closes the application and exits to the OS of the the device.

Parameters:
b -
Throws:
MIDletStateChangeException

commandAction

public void commandAction(Command command,
                          Displayable displayable)
Triggered through the commandlistener interface and performs the respective actions, such as changing the state of the program flow, or sending data over the network to the server.

Parameters:
command -
displayable -

networkFailure

public void networkFailure()
Displays an error on screen if the network connection is not properly initilized.


parse

public void parse(java.lang.String received)
Parses the incoming network messages, nad performs the appropriate actions according to the recieved data.

Parameters:
received - the received data

waitIDLE

private void waitIDLE()
Makes the running thread sleep indefinietely, and wakes the other thread. Implementation fo the produced consumer paradigm.


networkStatus

public void networkStatus(boolean connectionOK)
Sets the appropriate state of the network. If the network is not ok. Error messages are displayed on screen.

Parameters:
connectionOK -

timesUp

public void timesUp()
Calles from external TimerTask thread whenever the timelimit for answering a question is exceeded.


readyToClose

public void readyToClose()
Sets a flag that indicates q wish to close the apllication.