decoders are modified

This commit is contained in:
병준 박 2019-10-10 12:14:01 +09:00
parent 59873ace7b
commit e644979645
64 changed files with 376 additions and 434 deletions

View File

@ -67,7 +67,7 @@ export class AppNotificationService {
this.authenticationProtocolService.logoutNotification$ this.authenticationProtocolService.logoutNotification$
.pipe( .pipe(
tap(notiOrRes => { tap(notiOrRes => {
switch (notiOrRes.Type) { switch (notiOrRes.SSVC_TYPE) {
case SSVC_TYPE_LOGOUT_RES: case SSVC_TYPE_LOGOUT_RES:
{ {
const res = notiOrRes as LogoutResponse; const res = notiOrRes as LogoutResponse;
@ -97,7 +97,7 @@ export class AppNotificationService {
this.eventProtocolService.notification$ this.eventProtocolService.notification$
.pipe( .pipe(
tap(notiOrRes => { tap(notiOrRes => {
switch (notiOrRes.Type) { switch (notiOrRes.SSVC_TYPE) {
case SSVC_TYPE_EVENT_SEND_NOTI: case SSVC_TYPE_EVENT_SEND_NOTI:
{ {
const noti = notiOrRes as SendNotification; const noti = notiOrRes as SendNotification;
@ -109,6 +109,7 @@ export class AppNotificationService {
break; break;
case SSVC_TYPE_EVENT_READ_NOTI: case SSVC_TYPE_EVENT_READ_NOTI:
{ {
// 대화방 unread count 처리.
const noti = notiOrRes as ReadNotification; const noti = notiOrRes as ReadNotification;
this.logger.debug( this.logger.debug(
'Notification::eventProtocolService::ReadNotification', 'Notification::eventProtocolService::ReadNotification',
@ -143,7 +144,7 @@ export class AppNotificationService {
this.infoProtocolService.notification$ this.infoProtocolService.notification$
.pipe( .pipe(
tap(notiOrRes => { tap(notiOrRes => {
switch (notiOrRes.Type) { switch (notiOrRes.SSVC_TYPE) {
case SSVC_TYPE_INFO_USER_NOTI: case SSVC_TYPE_INFO_USER_NOTI:
{ {
const noti = notiOrRes as UserNotification; const noti = notiOrRes as UserNotification;
@ -162,7 +163,7 @@ export class AppNotificationService {
this.roomProtocolService.notification$ this.roomProtocolService.notification$
.pipe( .pipe(
tap(notiOrRes => { tap(notiOrRes => {
switch (notiOrRes.Type) { switch (notiOrRes.SSVC_TYPE) {
case SSVC_TYPE_ROOM_INVITE_NOTI: case SSVC_TYPE_ROOM_INVITE_NOTI:
{ {
const noti = notiOrRes as InviteNotification; const noti = notiOrRes as InviteNotification;
@ -208,7 +209,7 @@ export class AppNotificationService {
this.statusProtocolService.notification$ this.statusProtocolService.notification$
.pipe( .pipe(
tap(notiOrRes => { tap(notiOrRes => {
switch (notiOrRes.Type) { switch (notiOrRes.SSVC_TYPE) {
case SSVC_TYPE_STATUS_NOTI: case SSVC_TYPE_STATUS_NOTI:
{ {
const noti = notiOrRes as StatusNotification; const noti = notiOrRes as StatusNotification;

View File

@ -58,7 +58,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.eventProtocolService.info(req).pipe( return this.eventProtocolService.info(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_EVENT_INFO_DATA: case SSVC_TYPE_EVENT_INFO_DATA:
infoList.push(...(res as InfoData).infoList); infoList.push(...(res as InfoData).infoList);
break; break;

View File

@ -44,7 +44,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.queryProtocolService.dept(req).pipe( return this.queryProtocolService.dept(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_QUERY_DEPT_DATA: case SSVC_TYPE_QUERY_DEPT_DATA:
departmentInfoList.push(...(res as DeptData).departmentInfos); departmentInfoList.push(...(res as DeptData).departmentInfos);
break; break;
@ -77,7 +77,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.queryProtocolService.deptUser(req).pipe( return this.queryProtocolService.deptUser(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_QUERY_DEPT_USER_DATA: case SSVC_TYPE_QUERY_DEPT_USER_DATA:
userInfos.push(...(res as DeptUserData).userInfos); userInfos.push(...(res as DeptUserData).userInfos);
break; break;

View File

@ -62,7 +62,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.roomProtocolService.info(req).pipe( return this.roomProtocolService.info(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_ROOM_INFO_ROOM: case SSVC_TYPE_ROOM_INFO_ROOM:
roomInfo = (res as InfoData).roomInfo; roomInfo = (res as InfoData).roomInfo;
break; break;

View File

@ -45,7 +45,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.statusProtocolService.bulkInfo(req).pipe( return this.statusProtocolService.bulkInfo(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_STATUS_BULK_INFO_DATA: case SSVC_TYPE_STATUS_BULK_INFO_DATA:
statusBulkInfoList.push( statusBulkInfoList.push(
...(res as BulkInfoData).statusBulkInfos ...(res as BulkInfoData).statusBulkInfos

View File

@ -71,7 +71,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.syncProtocolService.buddy2(req).pipe( return this.syncProtocolService.buddy2(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_SYNC_BUDDY2_DATA: case SSVC_TYPE_SYNC_BUDDY2_DATA:
buddyList.push(...(res as BuddyDetailData).buddyInfos); buddyList.push(...(res as BuddyDetailData).buddyInfos);
break; break;
@ -105,7 +105,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.syncProtocolService.group2(req).pipe( return this.syncProtocolService.group2(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_SYNC_GROUP_DATA2: case SSVC_TYPE_SYNC_GROUP_DATA2:
groupList.push(res as GroupDetailData); groupList.push(res as GroupDetailData);
break; break;
@ -146,7 +146,7 @@ export class Effects {
switchMap(req => { switchMap(req => {
return this.syncProtocolService.room(req).pipe( return this.syncProtocolService.room(req).pipe(
map(res => { map(res => {
switch (res.Type) { switch (res.SSVC_TYPE) {
case SSVC_TYPE_SYNC_ROOM_DATA: case SSVC_TYPE_SYNC_ROOM_DATA:
roomList.push(...(res as RoomData).roomInfos); roomList.push(...(res as RoomData).roomInfos);
break; break;

View File

@ -7,7 +7,8 @@ import {
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider BodyStringDivider,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { SSOMode } from '../types/sso-mode'; import { SSOMode } from '../types/sso-mode';
import { RoleCode } from '../types/role-code'; import { RoleCode } from '../types/role-code';
@ -159,7 +160,7 @@ export const encodeLogin: ProtocolEncoder<LoginRequest> = (
export const decodeLogin: ProtocolDecoder<LoginResponse> = ( export const decodeLogin: ProtocolDecoder<LoginResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
loginId: message.bodyList[0], loginId: message.bodyList[0],
userSeq: message.bodyList[1], userSeq: message.bodyList[1],
userInfo: decodeUserInfo(message.bodyList[2]), userInfo: decodeUserInfo(message.bodyList[2]),
@ -194,5 +195,5 @@ export const decodeLogin: ProtocolDecoder<LoginResponse> = (
pinCode: message.bodyList[30], pinCode: message.bodyList[30],
permissionsForViewSchedule: message.bodyList[31], permissionsForViewSchedule: message.bodyList[31],
havePermissionsForDevice: message.bodyList[32] === 'Y' ? true : false havePermissionsForDevice: message.bodyList[32] === 'Y' ? true : false
} as LoginResponse; } as LoginResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface LogoutRemoteRequest extends ProtocolRequest { export interface LogoutRemoteRequest extends ProtocolRequest {
@ -39,10 +40,10 @@ export const encodeLogoutRemote: ProtocolEncoder<LogoutRemoteRequest> = (
export const decodeLogoutRemote: ProtocolDecoder<LogoutRemoteResponse> = ( export const decodeLogoutRemote: ProtocolDecoder<LogoutRemoteResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
targetDeviceType: message.bodyList[0], targetDeviceType: message.bodyList[0],
resultCode: message.bodyList[1] resultCode: message.bodyList[1]
} as LogoutRemoteResponse; } as LogoutRemoteResponse);
}; };
export const decodeLogoutRemoteNotification: ProtocolDecoder< export const decodeLogoutRemoteNotification: ProtocolDecoder<

View File

@ -4,7 +4,8 @@ import {
ProtocolEncoder, ProtocolEncoder,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBody PacketBody,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface
@ -25,5 +26,7 @@ export const encodeLogout: ProtocolEncoder<LogoutRequest> = (
export const decodeLogout: ProtocolDecoder<LogoutResponse> = ( export const decodeLogout: ProtocolDecoder<LogoutResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { reasonCode: message.bodyList[0] } as LogoutResponse; return decodeProtocolMessage(message, {
reasonCode: message.bodyList[0]
} as LogoutResponse);
}; };

View File

@ -56,18 +56,14 @@ export class AuthenticationProtocolService {
switch (message.subServiceType) { switch (message.subServiceType) {
case SSVC_TYPE_LOGOUT_RES: case SSVC_TYPE_LOGOUT_RES:
{ {
this.logoutNotificationSubject.next({ this.logoutNotificationSubject.next(decodeLogout(message));
...decodeLogout(message),
Type: SSVC_TYPE_LOGOUT_RES
});
} }
break; break;
case SSVC_TYPE_LOGOUT_REMOTE_NOTI: case SSVC_TYPE_LOGOUT_REMOTE_NOTI:
{ {
this.logoutNotificationSubject.next({ this.logoutNotificationSubject.next(
...decodeLogoutRemoteNotification(message), decodeLogoutRemoteNotification(message)
Type: SSVC_TYPE_LOGOUT_REMOTE_NOTI );
});
} }
break; break;

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface AddRequest extends ProtocolRequest { export interface AddRequest extends ProtocolRequest {
@ -33,7 +34,7 @@ export const decodeAdd: ProtocolDecoder<AddResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
const userSeqArray: number[] = [...message.bodyList]; const userSeqArray: number[] = [...message.bodyList];
return { return decodeProtocolMessage(message, {
userSeqs: userSeqArray userSeqs: userSeqArray
} as AddResponse; } as AddResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface DelRequest extends ProtocolRequest { export interface DelRequest extends ProtocolRequest {
@ -33,7 +34,7 @@ export const decodeDel: ProtocolDecoder<DelResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
const userSeqArray: number[] = [...message.bodyList]; const userSeqArray: number[] = [...message.bodyList];
return { return decodeProtocolMessage(message, {
userSeqs: userSeqArray userSeqs: userSeqArray
} as DelResponse; } as DelResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface UpdateRequest extends ProtocolRequest { export interface UpdateRequest extends ProtocolRequest {
@ -40,8 +41,8 @@ export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = ( export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
seq: message.bodyList[0], seq: message.bodyList[0],
isFavorit: message.bodyList[1] === 'Y' ? true : false isFavorit: message.bodyList[1] === 'Y' ? true : false
} as UpdateResponse; } as UpdateResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
ProtocolResponse, ProtocolResponse,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { DeviceType } from '@ucap-webmessenger/core'; import { DeviceType } from '@ucap-webmessenger/core';
@ -50,18 +51,18 @@ export const encodeCancel: ProtocolEncoder<CancelRequest> = (
export const decodeCancel: ProtocolDecoder<CancelResponse> = ( export const decodeCancel: ProtocolDecoder<CancelResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
eventSeq: message.bodyList[1], eventSeq: message.bodyList[1],
deviceType: message.bodyList[2] as DeviceType deviceType: message.bodyList[2] as DeviceType
} as CancelResponse; } as CancelResponse);
}; };
export const decodeCancelNotification: ProtocolDecoder<CancelNotification> = ( export const decodeCancelNotification: ProtocolDecoder<CancelNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
eventSeq: message.bodyList[1], eventSeq: message.bodyList[1],
deviceType: message.bodyList[2] as DeviceType deviceType: message.bodyList[2] as DeviceType
} as CancelNotification; } as CancelNotification);
}; };

View File

@ -6,7 +6,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
ProtocolResponse, ProtocolResponse,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface DelRequest extends ProtocolRequest { export interface DelRequest extends ProtocolRequest {
@ -40,16 +41,16 @@ export const encodeDel: ProtocolEncoder<DelRequest> = (req: DelRequest) => {
export const decodeDel: ProtocolDecoder<DelResponse> = ( export const decodeDel: ProtocolDecoder<DelResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
eventSeq: message.bodyList[1] eventSeq: message.bodyList[1]
} as DelResponse; } as DelResponse);
}; };
export const decodeDelNotification: ProtocolDecoder<DelNotification> = ( export const decodeDelNotification: ProtocolDecoder<DelNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
eventSeq: message.bodyList[1] eventSeq: message.bodyList[1]
} as DelNotification; } as DelNotification);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage, ProtocolMessage,
ProtocolStream, ProtocolStream,
PacketBodyValue, PacketBodyValue,
BodyStringDivider BodyStringDivider,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EventType } from '../types/event.type'; import { EventType } from '../types/event.type';
import { Info } from '../models/info'; import { Info } from '../models/info';
@ -69,19 +70,19 @@ export const decodeInfoData: ProtocolDecoder<InfoData> = (
} }
} }
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
infoList infoList
} as InfoData; } as InfoData);
}; };
export const decodeInfo: ProtocolDecoder<InfoResponse> = ( export const decodeInfo: ProtocolDecoder<InfoResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
baseSeq: message.bodyList[1], baseSeq: message.bodyList[1],
validFileBaseSeq: message.bodyList[2], validFileBaseSeq: message.bodyList[2],
count: message.bodyList[3] count: message.bodyList[3]
} as InfoResponse; } as InfoResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
ProtocolResponse, ProtocolResponse,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface ReadRequest extends ProtocolRequest { export interface ReadRequest extends ProtocolRequest {
@ -40,16 +41,16 @@ export const encodeRead: ProtocolEncoder<ReadRequest> = (req: ReadRequest) => {
export const decodeRead: ProtocolDecoder<ReadResponse> = ( export const decodeRead: ProtocolDecoder<ReadResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
lastReadSeq: message.bodyList[1] lastReadSeq: message.bodyList[1]
} as ReadResponse; } as ReadResponse);
}; };
export const decodeReadNotification: ProtocolDecoder<ReadNotification> = ( export const decodeReadNotification: ProtocolDecoder<ReadNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
lastReadSeq: message.bodyList[1] lastReadSeq: message.bodyList[1]
} as ReadNotification; } as ReadNotification);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage, ProtocolMessage,
ProtocolStream, ProtocolStream,
PacketBodyValue, PacketBodyValue,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EventType } from '../types/event.type'; import { EventType } from '../types/event.type';
import { PushStatus } from '../types/push-status.type'; import { PushStatus } from '../types/push-status.type';
@ -82,7 +83,7 @@ export const encodeSend: ProtocolEncoder<SendRequest> = (req: SendRequest) => {
export const decodeSend: ProtocolDecoder<SendResponse> = ( export const decodeSend: ProtocolDecoder<SendResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
seq: message.bodyList[1], seq: message.bodyList[1],
eventType: message.bodyList[2] as EventType, eventType: message.bodyList[2] as EventType,
@ -92,13 +93,13 @@ export const decodeSend: ProtocolDecoder<SendResponse> = (
pushStatus: message.bodyList[6] as PushStatus, pushStatus: message.bodyList[6] as PushStatus,
ForcedExitType: message.bodyList[7], ForcedExitType: message.bodyList[7],
senderName: message.bodyList[8] senderName: message.bodyList[8]
} as SendResponse; } as SendResponse);
}; };
export const decodeSendNotification: ProtocolDecoder<SendNotification> = ( export const decodeSendNotification: ProtocolDecoder<SendNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
seq: message.bodyList[1], seq: message.bodyList[1],
eventType: message.bodyList[2] as EventType, eventType: message.bodyList[2] as EventType,
@ -110,5 +111,5 @@ export const decodeSendNotification: ProtocolDecoder<SendNotification> = (
senderName: message.bodyList[8], senderName: message.bodyList[8],
id: message.bodyList[9], id: message.bodyList[9],
companyCode: message.bodyList[10] companyCode: message.bodyList[10]
} as SendNotification; } as SendNotification);
}; };

View File

@ -93,34 +93,24 @@ export class EventProtocolService {
switch (message.subServiceType) { switch (message.subServiceType) {
case SSVC_TYPE_EVENT_SEND_NOTI: case SSVC_TYPE_EVENT_SEND_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(decodeSendNotification(message));
...decodeSendNotification(message),
Type: SSVC_TYPE_EVENT_SEND_NOTI
});
} }
break; break;
case SSVC_TYPE_EVENT_READ_NOTI: case SSVC_TYPE_EVENT_READ_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(decodeReadNotification(message));
...decodeReadNotification(message),
Type: SSVC_TYPE_EVENT_READ_NOTI
});
} }
break; break;
case SSVC_TYPE_EVENT_CANCEL_NOTI: case SSVC_TYPE_EVENT_CANCEL_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(
...decodeCancelNotification(message), decodeCancelNotification(message)
Type: SSVC_TYPE_EVENT_CANCEL_NOTI );
});
} }
break; break;
case SSVC_TYPE_EVENT_DEL_RES: case SSVC_TYPE_EVENT_DEL_RES:
{ {
this.notificationSubject.next({ this.notificationSubject.next(decodeDelNotification(message));
...decodeDelNotification(message),
Type: SSVC_TYPE_EVENT_DEL_RES
});
} }
break; break;
default: default:
@ -138,15 +128,9 @@ export class EventProtocolService {
takeWhile(res => SSVC_TYPE_EVENT_INFO_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_EVENT_INFO_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_EVENT_INFO_DATA === res.subServiceType) { if (SSVC_TYPE_EVENT_INFO_DATA === res.subServiceType) {
return { return decodeInfoData(res);
...decodeInfoData(res),
Type: SSVC_TYPE_EVENT_INFO_DATA
};
} }
return { return decodeInfo(res);
...decodeInfo(res),
Type: SSVC_TYPE_EVENT_INFO_RES
};
}) })
); );
} }

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface DownCheckRequest extends ProtocolRequest { export interface DownCheckRequest extends ProtocolRequest {
@ -31,7 +32,7 @@ export const encodeDownCheck: ProtocolEncoder<DownCheckRequest> = (
export const decodeDownCheck: ProtocolDecoder<DownCheckResponse> = ( export const decodeDownCheck: ProtocolDecoder<DownCheckResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
seq: message.bodyList[0] seq: message.bodyList[0]
} as DownCheckResponse; } as DownCheckResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { FileType } from '../types/file.type'; import { FileType } from '../types/file.type';
import { FileInfo } from '../models/file-info'; import { FileInfo } from '../models/file-info';
@ -68,9 +69,9 @@ export const decodeInfoData: ProtocolDecoder<InfoData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
fileInfos fileInfos
} as InfoData; } as InfoData);
}; };
export const decodeInfoCheckData: ProtocolDecoder<InfoCheckData> = ( export const decodeInfoCheckData: ProtocolDecoder<InfoCheckData> = (
@ -89,16 +90,16 @@ export const decodeInfoCheckData: ProtocolDecoder<InfoCheckData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
fileDownloadInfos fileDownloadInfos
} as InfoCheckData; } as InfoCheckData);
}; };
export const decodeInfo: ProtocolDecoder<InfoResponse> = ( export const decodeInfo: ProtocolDecoder<InfoResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
type: message.bodyList[1] as FileType type: message.bodyList[1] as FileType
} as InfoResponse; } as InfoResponse);
}; };

View File

@ -43,21 +43,12 @@ export class FileProtocolService {
takeWhile(res => SSVC_TYPE_FILE_INFO_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_FILE_INFO_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_FILE_INFO_DATA === res.subServiceType) { if (SSVC_TYPE_FILE_INFO_DATA === res.subServiceType) {
return { return decodeInfoData(res);
...decodeInfoData(res),
Type: SSVC_TYPE_FILE_INFO_DATA
};
} else if (SSVC_TYPE_FILE_INFO_CHECK_DATA === res.subServiceType) { } else if (SSVC_TYPE_FILE_INFO_CHECK_DATA === res.subServiceType) {
return { return decodeInfoCheckData(res);
...decodeInfoCheckData(res),
Type: SSVC_TYPE_FILE_INFO_CHECK_DATA
};
} }
return { return decodeInfo(res);
...decodeInfo(res),
Type: SSVC_TYPE_FILE_INFO_RES
};
}) })
); );
} }

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface AddRequest extends ProtocolRequest { export interface AddRequest extends ProtocolRequest {
@ -32,8 +33,8 @@ export const encodeAdd: ProtocolEncoder<AddRequest> = (req: AddRequest) => {
export const decodeAdd: ProtocolDecoder<AddResponse> = ( export const decodeAdd: ProtocolDecoder<AddResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
groupSeq: message.bodyList[0], groupSeq: message.bodyList[0],
groupName: message.bodyList[1] groupName: message.bodyList[1]
} as AddResponse; } as AddResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface DelRequest extends ProtocolRequest { export interface DelRequest extends ProtocolRequest {
@ -30,7 +31,7 @@ export const encodeDel: ProtocolEncoder<DelRequest> = (req: DelRequest) => {
export const decodeDel: ProtocolDecoder<DelResponse> = ( export const decodeDel: ProtocolDecoder<DelResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
groupSeq: message.bodyList[0] groupSeq: message.bodyList[0]
} as DelResponse; } as DelResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface UpdateRequest extends ProtocolRequest { export interface UpdateRequest extends ProtocolRequest {
@ -49,11 +50,11 @@ export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
userSeqArray = message.bodyList[2].split(',').map((v: any) => Number(v)); userSeqArray = message.bodyList[2].split(',').map((v: any) => Number(v));
} }
return { return decodeProtocolMessage(message, {
groupSeq: message.bodyList[0], groupSeq: message.bodyList[0],
groupName: message.bodyList[1], groupName: message.bodyList[1],
userSeqs: userSeqArray userSeqs: userSeqArray
} as UpdateResponse; } as UpdateResponse);
}; };
export const encodeUpdate2: ProtocolEncoder<UpdateRequest> = ( export const encodeUpdate2: ProtocolEncoder<UpdateRequest> = (
@ -83,9 +84,9 @@ export const decodeUpdate2: ProtocolDecoder<UpdateResponse> = (
userSeqArray = message.bodyList.slice(2); userSeqArray = message.bodyList.slice(2);
} }
return { return decodeProtocolMessage(message, {
groupSeq: message.bodyList[0], groupSeq: message.bodyList[0],
groupName: message.bodyList[1], groupName: message.bodyList[1],
userSeqs: userSeqArray userSeqs: userSeqArray
} as UpdateResponse; } as UpdateResponse);
}; };

View File

@ -8,7 +8,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
ProtocolNotification, ProtocolNotification,
BodyStringDivider BodyStringDivider,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { UserInfoUpdateType } from '../types/user-info-update.type'; import { UserInfoUpdateType } from '../types/user-info-update.type';
import { StatusInfo } from '@ucap-webmessenger/protocol-status'; import { StatusInfo } from '@ucap-webmessenger/protocol-status';
@ -51,7 +52,7 @@ export const decodeStatus: ProtocolDecoder<StatusResponse> = (
imessengerStatus: info[7] as StatusCode imessengerStatus: info[7] as StatusCode
}); });
}); });
return { return decodeProtocolMessage(message, {
statusInfos statusInfos
} as StatusResponse; } as StatusResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { UserInfoUpdateType } from '../types/user-info-update.type'; import { UserInfoUpdateType } from '../types/user-info-update.type';
@ -44,7 +45,7 @@ export const encodeUserOptionUpdate: ProtocolEncoder<
export const decodeUserOptionUpdate: ProtocolDecoder< export const decodeUserOptionUpdate: ProtocolDecoder<
UserOptionUpdateResponse UserOptionUpdateResponse
> = (message: ProtocolMessage) => { > = (message: ProtocolMessage) => {
return { return decodeProtocolMessage(message, {
type: message.bodyList[0] as CallerType type: message.bodyList[0] as CallerType
} as UserOptionUpdateResponse; } as UserOptionUpdateResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { UserInfoUpdateType } from '../types/user-info-update.type'; import { UserInfoUpdateType } from '../types/user-info-update.type';
@ -46,17 +47,17 @@ export const encodeUser: ProtocolEncoder<UserRequest> = (req: UserRequest) => {
export const decodeUser: ProtocolDecoder<UserResponse> = ( export const decodeUser: ProtocolDecoder<UserResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
type: message.bodyList[0] as UserInfoUpdateType, type: message.bodyList[0] as UserInfoUpdateType,
info: message.bodyList[1] info: message.bodyList[1]
} as UserResponse; } as UserResponse);
}; };
export const decodeUserNotification: ProtocolDecoder<UserNotification> = ( export const decodeUserNotification: ProtocolDecoder<UserNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
type: message.bodyList[0] as UserInfoUpdateType, type: message.bodyList[0] as UserInfoUpdateType,
info: message.bodyList[1] info: message.bodyList[1]
} as UserNotification; } as UserNotification);
}; };

View File

@ -55,10 +55,7 @@ export class InfoProtocolService {
switch (message.subServiceType) { switch (message.subServiceType) {
case SSVC_TYPE_INFO_USER_NOTI: case SSVC_TYPE_INFO_USER_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(decodeUserNotification(message));
...decodeUserNotification(message),
Type: SSVC_TYPE_INFO_USER_NOTI
});
} }
break; break;

View File

@ -4,7 +4,8 @@ import {
ProtocolEncoder, ProtocolEncoder,
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface
@ -22,5 +23,5 @@ export const encodeConn: ProtocolEncoder<ConnRequest> = (req: ConnRequest) => {
export const decodeConn: ProtocolDecoder<ConnResponse> = ( export const decodeConn: ProtocolDecoder<ConnResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return {} as ConnResponse; return decodeProtocolMessage(message, {} as ConnResponse);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { import {
CallerType, CallerType,
@ -120,7 +121,7 @@ export const encodeCallUpdate: ProtocolEncoder<CallUpdateRequest> = (
export const decodeCallUpdate: ProtocolDecoder<CallUpdateResponse> = ( export const decodeCallUpdate: ProtocolDecoder<CallUpdateResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
useIpPhone: message.bodyList[0] === 'Y' ? true : false, useIpPhone: message.bodyList[0] === 'Y' ? true : false,
callerType: message.bodyList[1] as CallerType, callerType: message.bodyList[1] as CallerType,
callMode: message.bodyList[2] as CallMode, callMode: message.bodyList[2] as CallMode,
@ -132,5 +133,5 @@ export const decodeCallUpdate: ProtocolDecoder<CallUpdateResponse> = (
calledNumber1: message.bodyList[8], calledNumber1: message.bodyList[8],
calledNumber2: message.bodyList[9], calledNumber2: message.bodyList[9],
calledNumber3: message.bodyList[10] calledNumber3: message.bodyList[10]
} as CallUpdateResponse; } as CallUpdateResponse);
}; };

View File

@ -4,7 +4,8 @@ import {
ProtocolEncoder, ProtocolEncoder,
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { import {
CallerType, CallerType,
@ -52,7 +53,7 @@ export const encodeCallView: ProtocolEncoder<CallViewRequest> = (
export const decodeCallView: ProtocolDecoder<CallViewResponse> = ( export const decodeCallView: ProtocolDecoder<CallViewResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
useIpPhone: message.bodyList[0] === 'Y' ? true : false, useIpPhone: message.bodyList[0] === 'Y' ? true : false,
callerType: message.bodyList[1] as CallerType, callerType: message.bodyList[1] as CallerType,
callMode: message.bodyList[2] as CallMode, callMode: message.bodyList[2] as CallMode,
@ -64,5 +65,5 @@ export const decodeCallView: ProtocolDecoder<CallViewResponse> = (
calledNumber1: message.bodyList[8], calledNumber1: message.bodyList[8],
calledNumber2: message.bodyList[9], calledNumber2: message.bodyList[9],
calledNumber3: message.bodyList[10] calledNumber3: message.bodyList[10]
} as CallViewResponse; } as CallViewResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface RegUpdateRequest extends ProtocolRequest { export interface RegUpdateRequest extends ProtocolRequest {
@ -133,7 +134,7 @@ export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
export const decodeRegUpdate: ProtocolDecoder<RegUpdateResponse> = ( export const decodeRegUpdate: ProtocolDecoder<RegUpdateResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
notificationMethod: message.bodyList[0] as NotificationMethod, notificationMethod: message.bodyList[0] as NotificationMethod,
mobileNotification: message.bodyList[1], mobileNotification: message.bodyList[1],
fontFamily: message.bodyList[2], fontFamily: message.bodyList[2],
@ -148,5 +149,5 @@ export const decodeRegUpdate: ProtocolDecoder<RegUpdateResponse> = (
hrInformationLanguage: message.bodyList[11], hrInformationLanguage: message.bodyList[11],
deviceType: message.bodyList[12], deviceType: message.bodyList[12],
translationKey: message.bodyList[13] translationKey: message.bodyList[13]
} as RegUpdateResponse; } as RegUpdateResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
ProtocolEncoder, ProtocolEncoder,
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface
@ -52,7 +53,7 @@ export const encodeRegView: ProtocolEncoder<RegViewRequest> = (
export const decodeRegView: ProtocolDecoder<RegViewResponse> = ( export const decodeRegView: ProtocolDecoder<RegViewResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
notificationMethod: message.bodyList[0] as NotificationMethod, notificationMethod: message.bodyList[0] as NotificationMethod,
mobileNotification: message.bodyList[1], mobileNotification: message.bodyList[1],
fontFamily: message.bodyList[2], fontFamily: message.bodyList[2],
@ -66,5 +67,5 @@ export const decodeRegView: ProtocolDecoder<RegViewResponse> = (
menuLanguage: message.bodyList[10], menuLanguage: message.bodyList[10],
hrInformationLanguage: message.bodyList[11], hrInformationLanguage: message.bodyList[11],
translationKey: message.bodyList[12] translationKey: message.bodyList[12]
} as RegViewResponse; } as RegViewResponse);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface UpdateRequest extends ProtocolRequest { export interface UpdateRequest extends ProtocolRequest {
@ -58,10 +59,10 @@ export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = ( export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
receiveAlarm: message.bodyList[0] === 'Y' ? true : false, receiveAlarm: message.bodyList[0] === 'Y' ? true : false,
displayAlarm: message.bodyList[1] === 'Y' ? true : false, displayAlarm: message.bodyList[1] === 'Y' ? true : false,
receiveGroupAlarm: message.bodyList[2] === 'Y' ? true : false, receiveGroupAlarm: message.bodyList[2] === 'Y' ? true : false,
receivePcAlarm: message.bodyList[3] === 'Y' ? true : false receivePcAlarm: message.bodyList[3] === 'Y' ? true : false
} as UpdateResponse; } as UpdateResponse);
}; };

View File

@ -4,7 +4,8 @@ import {
ProtocolEncoder, ProtocolEncoder,
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface // tslint:disable-next-line: no-empty-interface
@ -30,10 +31,10 @@ export const encodeView: ProtocolEncoder<ViewRequest> = (req: ViewRequest) => {
export const decodeView: ProtocolDecoder<ViewResponse> = ( export const decodeView: ProtocolDecoder<ViewResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
receiveAlarm: message.bodyList[0] === 'Y' ? true : false, receiveAlarm: message.bodyList[0] === 'Y' ? true : false,
displayAlarm: message.bodyList[1] === 'Y' ? true : false, displayAlarm: message.bodyList[1] === 'Y' ? true : false,
receiveGroupAlarm: message.bodyList[2] === 'Y' ? true : false, receiveGroupAlarm: message.bodyList[2] === 'Y' ? true : false,
receivePcAlarm: message.bodyList[3] === 'Y' ? true : false receivePcAlarm: message.bodyList[3] === 'Y' ? true : false
} as ViewResponse; } as ViewResponse);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface PingRequest extends ProtocolRequest { export interface PingRequest extends ProtocolRequest {
@ -30,5 +31,5 @@ export const encodePing: ProtocolEncoder<PingRequest> = (req: PingRequest) => {
export const decodePing: ProtocolDecoder<PingResponse> = ( export const decodePing: ProtocolDecoder<PingResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return {} as PingResponse; return decodeProtocolMessage(message, {} as PingResponse);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { import {
DeviceType, DeviceType,
@ -88,7 +89,7 @@ export const encodeAuth: ProtocolEncoder<AuthRequest> = (req: AuthRequest) => {
export const decodeAuth: ProtocolDecoder<AuthResponse> = ( export const decodeAuth: ProtocolDecoder<AuthResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
deviceType: message.bodyList[0] as DeviceType, deviceType: message.bodyList[0] as DeviceType,
fileTransferAllowedCompanyList: (message.bodyList[1] as string).split(';'), fileTransferAllowedCompanyList: (message.bodyList[1] as string).split(';'),
fileTransferPermissions: message.bodyList[2] as FileTransferPermissions, fileTransferPermissions: message.bodyList[2] as FileTransferPermissions,
@ -117,5 +118,5 @@ export const decodeAuth: ProtocolDecoder<AuthResponse> = (
.bodyList[23] as string).split(';'), .bodyList[23] as string).split(';'),
canStreamingTransmission: message.bodyList[24] === 'Y' ? true : false, canStreamingTransmission: message.bodyList[24] === 'Y' ? true : false,
canIMessengerMessageBox: message.bodyList[25] === 'Y' ? true : false canIMessengerMessageBox: message.bodyList[25] === 'Y' ? true : false
} as AuthResponse; } as AuthResponse);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue PacketBodyValue,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { CallMode } from '@ucap-webmessenger/core'; import { CallMode } from '@ucap-webmessenger/core';
@ -44,11 +45,11 @@ export const encodeDataUserExt: ProtocolEncoder<DataUserExtRequest> = (
export const decodeDataUserExt: ProtocolDecoder<DataUserExtResponse> = ( export const decodeDataUserExt: ProtocolDecoder<DataUserExtResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
seq: message.bodyList[1], seq: message.bodyList[1],
callMode: message.bodyList[2] as CallMode, callMode: message.bodyList[2] as CallMode,
hardSadn: message.bodyList[3], hardSadn: message.bodyList[3],
fmcSadn: message.bodyList[4] fmcSadn: message.bodyList[4]
} as DataUserExtResponse; } as DataUserExtResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
BodyStringDivider BodyStringDivider,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room'; import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication'; import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
@ -82,8 +83,8 @@ export const decodeDataUser: ProtocolDecoder<DataUserResponse> = (
employeeType: info[28] as EmployeeType employeeType: info[28] as EmployeeType
}; };
} }
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
userInfo userInfo
} as DataUserResponse; } as DataUserResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room'; import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication'; import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
@ -115,19 +116,19 @@ export const decodeDeptUserData: ProtocolDecoder<DeptUserData> = (
employeeType: info[28] as EmployeeType employeeType: info[28] as EmployeeType
}); });
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
userInfos userInfos
} as DeptUserData; } as DeptUserData);
}; };
export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = ( export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
pageTotalCount: message.bodyList[1], pageTotalCount: message.bodyList[1],
pageListCount: message.bodyList[2], pageListCount: message.bodyList[2],
pageCurrent: message.bodyList[3] pageCurrent: message.bodyList[3]
} as DeptUserResponse; } as DeptUserResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { DeptType } from '../types/dept.type'; import { DeptType } from '../types/dept.type';
import { DeptInfo } from '../models/dept-info'; import { DeptInfo } from '../models/dept-info';
@ -58,14 +59,14 @@ export const decodeDeptData: ProtocolDecoder<DeptData> = (
nameCn: info[10] nameCn: info[10]
}); });
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
departmentInfos departmentInfos
} as DeptData; } as DeptData);
}; };
export const decodeDept: ProtocolDecoder<DeptResponse> = ( export const decodeDept: ProtocolDecoder<DeptResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { divCd: message.bodyList[0] } as DeptResponse; return decodeProtocolMessage(message, { divCd: message.bodyList[0] } as DeptResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room'; import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication'; import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
@ -111,19 +112,19 @@ export const decodeUserDnData: ProtocolDecoder<UserDnData> = (
deptNameCn: info[23] deptNameCn: info[23]
}); });
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
userDnInfos userDnInfos
} as UserDnData; } as UserDnData);
}; };
export const decodeUserDn: ProtocolDecoder<UserDnResponse> = ( export const decodeUserDn: ProtocolDecoder<UserDnResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
pageTotalCount: message.bodyList[1], pageTotalCount: message.bodyList[1],
pageListCount: message.bodyList[2], pageListCount: message.bodyList[2],
pageCurrent: message.bodyList[3] pageCurrent: message.bodyList[3]
} as UserDnResponse; } as UserDnResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room'; import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { UserSeqInfo } from '../models/user-seq-info'; import { UserSeqInfo } from '../models/user-seq-info';
@ -63,14 +64,14 @@ export const decodeUserIdData: ProtocolDecoder<UserIdData> = (
companyCode: info[3] companyCode: info[3]
}); });
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
userSeqInfos userSeqInfos
} as UserIdData; } as UserIdData);
}; };
export const decodeUserId: ProtocolDecoder<UserIdResponse> = ( export const decodeUserId: ProtocolDecoder<UserIdResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { divCd: message.bodyList[0] } as UserIdResponse; return decodeProtocolMessage(message, { divCd: message.bodyList[0] } as UserIdResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
ProtocolMessage, ProtocolMessage,
PacketBodyValue, PacketBodyValue,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room'; import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication'; import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
@ -96,10 +97,10 @@ export const decodeUserSeqData: ProtocolDecoder<UserSeqData> = (
nickName: info[28] nickName: info[28]
} as UserInfoF); } as UserInfoF);
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
userInfos userInfos
} as UserSeqData; } as UserSeqData);
}; };
export const decodeUserSeqData2: ProtocolDecoder<UserSeqData2> = ( export const decodeUserSeqData2: ProtocolDecoder<UserSeqData2> = (
@ -140,19 +141,19 @@ export const decodeUserSeqData2: ProtocolDecoder<UserSeqData2> = (
employeeType: info[28] as EmployeeType employeeType: info[28] as EmployeeType
}); });
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
userInfos userInfos
} as UserSeqData2; } as UserSeqData2);
}; };
// export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = ( // export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = (
// message: ProtocolMessage // message: ProtocolMessage
// ) => { // ) => {
// return { // return decodeProtocolMessage(message, {
// divCd: message.bodyList[0], // divCd: message.bodyList[0],
// pageTotalCount: message.bodyList[1], // pageTotalCount: message.bodyList[1],
// pageListCount: message.bodyList[2], // pageListCount: message.bodyList[2],
// pageCurrent: message.bodyList[3] // pageCurrent: message.bodyList[3]
// } as DeptUserResponse; // } as DeptUserResponse);
// }; // };

