|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.ObjectthinkAlike.ProgramControl
public class ProgramControl
This class handels all the logic of the application. It also implements the XMPPListener interface for handeling actions that happend on the XMPP connection. It is created by the a ScreenControl object, that is the startingpoint of the MIDlet.
Constructor Summary | |
---|---|
ProgramControl(ScreenControl sc)
Initiates the ProgramControl object to handle the logic of the application |
Method Summary | |
---|---|
void |
captureImage()
Handels the actual captering from the video source. |
void |
clearThinkAlikeSession()
Run at the end of a session, clears the chat log and resets the thinkrequest variable. |
boolean |
connect()
Generates a new Jxa object that automatically connects to an XMPP server. |
javax.microedition.lcdui.Item |
getCameraItem()
Returns the actual item containg the feed from the camera to put on the display |
javax.microedition.lcdui.Image |
getImage()
Returns the image assosiated with ThinkRequest session |
Jxa |
getJxa()
Returns the Jxa object that handels the XMPP connection going on. |
ScreenControl |
getSc()
Returns the pointer for the ScreenControl object that created this object |
ThinkRequest |
getThinkRequest()
Returns the ThinkRequest object on going at the moment. |
void |
initilizaCamera()
Initializes the camera with it's related media manager. |
void |
makeThinkRequest(java.lang.String to,
java.lang.String from,
java.lang.String pic,
java.lang.String thinkword)
The method creating the ThinkRequest, doing thinkgs a bit different depending on bein the initiator or the recipient. |
void |
onAuth()
XmppListener internface: initiated when authorization is sucsessful |
void |
onAuthFailed(java.lang.String message)
XmppListener internface: initiated when authorization fials |
void |
onConnFailed()
XmppListener internface: initiated when connecting to the XMPP server fails |
void |
onContactEvent(java.lang.String jid,
java.lang.String name,
java.lang.String group,
java.lang.String subscription)
see XmppListener internface |
void |
onContactRemoveEvent(java.lang.String jid)
see XmppListener internface |
void |
onMessageEvent(java.lang.String from,
java.lang.String body)
XmppListener internface: initiated when a message is recieved |
void |
onStatusEvent(java.lang.String jid,
java.lang.String show,
java.lang.String status)
see XmppListener internface |
void |
onSubscribeEvent(java.lang.String jid)
see XmppListener internface: |
void |
onThinkEvent(java.lang.String thinktype,
java.lang.String from,
java.lang.String pic,
java.lang.String thinkword,
java.lang.String word1,
java.lang.String word2,
java.lang.String word3)
A special method added to the XmppListener class handeling IQ messages related to the ThinkAlike application. |
void |
onUnsubscribeEvent(java.lang.String jid)
see XmppListener internface: |
void |
sendChatMessage()
Initiated when in EndForm, sending the text inputted in the text box to the other part of the session- |
boolean |
sendMessage(java.lang.String to,
java.lang.String message)
Used to send a simple message with the Jxa object |
void |
setLoginParameters(java.lang.String host,
java.lang.String port,
java.lang.String username,
java.lang.String password,
java.lang.String resource)
Setting the login parameters of the XMPP session that will later be initiated |
boolean |
setStatus(java.lang.String show,
java.lang.String status,
int priority)
Sets the status of the XMPP connection using the Jxa object |
void |
setWords()
Gets the words inputed by the recipient of the ThinkRequest from the screen and put them in the thinkrequest object. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ProgramControl(ScreenControl sc)
sc
- a pointer to the ScreenControl object that handeles all the interaction with the displayMethod Detail |
---|
public boolean connect() throws java.io.IOException
java.io.IOException
- if initial connection failspublic boolean sendMessage(java.lang.String to, java.lang.String message)
to
- the recipient of the messagemessage
- the message string
public boolean setStatus(java.lang.String show, java.lang.String status, int priority)
show
- string explaining statusstatus
- actual status (available/unavailable)priority
- default 5, not elsewise in use
public void setLoginParameters(java.lang.String host, java.lang.String port, java.lang.String username, java.lang.String password, java.lang.String resource)
host
- the XMPP host nameport
- the port in use, most common 5222 (if secure connection: 5223)username
- the username of the actor, username@xmpphostdomainpassword
- password in clear text, this is one of the weakest security points of the applicationresource
- the resource parameter of the XMPP client, in this case, always set to /thinkalikepublic ScreenControl getSc()
public Jxa getJxa()
public ThinkRequest getThinkRequest()
public void clearThinkAlikeSession()
public void makeThinkRequest(java.lang.String to, java.lang.String from, java.lang.String pic, java.lang.String thinkword)
to
- address of the recipientfrom
- address of the initiatorpic
- picture represented by a text stringthinkword
- the word that is the wordpublic void sendChatMessage()
public void initilizaCamera()
public javax.microedition.lcdui.Item getCameraItem()
public void captureImage()
public javax.microedition.lcdui.Image getImage()
public void setWords()
public void onConnFailed()
onConnFailed
in interface XmppListener
public void onAuth()
onAuth
in interface XmppListener
public void onAuthFailed(java.lang.String message)
onAuthFailed
in interface XmppListener
message
- error message related to the failiarpublic void onMessageEvent(java.lang.String from, java.lang.String body)
onMessageEvent
in interface XmppListener
from
- the sender of the messagebody
- message bodypublic void onContactRemoveEvent(java.lang.String jid)
onContactRemoveEvent
in interface XmppListener
jid
- .public void onContactEvent(java.lang.String jid, java.lang.String name, java.lang.String group, java.lang.String subscription)
onContactEvent
in interface XmppListener
jid
- .name
- .group
- .subscription
- .public void onStatusEvent(java.lang.String jid, java.lang.String show, java.lang.String status)
onStatusEvent
in interface XmppListener
jid
- .show
- .status
- .public void onSubscribeEvent(java.lang.String jid)
onSubscribeEvent
in interface XmppListener
jid
- .public void onUnsubscribeEvent(java.lang.String jid)
onUnsubscribeEvent
in interface XmppListener
jid
- .public void onThinkEvent(java.lang.String thinktype, java.lang.String from, java.lang.String pic, java.lang.String thinkword, java.lang.String word1, java.lang.String word2, java.lang.String word3)
onThinkEvent
in interface XmppListener
thinktype
- either request or responsefrom
- the sender of the requestpic
- text representation of the picturethinkword
- the wordword1
- .word2
- .word3
- .
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |