option protocol is implemented

This commit is contained in:
병준 박 2019-09-25 11:47:51 +09:00
parent 6e7b38bbbb
commit 9473730d94
16 changed files with 712 additions and 1 deletions

View File

@ -14,6 +14,7 @@ import { UCapPiModule } from '@ucap-webmessenger/pi';
import { UCapProtocolModule } from '@ucap-webmessenger/protocol';
import { UCapAuthenticationProtocolModule } from '@ucap-webmessenger/protocol-authentication';
import { UCapInnerProtocolModule } from '@ucap-webmessenger/protocol-inner';
import { UCapOptionProtocolModule } from '@ucap-webmessenger/protocol-option';
import { UCapUiModule } from '@ucap-webmessenger/ui';
import { UCapUiAccountModule } from '@ucap-webmessenger/ui-account';
@ -62,6 +63,7 @@ import { GUARDS } from './guards';
}),
UCapAuthenticationProtocolModule.forRoot(),
UCapInnerProtocolModule.forRoot(),
UCapOptionProtocolModule.forRoot(),
UCapUiModule.forRoot(),
UCapUiAccountModule.forRoot(),

View File

@ -0,0 +1,5 @@
export enum CallAlarmType {
Always = 'A',
OnlyOnce = 'B',
None = 'N'
}

View File

@ -0,0 +1,5 @@
export enum CallForwardType {
Always = 'A',
MissedCall = 'B',
None = 'N'
}

View File

@ -0,0 +1,5 @@
export enum CallMode {
C2C = 'C',
FMC = 'F',
NativeCall = 'N'
}

View File

@ -0,0 +1,4 @@
export enum CallerType {
Line = 'L',
Handphone = 'H'
}

View File

@ -0,0 +1,5 @@
export enum NotificationMethod {
Sound = 0,
Alert = 1,
SoundAndAlert = 2
}

View File

@ -3,9 +3,14 @@
*/
export * from './lib/type/app-type.type';
export * from './lib/type/call-alarm.type';
export * from './lib/type/call-forward.type';
export * from './lib/type/call-mode.type';
export * from './lib/type/caller-type.type';
export * from './lib/type/device-devision.type';
export * from './lib/type/device-type.type';
export * from './lib/type/locale-code.type';
export * from './lib/type/notification-method.type';
export * from './lib/type/push-type.type';
export * from './lib/type/status-code.type';
export * from './lib/type/status-type.type';

View File

@ -0,0 +1,137 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage,
PacketBodyValue
} from '@ucap-webmessenger/protocol';
import {
CallerType,
CallMode,
CallAlarmType,
CallForwardType
} from '@ucap-webmessenger/core';
// tslint:disable-next-line: no-empty-interface
export interface CallUpdateRequest extends ProtocolRequest {
// 0 IPPhoneYN(s)
useIpPhone: boolean;
// 1 CallerType(s)
callerType: CallerType;
// 2 CallMode(s)
callMode: CallMode;
// 3 PairingYN(s)
usePairing: boolean;
// 4 CallAlarmYN(s)
useCallAlarm: boolean;
// 5 CallAlarmType(s)
callAlarmType: CallAlarmType;
// 6 CallForwardType(s)
callForwardType: CallForwardType;
// 7 대표착신번호(s)
representativeCalledNumber: string;
// 8 착신번호(s)1
calledNumber1: string;
// 9 착신번호(s)2
calledNumber2: string;
// 10 착신번호(s)3
calledNumber3: string;
}
export interface CallUpdateResponse extends ProtocolResponse {
// 0 IPPhoneYN(s)
useIpPhone?: boolean;
// 1 CallerType(s)
callerType?: CallerType;
// 2 CallMode(s)
callMode?: CallMode;
// 3 PairingYN(s)
usePairing?: boolean;
// 4 CallAlarmYN(s)
useCallAlarm?: boolean;
// 5 CallAlarmType(s)
callAlarmType?: CallAlarmType;
// 6 CallForwardType(s)
callForwardType?: CallForwardType;
// 7 대표착신번호(s)
representativeCalledNumber?: string;
// 8 착신번호(s)1
calledNumber1?: string;
// 9 착신번호(s)2
calledNumber2?: string;
// 10 착신번호(s)3
calledNumber3?: string;
}
export const encodeCallUpdate: ProtocolEncoder<CallUpdateRequest> = (
req: CallUpdateRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({
type: PacketBodyValue.String,
value: req.useIpPhone ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.callerType
});
bodyList.push({
type: PacketBodyValue.String,
value: req.callMode
});
bodyList.push({
type: PacketBodyValue.String,
value: req.usePairing ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.useCallAlarm ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.callAlarmType
});
bodyList.push({
type: PacketBodyValue.String,
value: req.callForwardType
});
bodyList.push({
type: PacketBodyValue.String,
value: req.representativeCalledNumber
});
bodyList.push({
type: PacketBodyValue.String,
value: req.calledNumber1
});
bodyList.push({
type: PacketBodyValue.String,
value: req.calledNumber2
});
bodyList.push({
type: PacketBodyValue.String,
value: req.calledNumber3
});
return bodyList;
};
export const decodeCallUpdate: ProtocolDecoder<CallUpdateResponse> = (
message: ProtocolMessage
) => {
return {
useIpPhone: message.bodyList[0] === 'Y' ? true : false,
callerType: message.bodyList[1] as CallerType,
callMode: message.bodyList[2] as CallMode,
usePairing: message.bodyList[3] === 'Y' ? true : false,
useCallAlarm: message.bodyList[4] === 'Y' ? true : false,
callAlarmType: message.bodyList[5] as CallAlarmType,
callForwardType: message.bodyList[6] as CallForwardType,
representativeCalledNumber: message.bodyList[7],
calledNumber1: message.bodyList[8],
calledNumber2: message.bodyList[9],
calledNumber3: message.bodyList[10]
} as CallUpdateResponse;
};