View File

@ -108,10 +108,10 @@ export class QueryProtocolService {
takeWhile(res => SSVC_TYPE_QUERY_DEPT_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_QUERY_DEPT_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_QUERY_DEPT_DATA === res.subServiceType) { if (SSVC_TYPE_QUERY_DEPT_DATA === res.subServiceType) {
return { ...decodeDeptData(res), Type: SSVC_TYPE_QUERY_DEPT_DATA }; return decodeDeptData(res);
} }
return { ...decodeDept(res), Type: SSVC_TYPE_QUERY_DEPT_RES }; return decodeDept(res);
}) })
); );
} }
@ -131,16 +131,10 @@ export class QueryProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_QUERY_DEPT_USER_DATA === res.subServiceType) { if (SSVC_TYPE_QUERY_DEPT_USER_DATA === res.subServiceType) {
return { return decodeDeptUserData(res);
...decodeDeptUserData(res),
Type: SSVC_TYPE_QUERY_DEPT_USER_DATA
};
} }
return { return decodeDeptUser(res);
...decodeDeptUser(res),
Type: SSVC_TYPE_QUERY_DEPT_USER_RES
};
}) })
); );
} }
@ -160,16 +154,10 @@ export class QueryProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_QUERY_DEPT_USER2_DATA === res.subServiceType) { if (SSVC_TYPE_QUERY_DEPT_USER2_DATA === res.subServiceType) {
return { return decodeDeptUserData(res);
...decodeDeptUserData(res),
Type: SSVC_TYPE_QUERY_DEPT_USER2_DATA
};
} }
return { return decodeDeptUser(res);
...decodeDeptUser(res),
Type: SSVC_TYPE_QUERY_DEPT_USER2_RES
};
}) })
); );
} }
@ -188,15 +176,9 @@ export class QueryProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_QUERY_USER_SEQ_DATA === res.subServiceType) { if (SSVC_TYPE_QUERY_USER_SEQ_DATA === res.subServiceType) {
return { return decodeUserSeqData(res);
...decodeUserSeqData(res),
Type: SSVC_TYPE_QUERY_USER_SEQ_DATA
};
} else if (SSVC_TYPE_QUERY_USER_SEQ_DATA2 === res.subServiceType) { } else if (SSVC_TYPE_QUERY_USER_SEQ_DATA2 === res.subServiceType) {
return { return decodeUserSeqData2(res);
...decodeUserSeqData2(res),
Type: SSVC_TYPE_QUERY_USER_SEQ_DATA2
};
} }
}) })
); );
@ -215,16 +197,10 @@ export class QueryProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_QUERY_USER_ID_DATA === res.subServiceType) { if (SSVC_TYPE_QUERY_USER_ID_DATA === res.subServiceType) {
return { return decodeUserIdData(res);
...decodeUserIdData(res),
Type: SSVC_TYPE_QUERY_USER_SEQ_DATA
};
} }
return { return decodeUserId(res);
...decodeUserId(res),
Type: SSVC_TYPE_QUERY_USER_ID_RES
};
}) })
); );
} }
@ -242,16 +218,10 @@ export class QueryProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_QUERY_USER_BY_DN_DATA === res.subServiceType) { if (SSVC_TYPE_QUERY_USER_BY_DN_DATA === res.subServiceType) {
return { return decodeUserDnData(res);
...decodeUserDnData(res),
Type: SSVC_TYPE_QUERY_USER_BY_DN_DATA
};
} }
return { return decodeUserDn(res);
...decodeUserDn(res),
Type: SSVC_TYPE_QUERY_USER_BY_DN_RES
};
}) })
); );
} }

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { RoomExitType } from '../types/room.type'; import { RoomExitType } from '../types/room.type';
@ -36,16 +37,16 @@ export const encodeExit: ProtocolEncoder<ExitRequest> = (req: ExitRequest) => {
export const decodeExit: ProtocolDecoder<ExitResponse> = ( export const decodeExit: ProtocolDecoder<ExitResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as ExitResponse; } as ExitResponse);
}; };
export const decodeExitNotification: ProtocolDecoder<ExitNotification> = ( export const decodeExitNotification: ProtocolDecoder<ExitNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as ExitNotification; } as ExitNotification);
}; };
export interface ExitAllRequest extends ProtocolRequest { export interface ExitAllRequest extends ProtocolRequest {
@ -68,9 +69,9 @@ export const encodeAllExit: ProtocolEncoder<ExitAllRequest> = (
export const decodeAllExit: ProtocolDecoder<ExitAllResponse> = ( export const decodeAllExit: ProtocolDecoder<ExitAllResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0].split(BodyStringDivider) roomSeq: message.bodyList[0].split(BodyStringDivider)
} as ExitAllResponse; } as ExitAllResponse);
}; };
export interface ExitForcingRequest extends ProtocolRequest { export interface ExitForcingRequest extends ProtocolRequest {
@ -127,12 +128,12 @@ export const decodeExitForcing: ProtocolDecoder<ExitForcingResponse> = (
if (message.bodyList.length > 3) { if (message.bodyList.length > 3) {
userSeqs = message.bodyList.slice(3); userSeqs = message.bodyList.slice(3);
} }
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
type: message.bodyList[1] as RoomExitType, type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2], senderSeq: message.bodyList[2],
userSeqs userSeqs
} as ExitForcingResponse; } as ExitForcingResponse);
}; };
export const decodeExitForcingNotification: ProtocolDecoder< export const decodeExitForcingNotification: ProtocolDecoder<
ExitForcingNotification ExitForcingNotification
@ -141,10 +142,10 @@ export const decodeExitForcingNotification: ProtocolDecoder<
if (message.bodyList.length > 3) { if (message.bodyList.length > 3) {
userSeqs = message.bodyList.slice(3); userSeqs = message.bodyList.slice(3);
} }
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
type: message.bodyList[1] as RoomExitType, type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2], senderSeq: message.bodyList[2],
userSeqs userSeqs
} as ExitForcingNotification; } as ExitForcingNotification);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { LocaleCode } from '@ucap-webmessenger/core'; import { LocaleCode } from '@ucap-webmessenger/core';
import { RoomType } from '../types/room.type'; import { RoomType } from '../types/room.type';
@ -68,9 +69,9 @@ export const encodeInfo: ProtocolEncoder<InfoRequest> = (req: InfoRequest) => {
export const decodeInfo: ProtocolDecoder<InfoResponse> = ( export const decodeInfo: ProtocolDecoder<InfoResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as InfoResponse; } as InfoResponse);
}; };
export const decodeInfoData: ProtocolDecoder<InfoData> = ( export const decodeInfoData: ProtocolDecoder<InfoData> = (
@ -98,10 +99,10 @@ export const decodeInfoData: ProtocolDecoder<InfoData> = (
} }
} }
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
roomInfo roomInfo
} as InfoData; } as InfoData);
}; };
export const decodeUserShortData: ProtocolDecoder<UserShortData> = ( export const decodeUserShortData: ProtocolDecoder<UserShortData> = (
@ -128,10 +129,10 @@ export const decodeUserShortData: ProtocolDecoder<UserShortData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
userInfos userInfos
} as UserShortData; } as UserShortData);
}; };
export const decodeUserData: ProtocolDecoder<UserData> = ( export const decodeUserData: ProtocolDecoder<UserData> = (
@ -174,10 +175,10 @@ export const decodeUserData: ProtocolDecoder<UserData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
userInfos userInfos
} as UserData; } as UserData);
}; };
export interface UserStatusOfflineRequest extends ProtocolRequest { export interface UserStatusOfflineRequest extends ProtocolRequest {
@ -206,8 +207,8 @@ export const decodeUserStatusOffline: ProtocolDecoder<
if (message.bodyList.length > 1) { if (message.bodyList.length > 1) {
userSeqs = message.bodyList.slice(1); userSeqs = message.bodyList.slice(1);
} }
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
userSeqs userSeqs
} as UserStatusOfflineResponse; } as UserStatusOfflineResponse);
}; };

