use of com.vodafone360.people.engine.presence.PresenceEngine in project 360-Engine-for-Android by 360.
the class PresenceEngine method handleServerError.
private void handleServerError(ServerError srvError) {
LogUtils.logE("PresenceEngine.handleServerResponse() - Server error: " + srvError);
ServiceStatus errorStatus = srvError.toServiceStatus();
if (errorStatus == ServiceStatus.ERROR_COMMS_TIMEOUT) {
LogUtils.logW("PresenceEngine handleServerResponce(): TIME OUT IS RETURNED TO PRESENCE ENGINE.");
notifyUiAgentOfTimeOut(srvError.requestId);
}
}
use of com.vodafone360.people.engine.presence.PresenceEngine in project 360-Engine-for-Android by 360.
the class EngineManager method createPresenceEngine.
/**
* Create instance of PresenceEngine.
*/
private synchronized void createPresenceEngine() {
final MainApplication app = (MainApplication) mService.getApplication();
mPresenceEngine = new PresenceEngine(mUiEventCallback, app.getDatabase());
ConnectionManager.getInstance().addConnectionListener(mPresenceEngine);
getLoginEngine().addListener(mPresenceEngine);
addEngine(mPresenceEngine);
}
use of com.vodafone360.people.engine.presence.PresenceEngine in project 360-Engine-for-Android by 360.
the class PresenceEngineTest method setUp.
//private MainApplication mApplication = null;
//private PresenceTestState mState = PresenceTestState.IDLE;
@Override
protected void setUp() throws Exception {
super.setUp();
mEngineTester = new EngineTestFramework(this);
mEng = new PresenceEngine(mEngineTester, null);
//mApplication = (MainApplication)Instrumentation.newApplication(MainApplication.class, getInstrumentation().getTargetContext());
mEngineTester.setEngine(mEng);
//mState = PresenceTestState.IDLE;
}
use of com.vodafone360.people.engine.presence.PresenceEngine in project 360-Engine-for-Android by 360.
the class PresenceEngine method processUiRequest.
@Override
protected void processUiRequest(ServiceUiRequest requestId, Object data) {
if (!isFirstTimeSyncComplete()) {
LogUtils.logE("PresenceEngine.processUIRequest():" + " Can't run PresenceEngine before the contact list is downloaded:1");
return;
}
LogUtils.logW("PresenceEngine.processUiRequest() requestId.name[" + requestId.name() + "]");
if (data == null && requestId != ServiceUiRequest.GET_PRESENCE_LIST) {
LogUtils.logW("PresenceEngine.processUiRequest() skipping processing for request with no data!");
return;
}
switch(requestId) {
case SET_MY_AVAILABILITY:
Hashtable<String, String> presenceHash = (Hashtable<String, String>) data;
notifyUiAgentOfRequest(Presence.setMyAvailability(presenceHash), presenceHash);
break;
case GET_PRESENCE_LIST:
Presence.getPresenceList(EngineId.PRESENCE_ENGINE, null);
break;
case CREATE_CONVERSATION:
List<String> tos = ((ChatMessage) data).getTos();
LogUtils.logW("PresenceEngine processUiRequest() CREATE_CONVERSATION with: " + tos);
Chat.startChat(tos);
break;
case SEND_CHAT_MESSAGE:
ChatMessage msg = (ChatMessage) data;
updateChatDatabase(msg, TimelineSummaryItem.Type.OUTGOING);
//cache the message (necessary for failed message sending failures)
mSendMessagesHash.put(msg.getTos().get(0), msg);
Chat.sendChatMessage(msg);
break;
default:
LogUtils.logE("PresenceEngine processUiRequest() Unhandled UI request [" + requestId.name() + "]");
// don't complete with success and schedule the next runtime
return;
}
completeUiRequest(ServiceStatus.SUCCESS, null);
setTimeout(CHECK_FREQUENCY);
}
Aggregations