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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,7 +4,8 @@ import {
ProtocolEncoder,
ProtocolDecoder,
ProtocolMessage,
PacketBody
PacketBody,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface
@ -25,5 +26,7 @@ export const encodeLogout: ProtocolEncoder<LogoutRequest> = (
export const decodeLogout: ProtocolDecoder<LogoutResponse> = (
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) {
case SSVC_TYPE_LOGOUT_RES:
{
this.logoutNotificationSubject.next({
...decodeLogout(message),
Type: SSVC_TYPE_LOGOUT_RES
});
this.logoutNotificationSubject.next(decodeLogout(message));
}
break;
case SSVC_TYPE_LOGOUT_REMOTE_NOTI:
{
this.logoutNotificationSubject.next({
...decodeLogoutRemoteNotification(message),
Type: SSVC_TYPE_LOGOUT_REMOTE_NOTI
});
this.logoutNotificationSubject.next(
decodeLogoutRemoteNotification(message)
);
}
break;

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage,
PacketBodyValue,
BodyStringDivider,
ProtocolStream
ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
import { DeptType } from '../types/dept.type';
import { DeptInfo } from '../models/dept-info';
@ -58,14 +59,14 @@ export const decodeDeptData: ProtocolDecoder<DeptData> = (
nameCn: info[10]
});
});
return {
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
departmentInfos
} as DeptData;
} as DeptData);
};
export const decodeDept: ProtocolDecoder<DeptResponse> = (
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,
PacketBodyValue,
BodyStringDivider,
ProtocolStream
ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
@ -111,19 +112,19 @@ export const decodeUserDnData: ProtocolDecoder<UserDnData> = (
deptNameCn: info[23]
});
});
return {
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
userDnInfos
} as UserDnData;
} as UserDnData);
};
export const decodeUserDn: ProtocolDecoder<UserDnResponse> = (
message: ProtocolMessage
) => {
return {
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
pageTotalCount: message.bodyList[1],
pageListCount: message.bodyList[2],
pageCurrent: message.bodyList[3]
} as UserDnResponse;
} as UserDnResponse);
};

View File