View File

@ -6,7 +6,8 @@ import {
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface InviteRequest extends ProtocolRequest { export interface InviteRequest extends ProtocolRequest {
@ -41,15 +42,15 @@ export const encodeInvite: ProtocolEncoder<InviteRequest> = (
export const decodeInvite: ProtocolDecoder<InviteResponse> = ( export const decodeInvite: ProtocolDecoder<InviteResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as InviteResponse; } as InviteResponse);
}; };
export const decodeInviteNotification: ProtocolDecoder<InviteNotification> = ( export const decodeInviteNotification: ProtocolDecoder<InviteNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0] roomSeq: message.bodyList[0]
} as InviteNotification; } as InviteNotification);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface OpenRequest extends ProtocolRequest { export interface OpenRequest extends ProtocolRequest {
@ -38,11 +39,11 @@ export const encodeOpen: ProtocolEncoder<OpenRequest> = (req: OpenRequest) => {
export const decodeOpen: ProtocolDecoder<OpenResponse> = ( export const decodeOpen: ProtocolDecoder<OpenResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
roomSeq: message.bodyList[1], roomSeq: message.bodyList[1],
newRoom: message.bodyList[2] === 'Y' ? true : false newRoom: message.bodyList[2] === 'Y' ? true : false
} as OpenResponse; } as OpenResponse);
}; };
export interface Open2Request extends ProtocolRequest { export interface Open2Request extends ProtocolRequest {
@ -82,12 +83,12 @@ export const encodeOpen2: ProtocolEncoder<Open2Request> = (
export const decodeOpen2: ProtocolDecoder<Open2Response> = ( export const decodeOpen2: ProtocolDecoder<Open2Response> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
roomName: message.bodyList[1], roomName: message.bodyList[1],
roomSeq: message.bodyList[2], roomSeq: message.bodyList[2],
newRoom: message.bodyList[3] === 'Y' ? true : false newRoom: message.bodyList[3] === 'Y' ? true : false
} as Open2Response; } as Open2Response);
}; };
export interface Open3Request extends ProtocolRequest { export interface Open3Request extends ProtocolRequest {
@ -143,14 +144,14 @@ export const encodeOpen3: ProtocolEncoder<Open3Request> = (
export const decodeOpen3: ProtocolDecoder<Open3Response> = ( export const decodeOpen3: ProtocolDecoder<Open3Response> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
roomName: message.bodyList[1], roomName: message.bodyList[1],
roomSeq: message.bodyList[2], roomSeq: message.bodyList[2],
newRoom: message.bodyList[3] === 'Y' ? true : false, newRoom: message.bodyList[3] === 'Y' ? true : false,
isTimerRoom: message.bodyList[4] === 'Y' ? true : false, isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
timerRoomInterval: message.bodyList[5] || 0 timerRoomInterval: message.bodyList[5] || 0
} as Open3Response; } as Open3Response);
}; };
export interface Open4Request extends ProtocolRequest { export interface Open4Request extends ProtocolRequest {
@ -206,7 +207,7 @@ export const encodeOpen4: ProtocolEncoder<Open4Request> = (
export const decodeOpen4: ProtocolDecoder<Open4Response> = ( export const decodeOpen4: ProtocolDecoder<Open4Response> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
roomName: message.bodyList[1], roomName: message.bodyList[1],
roomSeq: message.bodyList[2], roomSeq: message.bodyList[2],
@ -214,5 +215,5 @@ export const decodeOpen4: ProtocolDecoder<Open4Response> = (
isTimerRoom: message.bodyList[4] === 'Y' ? true : false, isTimerRoom: message.bodyList[4] === 'Y' ? true : false,
timerRoomInterval: timerRoomInterval:
message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0 message.bodyList[4] !== 'Y' ? 0 : message.bodyList[5] || 0
} as Open4Response; } as Open4Response);
}; };

