Search in sources :

Example 1 with RpgPushMessage

use of com.vodafone360.people.service.io.rpg.RpgPushMessage in project 360-Engine-for-Android by 360.

the class HessianDecoder method parsePushPayload.

private void parsePushPayload(RpgPushMessage msg, List<BaseDataType> list) {
    // convert push msg type string to PushMsgType
    PushMessageTypes type = msg.mType;
    EngineId engineId = EngineId.UNDEFINED;
    if (type != null) {
        switch(type) {
            case CHAT_MESSAGE:
                LogUtils.logV("Parse incomming chat_message");
                engineId = EngineId.PRESENCE_ENGINE;
                list.add(new PushChatMessageEvent(msg, engineId));
                return;
            case AVAILABILITY_STATE_CHANGE:
                LogUtils.logV("Parse availability state change:");
                engineId = EngineId.PRESENCE_ENGINE;
                list.add(PushAvailabilityEvent.createPushEvent(msg, engineId));
                return;
            case START_CONVERSATION:
                LogUtils.logV("Parse new conversation event:");
                engineId = EngineId.PRESENCE_ENGINE;
                list.add(new PushChatConversationEvent(msg, engineId));
                return;
            case CLOSED_CONVERSATION:
                LogUtils.logV("Parse closed conversation event:");
                engineId = EngineId.PRESENCE_ENGINE;
                list.add(new PushClosedConversationEvent(msg, engineId));
                return;
            case CONVERSATION_END:
                break;
            // API events create push message type
            case PROFILE_CHANGE:
                engineId = EngineId.SYNCME_ENGINE;
                break;
            case CONTACTS_CHANGE:
                engineId = EngineId.CONTACT_SYNC_ENGINE;
                break;
            case TIMELINE_ACTIVITY_CHANGE:
            case STATUS_ACTIVITY_CHANGE:
                engineId = EngineId.ACTIVITIES_ENGINE;
                break;
            case FRIENDSHIP_REQUEST_RECEIVED:
                break;
            case IDENTITY_CHANGE:
                engineId = EngineId.IDENTITIES_ENGINE;
                break;
            case IDENTITY_NETWORK_CHANGE:
                engineId = EngineId.IDENTITIES_ENGINE;
                break;
            case SYSTEM_NOTIFICATION:
                LogUtils.logE("SYSTEM_NOTIFICATION push msg:" + msg.mHash);
                list.add(SystemNotification.createFromHashtable(msg.mHash, engineId));
                return;
            default:
        }
        list.add(PushEvent.createPushEvent(msg, engineId));
    }
}
Also used : EngineId(com.vodafone360.people.engine.EngineManager.EngineId) PushClosedConversationEvent(com.vodafone360.people.datatypes.PushClosedConversationEvent) PushChatConversationEvent(com.vodafone360.people.datatypes.PushChatConversationEvent) PushMessageTypes(com.vodafone360.people.service.io.rpg.PushMessageTypes) PushChatMessageEvent(com.vodafone360.people.datatypes.PushChatMessageEvent)

Example 2 with RpgPushMessage

use of com.vodafone360.people.service.io.rpg.RpgPushMessage in project 360-Engine-for-Android by 360.

the class HessianDecoder method parsePushMessage.

private void parsePushMessage(List<BaseDataType> list, Hashtable<String, Object> hash) {
    RpgPushMessage push = RpgPushMessage.createFromHashtable(hash);
    parsePushPayload(push, list);
}
Also used : RpgPushMessage(com.vodafone360.people.service.io.rpg.RpgPushMessage)

Example 3 with RpgPushMessage

use of com.vodafone360.people.service.io.rpg.RpgPushMessage in project 360-Engine-for-Android by 360.

the class NowPlusDatatypesTests method testCreatePushEvent.

public void testCreatePushEvent() {
    RpgPushMessage msg = new RpgPushMessage();
    msg.mType = PushMessageTypes.CONTACTS_CHANGE;
    EngineId engId = EngineId.ACTIVITIES_ENGINE;
    PushEvent input = (PushEvent) PushEvent.createPushEvent(msg, engId);
    assertEquals(BaseDataType.PUSH_EVENT_DATA_TYPE, input.getType());
    assertEquals(msg.mType, input.mMessageType);
    assertEquals(engId, input.mEngineId);
}
Also used : EngineId(com.vodafone360.people.engine.EngineManager.EngineId) PushEvent(com.vodafone360.people.datatypes.PushEvent) RpgPushMessage(com.vodafone360.people.service.io.rpg.RpgPushMessage)

Aggregations

EngineId (com.vodafone360.people.engine.EngineManager.EngineId)2 RpgPushMessage (com.vodafone360.people.service.io.rpg.RpgPushMessage)2 PushChatConversationEvent (com.vodafone360.people.datatypes.PushChatConversationEvent)1 PushChatMessageEvent (com.vodafone360.people.datatypes.PushChatMessageEvent)1 PushClosedConversationEvent (com.vodafone360.people.datatypes.PushClosedConversationEvent)1 PushEvent (com.vodafone360.people.datatypes.PushEvent)1 PushMessageTypes (com.vodafone360.people.service.io.rpg.PushMessageTypes)1