org.ccnx.android.apps.chat.ChatWorker Class Reference

All the CCNx code for Chat is in this worker thread. More...

Inheritance diagram for org.ccnx.android.apps.chat.ChatWorker:

List of all members.

Public Member Functions

 ChatWorker (Context ctx, ChatCallback callback)
 Create a worker thread to handle all the CCNx calls.
synchronized void start (String username, String namespace, String remotehost, String remoteport)
 Start the worker thread, along with CCN services.
synchronized void stop ()
 Exit the worker thread, but keep services running.
synchronized void shutdown ()
 Exit the worker thread and shutdown services.
synchronized boolean send (String text)
 Sent a chat message to the network.
void run ()
 Runnable method.
void newCCNxStatus (SERVICE_STATUS st)
 Called from CCNxServiceControl.
void recvMessage (String message)
 called from ccnChatNet when there's a new message.

Protected Member Functions

void service_run ()

Protected Attributes

CCNChatNet _chat
final ChatCallback _chatCallback
final Context _context
CCNxServiceControl _ccnxService
final Thread _thd
boolean _running = false
boolean _finished = true
String _remotehost = null
String _remoteport = "9695"

Static Protected Attributes

static final String TAG = "ChatWorker"


Detailed Description

All the CCNx code for Chat is in this worker thread.

It's basically the code from the original ccnChat wrapped inside the worker thread.


Constructor & Destructor Documentation

org.ccnx.android.apps.chat.ChatWorker.ChatWorker ( Context  ctx,
ChatCallback  callback 
)

Create a worker thread to handle all the CCNx calls.

Parameters:
ctx The UI context, needed to start/stop services
callback The UI callback when we receive a chat message or a CCNx service status


Member Function Documentation

synchronized void org.ccnx.android.apps.chat.ChatWorker.start ( String  username,
String  namespace,
String  remotehost,
String  remoteport 
)

Start the worker thread, along with CCN services.

Parameters:
username Your "handle" on the Chat
namespace The chat ccnx:/ namespace
Exceptions:
MalformedContentNameStringException 

synchronized boolean org.ccnx.android.apps.chat.ChatWorker.send ( String  text  ) 

Sent a chat message to the network.

Parameters:
text 
Returns:
true if sent, false if some CCN error

void org.ccnx.android.apps.chat.ChatWorker.service_run (  )  [protected]

Parameters:
args 

void org.ccnx.android.apps.chat.ChatWorker.recvMessage ( String  message  ) 

called from ccnChatNet when there's a new message.

Pass it on to the UI.


The documentation for this class was generated from the following file:

Generated on Thu Feb 16 00:45:13 2012 for CCNx for Android by  doxygen 1.5.6