View File

@ -6,7 +6,8 @@ import {
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface UpdateRequest extends ProtocolRequest { export interface UpdateRequest extends ProtocolRequest {
@ -52,12 +53,12 @@ export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = ( export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
roomName: message.bodyList[1], roomName: message.bodyList[1],
isAlarm: message.bodyList[2] === 'Y' ? true : false, isAlarm: message.bodyList[2] === 'Y' ? true : false,
isSyncAll: message.bodyList[3] === 'Y' ? true : false isSyncAll: message.bodyList[3] === 'Y' ? true : false
} as UpdateResponse; } as UpdateResponse);
}; };
export interface UpdateTimerSetRequest extends ProtocolRequest { export interface UpdateTimerSetRequest extends ProtocolRequest {
@ -87,10 +88,10 @@ export const encodeUpdateTimerSet: ProtocolEncoder<UpdateTimerSetRequest> = (
export const decodeUpdateTimerSet: ProtocolDecoder<UpdateTimerSetResponse> = ( export const decodeUpdateTimerSet: ProtocolDecoder<UpdateTimerSetResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
timerInterval: message.bodyList[1] || 0 timerInterval: message.bodyList[1] || 0
} as UpdateTimerSetResponse; } as UpdateTimerSetResponse);
}; };
export interface UpdateFontRequest extends ProtocolRequest { export interface UpdateFontRequest extends ProtocolRequest {
@ -134,19 +135,19 @@ export const encodeUpdateFont: ProtocolEncoder<UpdateFontRequest> = (
export const decodeUpdateFont: ProtocolDecoder<UpdateFontResponse> = ( export const decodeUpdateFont: ProtocolDecoder<UpdateFontResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
fontColor: message.bodyList[1], fontColor: message.bodyList[1],
senderSeq: message.bodyList[2] senderSeq: message.bodyList[2]
} as UpdateFontResponse; } as UpdateFontResponse);
}; };
export const decodeUpdateFontNotification: ProtocolDecoder< export const decodeUpdateFontNotification: ProtocolDecoder<
UpdateFontNotification UpdateFontNotification
> = (message: ProtocolMessage) => { > = (message: ProtocolMessage) => {
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
fontColor: message.bodyList[1], fontColor: message.bodyList[1],
senderSeq: message.bodyList[2] senderSeq: message.bodyList[2]
} as UpdateFontNotification; } as UpdateFontNotification);
}; };

