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" |
It's basically the code from the original ccnChat wrapped inside the worker thread.
org.ccnx.android.apps.chat.ChatWorker.ChatWorker | ( | Context | ctx, | |
ChatCallback | callback | |||
) |
Create a worker thread to handle all the CCNx calls.
ctx | The UI context, needed to start/stop services | |
callback | The UI callback when we receive a chat message or a CCNx service status |
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.
username | Your "handle" on the Chat | |
namespace | The chat ccnx:/ namespace |
MalformedContentNameStringException |
synchronized boolean org.ccnx.android.apps.chat.ChatWorker.send | ( | String | text | ) |
Sent a chat message to the network.
text |
void org.ccnx.android.apps.chat.ChatWorker.service_run | ( | ) | [protected] |
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.