@ -7,7 +7,8 @@ import {
ProtocolMessage,
PacketBodyValue,
BodyStringDivider,
ProtocolStream
ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { UserSeqInfo } from '../models/user-seq-info';
@ -63,14 +64,14 @@ export const decodeUserIdData: ProtocolDecoder<UserIdData> = (
companyCode: info[3]
});
});
return {
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
userSeqInfos
} as UserIdData;
} as UserIdData);
};
export const decodeUserId: ProtocolDecoder<UserIdResponse> = (
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,
PacketBodyValue,
BodyStringDivider,
ProtocolStream
ProtocolStream,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
import { EmployeeType } from '@ucap-webmessenger/protocol-room';
import { RoleCode } from '@ucap-webmessenger/protocol-authentication';
@ -96,10 +97,10 @@ export const decodeUserSeqData: ProtocolDecoder<UserSeqData> = (
nickName: info[28]
} as UserInfoF);
});
return {
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
userInfos
} as UserSeqData;
} as UserSeqData);
};
export const decodeUserSeqData2: ProtocolDecoder<UserSeqData2> = (
@ -140,19 +141,19 @@ export const decodeUserSeqData2: ProtocolDecoder<UserSeqData2> = (
employeeType: info[28] as EmployeeType
});
});
return {
return decodeProtocolMessage(message, {
divCd: message.bodyList[0],
userInfos
} as UserSeqData2;
} as UserSeqData2);
};
// export const decodeDeptUser: ProtocolDecoder<DeptUserResponse> = (
// message: ProtocolMessage
// ) => {
// return {
// return decodeProtocolMessage(message, {
// divCd: message.bodyList[0],
// pageTotalCount: message.bodyList[1],
// pageListCount: message.bodyList[2],
// 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),
map(res => {
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 => {
if (SSVC_TYPE_QUERY_DEPT_USER_DATA === res.subServiceType) {
return {
...decodeDeptUserData(res),
Type: SSVC_TYPE_QUERY_DEPT_USER_DATA
};
return decodeDeptUserData(res);
}
return {
...decodeDeptUser(res),
Type: SSVC_TYPE_QUERY_DEPT_USER_RES
};
return decodeDeptUser(res);
})
);
}
@ -160,16 +154,10 @@ export class QueryProtocolService {
),
map(res => {
if (SSVC_TYPE_QUERY_DEPT_USER2_DATA === res.subServiceType) {
return {
...decodeDeptUserData(res),
Type: SSVC_TYPE_QUERY_DEPT_USER2_DATA
};
return decodeDeptUserData(res);
}
return {
...decodeDeptUser(res),
Type: SSVC_TYPE_QUERY_DEPT_USER2_RES
};
return decodeDeptUser(res);
})
);
}
@ -188,15 +176,9 @@ export class QueryProtocolService {
),
map(res => {
if (SSVC_TYPE_QUERY_USER_SEQ_DATA === res.subServiceType) {
return {
...decodeUserSeqData(res),
Type: SSVC_TYPE_QUERY_USER_SEQ_DATA
};
return decodeUserSeqData(res);
} else if (SSVC_TYPE_QUERY_USER_SEQ_DATA2 === res.subServiceType) {
return {
...decodeUserSeqData2(res),
Type: SSVC_TYPE_QUERY_USER_SEQ_DATA2
};
return decodeUserSeqData2(res);
}
})
);
@ -215,16 +197,10 @@ export class QueryProtocolService {
),
map(res => {
if (SSVC_TYPE_QUERY_USER_ID_DATA === res.subServiceType) {
return {
...decodeUserIdData(res),
Type: SSVC_TYPE_QUERY_USER_SEQ_DATA
};
return decodeUserIdData(res);
}
return {
...decodeUserId(res),
Type: SSVC_TYPE_QUERY_USER_ID_RES
};
return decodeUserId(res);
})
);
}
@ -242,16 +218,10 @@ export class QueryProtocolService {
),
map(res => {
if (SSVC_TYPE_QUERY_USER_BY_DN_DATA === res.subServiceType) {
return {
...decodeUserDnData(res),
Type: SSVC_TYPE_QUERY_USER_BY_DN_DATA
};
return decodeUserDnData(res);
}
return {
...decodeUserDn(res),
Type: SSVC_TYPE_QUERY_USER_BY_DN_RES
};
return decodeUserDn(res);
})
);
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -129,34 +129,28 @@ export class RoomProtocolService {
switch (message.subServiceType) {
case SSVC_TYPE_ROOM_INVITE_NOTI:
{
this.notificationSubject.next({
...decodeInviteNotification(message),
Type: SSVC_TYPE_ROOM_INVITE_NOTI
});
this.notificationSubject.next(
decodeInviteNotification(message)
);
}
break;
case SSVC_TYPE_ROOM_EXIT_NOTI:
{
this.notificationSubject.next({
...decodeExitNotification(message),
Type: SSVC_TYPE_ROOM_EXIT_NOTI
});
this.notificationSubject.next(decodeExitNotification(message));
}
break;
case SSVC_TYPE_ROOM_EXIT_FORCING_NOTI:
{
this.notificationSubject.next({
...decodeExitForcingNotification(message),
Type: SSVC_TYPE_ROOM_EXIT_FORCING_NOTI
});
this.notificationSubject.next(
decodeExitForcingNotification(message)
);
}
break;
case SSVC_TYPE_ROOM_FONT_UPD_NOTI:
{
this.notificationSubject.next({
...decodeUpdateFontNotification(message),
Type: SSVC_TYPE_ROOM_FONT_UPD_NOTI
});
this.notificationSubject.next(
decodeUpdateFontNotification(message)
);
}
break;
@ -219,17 +213,14 @@ export class RoomProtocolService {
takeWhile(res => SSVC_TYPE_ROOM_INFO_RES !== res.subServiceType, true),
map(res => {
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) {
return {
...decodeUserShortData(res),
Type: SSVC_TYPE_ROOM_INFO_USER
};
return decodeUserShortData(res);
} 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,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
ProtocolMessage,
decodeProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface UserPasswordSetRequest extends ProtocolRequest {
@ -45,10 +46,10 @@ export const encodeUserPasswordSet: ProtocolEncoder<UserPasswordSetRequest> = (
export const decodeUserPasswordSet: ProtocolDecoder<UserPasswordSetResponse> = (
message: ProtocolMessage
) => {
return {
return decodeProtocolMessage(message, {
loginId: message.bodyList[0],
oldLoginPw: message.bodyList[1],
newLoginPw: message.bodyList[2],
companyCode: message.bodyList[3]
} as UserPasswordSetResponse;
} as UserPasswordSetResponse);
};

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,19 +4,21 @@ export interface ProtocolRequest {
_id?: string;
}
export interface ProtocolResponse {
export interface ProtocolFromServer {
_id?: string;
Type?: number;
SVC_TYPE?: number;
SSVC_TYPE?: number;
SENDER_SEQ?: number;
}
export interface ProtocolStream {
_id?: string;
Type?: number;
}
// tslint:disable-next-line: no-empty-interface
export interface ProtocolResponse extends ProtocolFromServer {}
export interface ProtocolNotification {
Type?: number;
}
// tslint:disable-next-line: no-empty-interface
export interface ProtocolStream extends ProtocolFromServer {}
// tslint:disable-next-line: no-empty-interface
export interface ProtocolNotification extends ProtocolFromServer {}
export interface ProtocolMessage {
serviceType: number;
@ -27,4 +29,18 @@ export interface ProtocolMessage {
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;
}