View File

@ -129,34 +129,28 @@ export class RoomProtocolService {
switch (message.subServiceType) { switch (message.subServiceType) {
case SSVC_TYPE_ROOM_INVITE_NOTI: case SSVC_TYPE_ROOM_INVITE_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(
...decodeInviteNotification(message), decodeInviteNotification(message)
Type: SSVC_TYPE_ROOM_INVITE_NOTI );
});
} }
break; break;
case SSVC_TYPE_ROOM_EXIT_NOTI: case SSVC_TYPE_ROOM_EXIT_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(decodeExitNotification(message));
...decodeExitNotification(message),
Type: SSVC_TYPE_ROOM_EXIT_NOTI
});
} }
break; break;
case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI: case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(
...decodeExitForcingNotification(message), decodeExitForcingNotification(message)
Type: SSVC_TYPE_ROOM_EXIT_FORCING_NOTI );
});
} }
break; break;
case SSVC_TYPE_ROOM_FONT_UPD_NOTI: case SSVC_TYPE_ROOM_FONT_UPD_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(
...decodeUpdateFontNotification(message), decodeUpdateFontNotification(message)
Type: SSVC_TYPE_ROOM_FONT_UPD_NOTI );
});
} }
break; break;
@ -219,17 +213,14 @@ export class RoomProtocolService {
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) { if (SSVC_TYPE_ROOM_INFO_ROOM === res.subServiceType) {
return { ...decodeInfoData(res), Type: SSVC_TYPE_ROOM_INFO_ROOM }; return decodeInfoData(res);
} else if (SSVC_TYPE_ROOM_INFO_USER === res.subServiceType) { } else if (SSVC_TYPE_ROOM_INFO_USER === res.subServiceType) {
return { return decodeUserShortData(res);
...decodeUserShortData(res),
Type: SSVC_TYPE_ROOM_INFO_USER
};
} else if (SSVC_TYPE_ROOM_INFO_USER2 === res.subServiceType) { } else if (SSVC_TYPE_ROOM_INFO_USER2 === res.subServiceType) {
return { ...decodeUserData(res), Type: SSVC_TYPE_ROOM_INFO_USER2 }; return decodeUserData(res);
} }
return { ...decodeInfo(res), Type: SSVC_TYPE_ROOM_INFO_RES }; return decodeInfo(res);
}) })
); );
} }

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
export interface UserPasswordSetRequest extends ProtocolRequest { export interface UserPasswordSetRequest extends ProtocolRequest {
@ -45,10 +46,10 @@ export const encodeUserPasswordSet: ProtocolEncoder<UserPasswordSetRequest> = (
export const decodeUserPasswordSet: ProtocolDecoder<UserPasswordSetResponse> = ( export const decodeUserPasswordSet: ProtocolDecoder<UserPasswordSetResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
loginId: message.bodyList[0], loginId: message.bodyList[0],
oldLoginPw: message.bodyList[1], oldLoginPw: message.bodyList[1],
newLoginPw: message.bodyList[2], newLoginPw: message.bodyList[2],
companyCode: message.bodyList[3] companyCode: message.bodyList[3]
} as UserPasswordSetResponse; } as UserPasswordSetResponse);
}; };