View File

@ -0,0 +1,68 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
import {
CallerType,
CallMode,
CallAlarmType,
CallForwardType
} from '@ucap-webmessenger/core';
// tslint:disable-next-line: no-empty-interface
export interface CallViewRequest extends ProtocolRequest {}
export interface CallViewResponse extends ProtocolResponse {
// 0 IPPhoneYN(s)
useIpPhone?: boolean;
// 1 CallerType(s)
callerType?: CallerType;
// 2 CallMode(s)
callMode?: CallMode;
// 3 PairingYN(s)
usePairing?: boolean;
// 4 CallAlarmYN(s)
useCallAlarm?: boolean;
// 5 CallAlarmType(s)
callAlarmType?: CallAlarmType;
// 6 CallForwardType(s)
callForwardType?: CallForwardType;
// 7 대표착신번호(s)
representativeCalledNumber?: string;
// 8 착신번호(s)1
calledNumber1?: string;
// 9 착신번호(s)2
calledNumber2?: string;
// 10 착신번호(s)3
calledNumber3?: string;
}
export const encodeCallView: ProtocolEncoder<CallViewRequest> = (
req: CallViewRequest
) => {
const bodyList: PacketBody[] = [];
return bodyList;
};
export const decodeCallView: ProtocolDecoder<CallViewResponse> = (
message: ProtocolMessage
) => {
return {
useIpPhone: message.bodyList[0] === 'Y' ? true : false,
callerType: message.bodyList[1] as CallerType,
callMode: message.bodyList[2] as CallMode,
usePairing: message.bodyList[3] === 'Y' ? true : false,
useCallAlarm: message.bodyList[4] === 'Y' ? true : false,
callAlarmType: message.bodyList[5] as CallAlarmType,
callForwardType: message.bodyList[6] as CallForwardType,
representativeCalledNumber: message.bodyList[7],
calledNumber1: message.bodyList[8],
calledNumber2: message.bodyList[9],
calledNumber3: message.bodyList[10]
} as CallViewResponse;
};

View File