View File

@ -2,7 +2,8 @@ import {
ProtocolResponse, ProtocolResponse,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider BodyStringDivider,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { StatusCode } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/core';
import { StatusInfo } from '../models/status-info'; import { StatusInfo } from '../models/status-info';
@ -29,7 +30,7 @@ export const decodeBuddy: ProtocolDecoder<BuddyResponse> = (
imessengerStatus: info[7] as StatusCode imessengerStatus: info[7] as StatusCode
}); });
}); });
return { return decodeProtocolMessage(message, {
statusInfos statusInfos
} as BuddyResponse; } as BuddyResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { StatusCode } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/core';
import { import {
@ -50,9 +51,9 @@ export const encodeBulkInfo: ProtocolEncoder<BulkInfoRequest> = (
export const decodeBulkInfo: ProtocolDecoder<BulkInfoResponse> = ( export const decodeBulkInfo: ProtocolDecoder<BulkInfoResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0] divCd: message.bodyList[0]
} as BulkInfoResponse; } as BulkInfoResponse);
}; };
export const decodeBulkInfoData: ProtocolDecoder<BulkInfoData> = ( export const decodeBulkInfoData: ProtocolDecoder<BulkInfoData> = (
@ -74,8 +75,8 @@ export const decodeBulkInfoData: ProtocolDecoder<BulkInfoData> = (
terminalStatusNumber: Number(info[9]) as TerminalStatusNumber terminalStatusNumber: Number(info[9]) as TerminalStatusNumber
}); });
}); });
return { return decodeProtocolMessage(message, {
divCd: message.bodyList[0], divCd: message.bodyList[0],
statusBulkInfos statusBulkInfos
} as BulkInfoData; } as BulkInfoData);
}; };

View File

@ -5,7 +5,8 @@ import {
PacketBody, PacketBody,
PacketBodyValue, PacketBodyValue,
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { MessageIndexType } from '../types/message-index.type'; import { MessageIndexType } from '../types/message-index.type';
@ -38,8 +39,8 @@ export const encodeMessageUpdate: ProtocolEncoder<MessageUpdateRequest> = (
export const decodeMessageUpdate: ProtocolDecoder<MessageUpdateResponse> = ( export const decodeMessageUpdate: ProtocolDecoder<MessageUpdateResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
index: message.bodyList[0] as MessageIndexType, index: message.bodyList[0] as MessageIndexType,
statusMessage: message.bodyList[1] statusMessage: message.bodyList[1]
} as MessageUpdateResponse; } as MessageUpdateResponse);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolNotification ProtocolNotification,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { StatusType, StatusCode } from '@ucap-webmessenger/core'; import { StatusType, StatusCode } from '@ucap-webmessenger/core';
import { StatusInfo } from '../models/status-info'; import { StatusInfo } from '../models/status-info';
@ -54,18 +55,18 @@ export const encodeStatus: ProtocolEncoder<StatusRequest> = (
export const decodeStatus: ProtocolDecoder<StatusResponse> = ( export const decodeStatus: ProtocolDecoder<StatusResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
statusDivisionType: message.bodyList[0] as StatusType, statusDivisionType: message.bodyList[0] as StatusType,
statusType: message.bodyList[1] as StatusCode, statusType: message.bodyList[1] as StatusCode,
statusMessage: message.bodyList[2] statusMessage: message.bodyList[2]
} as StatusResponse; } as StatusResponse);
}; };
export const decodeStatusNotification: ProtocolDecoder<StatusNotification> = ( export const decodeStatusNotification: ProtocolDecoder<StatusNotification> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
const info = message.bodyList[0].split(BodyStringDivider); const info = message.bodyList[0].split(BodyStringDivider);
return { return decodeProtocolMessage(message, {
userSeq: Number(info[0]), userSeq: Number(info[0]),
pcStatus: info[1] as StatusCode, pcStatus: info[1] as StatusCode,
phoneStatus: info[2] as StatusCode, phoneStatus: info[2] as StatusCode,
@ -74,5 +75,5 @@ export const decodeStatusNotification: ProtocolDecoder<StatusNotification> = (
statusMessage: info[5], statusMessage: info[5],
mobileConferenceStatus: info[6] as StatusCode, mobileConferenceStatus: info[6] as StatusCode,
imessengerStatus: info[7] as StatusCode imessengerStatus: info[7] as StatusCode
} as StatusNotification; } as StatusNotification);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { StatusCode } from '@ucap-webmessenger/core'; import { StatusCode } from '@ucap-webmessenger/core';
import { StatusInfo } from '../models/status-info'; import { StatusInfo } from '../models/status-info';
@ -58,9 +59,9 @@ export const decodeSubscribe: ProtocolDecoder<SubscribeResponse> = (
imessengerStatus: info[7] as StatusCode imessengerStatus: info[7] as StatusCode
}); });
}); });
return { return decodeProtocolMessage(message, {
statusInfos statusInfos
} as SubscribeResponse; } as SubscribeResponse);
}; };
/** /**
@ -84,8 +85,8 @@ export const decodeSubscribeData: ProtocolDecoder<SubscribeData> = (
imessengerStatus: info[7] as StatusCode imessengerStatus: info[7] as StatusCode
}); });
}); });
return { return decodeProtocolMessage(message, {
statusInfos statusInfos
// tslint:disable-next-line: deprecation // tslint:disable-next-line: deprecation
} as SubscribeData; } as SubscribeData);
}; };

View File

@ -70,10 +70,9 @@ export class StatusProtocolService {
switch (message.subServiceType) { switch (message.subServiceType) {
case SSVC_TYPE_STATUS_NOTI: case SSVC_TYPE_STATUS_NOTI:
{ {
this.notificationSubject.next({ this.notificationSubject.next(
...decodeStatusNotification(message), decodeStatusNotification(message)
Type: SSVC_TYPE_STATUS_NOTI );
});
} }
break; break;
@ -123,15 +122,9 @@ export class StatusProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_STATUS_BULK_INFO_DATA === res.subServiceType) { if (SSVC_TYPE_STATUS_BULK_INFO_DATA === res.subServiceType) {
return { return decodeBulkInfoData(res);
...decodeBulkInfoData(res),
Type: SSVC_TYPE_STATUS_BULK_INFO_DATA
};
} }
return { return decodeBulkInfo(res);
...decodeBulkInfo(res),
Type: SSVC_TYPE_STATUS_BULK_INFO_RES
};
}) })
); );
} }

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { UserInfo } from '../types/userInfo'; import { UserInfo } from '../types/userInfo';
import { EmployeeType } from '@ucap-webmessenger/protocol-room'; import { EmployeeType } from '@ucap-webmessenger/protocol-room';
@ -45,9 +46,9 @@ export const encodeBuddy: ProtocolEncoder<BuddyRequest> = (
export const decodeBuddy: ProtocolDecoder<BuddyResponse> = ( export const decodeBuddy: ProtocolDecoder<BuddyResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
syncDate: message.bodyList[0] syncDate: message.bodyList[0]
} as BuddyResponse; } as BuddyResponse);
}; };
export const decodeBuddyData: ProtocolDecoder<BuddyData> = ( export const decodeBuddyData: ProtocolDecoder<BuddyData> = (
@ -62,9 +63,9 @@ export const decodeBuddyData: ProtocolDecoder<BuddyData> = (
isBuddy: info[2] === 'Y' ? true : false isBuddy: info[2] === 'Y' ? true : false
}); });
}); });
return { return decodeProtocolMessage(message, {
buddyInfos buddyInfos
} as BuddyData; } as BuddyData);
}; };
export const decodeBuddyDetailData: ProtocolDecoder<BuddyDetailData> = ( export const decodeBuddyDetailData: ProtocolDecoder<BuddyDetailData> = (
@ -106,7 +107,7 @@ export const decodeBuddyDetailData: ProtocolDecoder<BuddyDetailData> = (
nickName: info[28] nickName: info[28]
}); });
}); });
return { return decodeProtocolMessage(message, {
buddyInfos buddyInfos
} as BuddyDetailData; } as BuddyDetailData);
}; };

View File

@ -7,7 +7,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { GroupInfo } from '../models/group-info'; import { GroupInfo } from '../models/group-info';
@ -49,9 +50,9 @@ export const encodeGroup: ProtocolEncoder<GroupRequest> = (
export const decodeGroup: ProtocolDecoder<GroupResponse> = ( export const decodeGroup: ProtocolDecoder<GroupResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
syncDate: message.bodyList[0] syncDate: message.bodyList[0]
} as GroupResponse; } as GroupResponse);
}; };
export const decodeGroupData: ProtocolDecoder<GroupData> = ( export const decodeGroupData: ProtocolDecoder<GroupData> = (
@ -68,9 +69,9 @@ export const decodeGroupData: ProtocolDecoder<GroupData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
groupInfos groupInfos
} as GroupData; } as GroupData);
}; };
export const decodeGroupDetailData: ProtocolDecoder<GroupDetailData> = ( export const decodeGroupDetailData: ProtocolDecoder<GroupDetailData> = (
@ -80,7 +81,7 @@ export const decodeGroupDetailData: ProtocolDecoder<GroupDetailData> = (
if (message.bodyList.length > 3) { if (message.bodyList.length > 3) {
userSeqs = message.bodyList.slice(3); userSeqs = message.bodyList.slice(3);
} }
return { return decodeProtocolMessage(message, {
// 그룹SEQ(n) // 그룹SEQ(n)
seq: message.bodyList[0], seq: message.bodyList[0],
// 그룹이름(s) // 그룹이름(s)
@ -89,5 +90,5 @@ export const decodeGroupDetailData: ProtocolDecoder<GroupDetailData> = (
isActive: message.bodyList[2] === 'Y' ? true : false, isActive: message.bodyList[2] === 'Y' ? true : false,
// 사용자SEQ(n)1 // 사용자SEQ(n)1
userSeqs userSeqs
} as GroupDetailData; } as GroupDetailData);
}; };

View File

@ -8,7 +8,8 @@ import {
ProtocolDecoder, ProtocolDecoder,
ProtocolMessage, ProtocolMessage,
BodyStringDivider, BodyStringDivider,
ProtocolStream ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol'; } from '@ucap-webmessenger/protocol';
import { import {
RoomInfo, RoomInfo,
@ -61,9 +62,9 @@ export const encodeRoom: ProtocolEncoder<RoomRequest> = (req: RoomRequest) => {
export const decodeRoom: ProtocolDecoder<RoomResponse> = ( export const decodeRoom: ProtocolDecoder<RoomResponse> = (
message: ProtocolMessage message: ProtocolMessage
) => { ) => {
return { return decodeProtocolMessage(message, {
syncDate: message.bodyList[0] syncDate: message.bodyList[0]
} as RoomResponse; } as RoomResponse);
}; };
export const decodeRoomData: ProtocolDecoder<RoomData> = ( export const decodeRoomData: ProtocolDecoder<RoomData> = (
@ -92,10 +93,10 @@ export const decodeRoomData: ProtocolDecoder<RoomData> = (
} }
} }
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
roomInfos roomInfos
} as RoomData; } as RoomData);
}; };
export const decodeRoomUserData: ProtocolDecoder<RoomUserData> = ( export const decodeRoomUserData: ProtocolDecoder<RoomUserData> = (
@ -122,10 +123,10 @@ export const decodeRoomUserData: ProtocolDecoder<RoomUserData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
userInfos userInfos
} as RoomUserData; } as RoomUserData);
}; };
export const decodeRoomUserDataDetail: ProtocolDecoder<RoomUserDetailData> = ( export const decodeRoomUserDataDetail: ProtocolDecoder<RoomUserDetailData> = (
@ -168,8 +169,8 @@ export const decodeRoomUserDataDetail: ProtocolDecoder<RoomUserDetailData> = (
}); });
}); });
return { return decodeProtocolMessage(message, {
roomSeq: message.bodyList[0], roomSeq: message.bodyList[0],
userInfos userInfos
} as RoomUserDetailData; } as RoomUserDetailData);
}; };

View File

@ -77,16 +77,10 @@ export class SyncProtocolService {
takeWhile(res => SSVC_TYPE_SYNC_BUDDY_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_SYNC_BUDDY_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_BUDDY_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_BUDDY_DATA === res.subServiceType) {
return { return decodeBuddyData(res);
...decodeBuddyData(res),
Type: SSVC_TYPE_SYNC_BUDDY_DATA
};
} }
return { return decodeBuddy(res);
...decodeBuddy(res),
Type: SSVC_TYPE_SYNC_BUDDY_RES
};
}) })
); );
} }
@ -103,16 +97,10 @@ export class SyncProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_BUDDY2_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_BUDDY2_DATA === res.subServiceType) {
return { return decodeBuddyDetailData(res);
...decodeBuddyDetailData(res),
Type: SSVC_TYPE_SYNC_BUDDY2_DATA
};
} }
return { return decodeBuddy(res);
...decodeBuddy(res),
Type: SSVC_TYPE_SYNC_BUDDY2_RES
};
}) })
); );
} }
@ -124,16 +112,10 @@ export class SyncProtocolService {
takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_SYNC_GROUP_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_GROUP_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_GROUP_DATA === res.subServiceType) {
return { return decodeGroupData(res);
...decodeGroupData(res),
Type: SSVC_TYPE_SYNC_GROUP_DATA
};
} }
return { return decodeGroup(res);
...decodeGroup(res),
Type: SSVC_TYPE_SYNC_GROUP_RES
};
}) })
); );
} }
@ -150,16 +132,10 @@ export class SyncProtocolService {
), ),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_GROUP_DATA2 === res.subServiceType) { if (SSVC_TYPE_SYNC_GROUP_DATA2 === res.subServiceType) {
return { return decodeGroupDetailData(res);
...decodeGroupDetailData(res),
Type: SSVC_TYPE_SYNC_GROUP_DATA2
};
} }
return { return decodeGroup(res);
...decodeGroup(res),
Type: SSVC_TYPE_SYNC_GROUP_RES2
};
}) })
); );
} }
@ -173,26 +149,14 @@ export class SyncProtocolService {
takeWhile(res => SSVC_TYPE_SYNC_ROOM_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_SYNC_ROOM_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_ROOM_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_ROOM_DATA === res.subServiceType) {
return { return decodeRoomData(res);
...decodeRoomData(res),
Type: SSVC_TYPE_SYNC_ROOM_DATA
};
} else if (SSVC_TYPE_SYNC_ROOM_USER === res.subServiceType) { } else if (SSVC_TYPE_SYNC_ROOM_USER === res.subServiceType) {
return { return decodeRoomUserData(res);
...decodeRoomUserData(res),
Type: SSVC_TYPE_SYNC_ROOM_USER
};
} else if (SSVC_TYPE_SYNC_ROOM_USER2 === res.subServiceType) { } else if (SSVC_TYPE_SYNC_ROOM_USER2 === res.subServiceType) {
return { return decodeRoomUserDataDetail(res);
...decodeRoomUserDataDetail(res),
Type: SSVC_TYPE_SYNC_ROOM_USER2
};
} }
return { return decodeRoom(res);
...decodeRoom(res),
Type: SSVC_TYPE_SYNC_ROOM_RES
};
}) })
); );
} }
@ -206,26 +170,14 @@ export class SyncProtocolService {
takeWhile(res => SSVC_TYPE_SYNC_ROOM2_RES !== res.subServiceType, true), takeWhile(res => SSVC_TYPE_SYNC_ROOM2_RES !== res.subServiceType, true),
map(res => { map(res => {
if (SSVC_TYPE_SYNC_ROOM2_DATA === res.subServiceType) { if (SSVC_TYPE_SYNC_ROOM2_DATA === res.subServiceType) {
return { return decodeRoomData(res);
...decodeRoomData(res),
Type: SSVC_TYPE_SYNC_ROOM2_DATA
};
} else if (SSVC_TYPE_SYNC_ROOM2_USER === res.subServiceType) { } else if (SSVC_TYPE_SYNC_ROOM2_USER === res.subServiceType) {
return { return decodeRoomUserData(res);
...decodeRoomUserData(res),
Type: SSVC_TYPE_SYNC_ROOM2_USER
};
} else if (SSVC_TYPE_SYNC_ROOM2_USER2 === res.subServiceType) { } else if (SSVC_TYPE_SYNC_ROOM2_USER2 === res.subServiceType) {
return { return decodeRoomUserDataDetail(res);
...decodeRoomUserDataDetail(res),
Type: SSVC_TYPE_SYNC_ROOM2_USER2
};
} }
return { return decodeRoom(res);
...decodeRoom(res),
Type: SSVC_TYPE_SYNC_ROOM2_RES
};
}) })
); );
} }

View File

@ -4,19 +4,21 @@ export interface ProtocolRequest {
_id?: string; _id?: string;
} }
export interface ProtocolResponse { export interface ProtocolFromServer {
_id?: string; _id?: string;
Type?: number; SVC_TYPE?: number;
SSVC_TYPE?: number;
SENDER_SEQ?: number;
} }
export interface ProtocolStream { // tslint:disable-next-line: no-empty-interface
_id?: string; export interface ProtocolResponse extends ProtocolFromServer {}
Type?: number;
}
export interface ProtocolNotification { // tslint:disable-next-line: no-empty-interface
Type?: number; export interface ProtocolStream extends ProtocolFromServer {}
}
// tslint:disable-next-line: no-empty-interface
export interface ProtocolNotification extends ProtocolFromServer {}
export interface ProtocolMessage { export interface ProtocolMessage {
serviceType: number; serviceType: number;
@ -27,4 +29,18 @@ export interface ProtocolMessage {
export type ProtocolEncoder<REQ> = (req: REQ) => PacketBody[]; export type ProtocolEncoder<REQ> = (req: REQ) => PacketBody[];
export type ProtocolDecoder<RES> = (message: ProtocolMessage) => RES; export type ProtocolDecoder<RES extends ProtocolFromServer> = (
message: ProtocolMessage
) => RES;
export function decodeProtocolMessage<RES extends ProtocolFromServer>(
message: ProtocolMessage,
res: any
): RES {
return {
SVC_TYPE: message.serviceType,
SSVC_TYPE: message.subServiceType,
SENDER_SEQ: message.senderSeq,
...res
} as RES;
}