@ -0,0 +1,153 @@
import { NotificationMethod, DeviceType } from '@ucap-webmessenger/core';
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage,
PacketBodyValue
} from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface
export interface RegUpdateRequest extends ProtocolRequest {
// 0 알림방법(n)
notificationMethod: NotificationMethod;
// 1 모바일알림(n)
mobileNotification: number;
// 2 폰트종류(s)
fontFamily: string;
// 3 폰트크기(n)
fontSize: number;
// 4 알림받음/받지않음(n)
receiveNotification: number;
// 5 알림방법(n)
notificationMethod0: number;
// 6 알림창 설정(n)
notificationExposureTime: number;
// 7 타임존(s)
timeZone: string;
// 8 타임존값(s)
timeZoneValue: string;
// 9 부재중시간설정(n)
absenceTime: number;
// 10 메뉴 언어(n)
menuLanguage: number;
// 11 인사정보 언어(n)
hrInformationLanguage: number;
deviceType: DeviceType;
}
export interface RegUpdateResponse extends ProtocolResponse {
// 0 알림방법(n)
notificationMethod?: NotificationMethod;
// 1 모바일알림(n)
mobileNotification?: number;
// 2 폰트종류(s)
fontFamily?: string;
// 3 폰트크기(n)
fontSize?: number;
// 4 알림받음/받지않음(n)
receiveNotification?: number;
// 5 알림방법(n)
notificationMethod0?: number;
// 6 알림창 설정(n)
notificationExposureTime?: number;
// 7 타임존(s)
timeZone?: string;
// 8 타임존값(s)
timeZoneValue?: string;
// 9 부재중시간설정(n)
absenceTime?: number;
// 10 메뉴 언어(n)
menuLanguage?: number;
// 11 인사정보 언어(n)
hrInformationLanguage?: number;
// 12 단말타입(s)
deviceType?: DeviceType;
// 13 번역키
translationKey?: string;
}
export const encodeRegUpdate: ProtocolEncoder<RegUpdateRequest> = (
req: RegUpdateRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({
type: PacketBodyValue.Integer,
value: req.notificationMethod
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.mobileNotification
});
bodyList.push({
type: PacketBodyValue.String,
value: req.fontFamily
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.fontSize
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.receiveNotification
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.notificationMethod0
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.notificationExposureTime
});
bodyList.push({
type: PacketBodyValue.String,
value: req.timeZone
});
bodyList.push({
type: PacketBodyValue.String,
value: req.timeZoneValue
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.absenceTime
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.menuLanguage
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.hrInformationLanguage
});
bodyList.push({
type: PacketBodyValue.String,
value: req.deviceType
});
return bodyList;
};
export const decodeRegUpdate: ProtocolDecoder<RegUpdateResponse> = (
message: ProtocolMessage
) => {
return {
notificationMethod: message.bodyList[0] as NotificationMethod,
mobileNotification: message.bodyList[1],
fontFamily: message.bodyList[2],
fontSize: message.bodyList[3],
receiveNotification: message.bodyList[4],
notificationMethod0: message.bodyList[5],
notificationExposureTime: message.bodyList[6],
timeZone: message.bodyList[7],
timeZoneValue: message.bodyList[8],
absenceTime: message.bodyList[9],
menuLanguage: message.bodyList[10],
hrInformationLanguage: message.bodyList[11],
deviceType: message.bodyList[12],
translationKey: message.bodyList[13]
} as RegUpdateResponse;
};

View File

@ -0,0 +1,70 @@
import { NotificationMethod } from '@ucap-webmessenger/core';
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface
export interface RegViewRequest extends ProtocolRequest {}
export interface RegViewResponse extends ProtocolResponse {
// 0 알림방법(n)
notificationMethod?: NotificationMethod;
// 1 모바일알림(n)
mobileNotification?: number;
// 2 폰트종류(s)
fontFamily?: string;
// 3 폰트크기(n)
fontSize?: number;
// 4 알림받음/받지않음(n)
receiveNotification?: number;
// 5 알림방법(n)
notificationMethod0?: number;
// 6 알림창 설정(n)
notificationExposureTime?: number;
// 7 타임존(s)
timeZone?: string;
// 8 타임존값(s)
timeZoneValue?: string;
// 9 부재중시간설정(n)
absenceTime?: number;
// 10 메뉴 언어(n)
menuLanguage?: number;
// 11 인사정보 언어(n)
hrInformationLanguage?: number;
// 12 번역키
translationKey?: string;
}
export const encodeRegView: ProtocolEncoder<RegViewRequest> = (
req: RegViewRequest
) => {
const bodyList: PacketBody[] = [];
return bodyList;
};
export const decodeRegView: ProtocolDecoder<RegViewResponse> = (
message: ProtocolMessage
) => {
return {
notificationMethod: message.bodyList[0] as NotificationMethod,
mobileNotification: message.bodyList[1],
fontFamily: message.bodyList[2],
fontSize: message.bodyList[3],
receiveNotification: message.bodyList[4],
notificationMethod0: message.bodyList[5],
notificationExposureTime: message.bodyList[6],
timeZone: message.bodyList[7],
timeZoneValue: message.bodyList[8],
absenceTime: message.bodyList[9],
menuLanguage: message.bodyList[10],
hrInformationLanguage: message.bodyList[11],
translationKey: message.bodyList[12]
} as RegViewResponse;
};

View File

@ -0,0 +1,68 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage,
PacketBodyValue
} from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface
export interface UpdateRequest extends ProtocolRequest {
// 알람여부(y)
receiveAlarm: boolean;
// 알람VIEW여부(y)
displayAlarm: boolean;
// 그룹알람여부(y)
receiveGroupAlarm: boolean;
// PC알람여부(y)
receivePcAlarm: boolean;
}
export interface UpdateResponse extends ProtocolResponse {
// 알람여부(y)
receiveAlarm?: boolean;
// 알람VIEW여부(y)
displayAlarm?: boolean;
// 그룹알람여부(y)
receiveGroupAlarm?: boolean;
// PC알람여부(y)
receivePcAlarm?: boolean;
}
export const encodeUpdate: ProtocolEncoder<UpdateRequest> = (
req: UpdateRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({
type: PacketBodyValue.String,
value: req.receiveAlarm ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.displayAlarm ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.receiveGroupAlarm ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.receivePcAlarm ? 'Y' : 'N'
});
return bodyList;
};
export const decodeUpdate: ProtocolDecoder<UpdateResponse> = (
message: ProtocolMessage
) => {
return {
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;
};

View File

@ -0,0 +1,39 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
// tslint:disable-next-line: no-empty-interface
export interface ViewRequest extends ProtocolRequest {}
export interface ViewResponse extends ProtocolResponse {
// 알람여부(y)
receiveAlarm?: boolean;
// 알람VIEW여부(y)
displayAlarm?: boolean;
// 그룹알람여부(y)
receiveGroupAlarm?: boolean;
// PC알람여부(y)
receivePcAlarm?: boolean;
}
export const encodeView: ProtocolEncoder<ViewRequest> = (req: ViewRequest) => {
const bodyList: PacketBody[] = [];
return bodyList;
};
export const decodeView: ProtocolDecoder<ViewResponse> = (
message: ProtocolMessage
) => {
return {
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;
};

View File

@ -1,8 +1,128 @@
import { Injectable } from '@angular/core';
import { Observable } from 'rxjs';
import { take, map } from 'rxjs/operators';
import { ProtocolService } from '@ucap-webmessenger/protocol';
import {
SVC_TYPE_OPTION,
SSVC_TYPE_OPTION_VIEW_REQ,
SSVC_TYPE_OPTION_UPD_REQ,
SSVC_TYPE_OPTION_REG_VIEW_REQ,
SSVC_TYPE_OPTION_REG_UPD_REQ,
SSVC_TYPE_OPTION_CALL_VIEW_REQ,
SSVC_TYPE_OPTION_CALL_UPD_REQ
} from '../types/service';
import {
encodeView,
decodeView,
ViewRequest,
ViewResponse
} from '../models/view';
import {
UpdateRequest,
UpdateResponse,
encodeUpdate,
decodeUpdate
} from '../models/update';
import {
RegViewRequest,
RegViewResponse,
encodeRegView,
decodeRegView
} from '../models/reg-view';
import {
RegUpdateRequest,
RegUpdateResponse,
encodeRegUpdate,
decodeRegUpdate
} from '../models/reg-update';
import {
CallViewRequest,
CallViewResponse,
encodeCallView,
decodeCallView
} from '../models/call-view';
import {
CallUpdateRequest,
CallUpdateResponse,
encodeCallUpdate,
decodeCallUpdate
} from '../models/call-update';
@Injectable({
providedIn: 'root'
})
export class OptionProtocolService {
constructor() {}
constructor(private protocolService: ProtocolService) {}
public view(req: ViewRequest): Observable<ViewResponse> {
return this.protocolService
.call(SVC_TYPE_OPTION, SSVC_TYPE_OPTION_VIEW_REQ, ...encodeView(req))
.pipe(
take(1),
map(res => decodeView(res))
);
}
public update(req: UpdateRequest): Observable<UpdateResponse> {
return this.protocolService
.call(SVC_TYPE_OPTION, SSVC_TYPE_OPTION_UPD_REQ, ...encodeUpdate(req))
.pipe(
take(1),
map(res => decodeUpdate(res))
);
}
public regView(req: RegViewRequest): Observable<RegViewResponse> {
return this.protocolService
.call(
SVC_TYPE_OPTION,
SSVC_TYPE_OPTION_REG_VIEW_REQ,
...encodeRegView(req)
)
.pipe(
take(1),
map(res => decodeRegView(res))
);
}
public regUpdate(req: RegUpdateRequest): Observable<RegUpdateResponse> {
return this.protocolService
.call(
SVC_TYPE_OPTION,
SSVC_TYPE_OPTION_REG_UPD_REQ,
...encodeRegUpdate(req)
)
.pipe(
take(1),
map(res => decodeRegUpdate(res))
);
}
public callView(req: CallViewRequest): Observable<CallViewResponse> {
return this.protocolService
.call(
SVC_TYPE_OPTION,
SSVC_TYPE_OPTION_CALL_VIEW_REQ,
...encodeCallView(req)
)
.pipe(
take(1),
map(res => decodeCallView(res))
);
}
public callUpdate(req: CallUpdateRequest): Observable<CallUpdateResponse> {
return this.protocolService
.call(
SVC_TYPE_OPTION,
SSVC_TYPE_OPTION_CALL_UPD_REQ,
...encodeCallUpdate(req)
)
.pipe(
take(1),
map(res => decodeCallUpdate(res))
);
}
}

View File

@ -0,0 +1,18 @@
export const SVC_TYPE_OPTION = 90; // 옵션 정보 요청
export const SSVC_TYPE_OPTION_VIEW_REQ = 1; // 옵션 정보 요청
export const SSVC_TYPE_OPTION_VIEW_RES = 2; //
export const SSVC_TYPE_OPTION_UPD_REQ = 11; // 옵션 변경 요청
export const SSVC_TYPE_OPTION_UPD_RES = 12; // 옵션 정보 수신
export const SSVC_TYPE_OPTION_REG_VIEW_REQ = 13;
export const SSVC_TYPE_OPTION_REG_VIEW_RES = 14;
export const SSVC_TYPE_OPTION_REG_UPD_REQ = 15;
export const SSVC_TYPE_OPTION_REG_UPD_RES = 16;
export const SSVC_TYPE_OPTION_CALL_VIEW_REQ = 31; // 통화 옵션 정보 요청
export const SSVC_TYPE_OPTION_CALL_VIEW_RES = 32; // 통화 옵션 정보 응답
export const SSVC_TYPE_OPTION_CALL_UPD_REQ = 33; // 통화 옵션 변경 요청 [noused]
export const SSVC_TYPE_OPTION_CALL_UPD_RES = 34; // 통화 옵션 변경 응답 [noused]
export const SSVC_TYPE_OPTION_PUSH_PC_ONLINE_VIEW_REQ = 41; // PC 온라인시 모바일 푸시 옵션 정보 요청 [deprecated]
export const SSVC_TYPE_OPTION_PUSH_PC_ONLINE_VIEW_RES = 42; // PC 온라인시 모바일 푸시 옵션 정보 응답 [deprecated]
export const SSVC_TYPE_OPTION_PUSH_PC_ONLINE_VIEW_UPD_REQ = 51; // PC 온라인시 모바일 푸시 옵션 정보 변경 [deprecated]
export const SSVC_TYPE_OPTION_PUSH_PC_ONLINE_VIEW_UPD_NOTI = 52; // PC 온라인시 모바일 푸시 옵션 정보 변경Noti [deprecated]
export const SSVC_TYPE_OPTION_PUSH_PC_ONLINE_VIEW_UPD_RES = 53; // PC 온라인시 모바일 푸시 옵션 정보 변경응답 [deprecated]

View File

@ -2,6 +2,13 @@
* Public API Surface of ucap-webmessenger-protocol-option
*/
export * from './lib/models/call-update';
export * from './lib/models/call-view';
export * from './lib/models/reg-update';
export * from './lib/models/reg-view';
export * from './lib/models/update';
export * from './lib/models/view';
export * from './lib/services/option-protocol.service';
export * from './lib/ucap-option-protocol.module';