This commit is contained in:
병준 박 2019-09-25 13:26:50 +09:00
commit 449240460b
22 changed files with 682 additions and 283 deletions

View File

@ -17,19 +17,19 @@ import {
encodeBuddyAdd, encodeBuddyAdd,
decodeBuddyAdd, decodeBuddyAdd,
BuddyAddResponse BuddyAddResponse
} from '../models/buddy-add'; } from '../models/add';
import { import {
BuddyDelRequest, BuddyDelRequest,
encodeBuddyDel, encodeBuddyDel,
decodeBuddyDel, decodeBuddyDel,
BuddyDelResponse BuddyDelResponse
} from '../models/buddy-del'; } from '../models/del';
import { import {
BuddyUpdateRequest, BuddyUpdateRequest,
decodeBuddyUpdate, decodeBuddyUpdate,
encodeBuddyUpdate, encodeBuddyUpdate,
BuddyUpdateResponse BuddyUpdateResponse
} from '../models/buddy-update'; } from '../models/update';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'

View File

@ -1,9 +1,9 @@
/* /*
* Public API Surface of ucap-webmessenger-protocol-buddy * Public API Surface of ucap-webmessenger-protocol-buddy
*/ */
export * from './lib/models/buddy-add'; export * from './lib/models/add';
export * from './lib/models/buddy-del'; export * from './lib/models/del';
export * from './lib/models/buddy-update'; export * from './lib/models/update';
export * from './lib/services/buddy-protocol.service'; export * from './lib/services/buddy-protocol.service';

View File

@ -9,7 +9,7 @@ import {
encodeGroupAdd, encodeGroupAdd,
decodeGroupAdd, decodeGroupAdd,
GroupAddResponse GroupAddResponse
} from '../models/group-add'; } from '../models/add';
import { import {
SVC_TYPE_GROUP, SVC_TYPE_GROUP,
SSVC_TYPE_GROUP_ADD_REQ, SSVC_TYPE_GROUP_ADD_REQ,
@ -22,7 +22,7 @@ import {
encodeGroupDel, encodeGroupDel,
decodeGroupDel, decodeGroupDel,
GroupDelResponse GroupDelResponse
} from '../models/group-del'; } from '../models/del';
import { import {
GroupUpdateRequest, GroupUpdateRequest,
encodeGroupUpdate, encodeGroupUpdate,
@ -30,7 +30,7 @@ import {
encodeGroupUpdate2, encodeGroupUpdate2,
decodeGroupUpdate2, decodeGroupUpdate2,
GroupUpdateResponse GroupUpdateResponse
} from '../models/group-update'; } from '../models/update';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
}) })

View File

@ -1,9 +1,9 @@
/* /*
* Public API Surface of ucap-webmessenger-protocol-group * Public API Surface of ucap-webmessenger-protocol-group
*/ */
export * from './lib/models/group-add'; export * from './lib/models/add';
export * from './lib/models/group-del'; export * from './lib/models/del';
export * from './lib/models/group-update'; export * from './lib/models/update';
export * from './lib/services/group-protocol.service'; export * from './lib/services/group-protocol.service';

View File

@ -0,0 +1,123 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
import { RoomExitType } from '../types/room.type';
export interface RoomExitRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
}
export interface RoomExitResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
}
export const encodeRoomExit: ProtocolEncoder<RoomExitRequest> = (
req: RoomExitRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
return bodyList;
};
export const decodeRoomExit: ProtocolDecoder<RoomExitResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomExitResponse;
};
export const decodeRoomExitNotification: ProtocolDecoder<RoomExitResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0]
} as RoomExitResponse;
};
export interface RoomExitAllRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string[];
}
export const encodeRoomAllExit: ProtocolEncoder<RoomExitAllRequest> = (
req: RoomExitAllRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq.join(',') });
return bodyList;
};
export interface RoomExitForcingRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 강퇴요청타입(s)
type: string;
// sender사용자SEQ(n)
senderSeq: number;
// 사용자SEQ(n)...
userSeqs: number[];
}
export interface RoomExitForcingResponse extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 강퇴요청타입(s)
type: RoomExitType;
// sender사용자SEQ(n)
senderSeq: number;
// 사용자SEQ(n)...
userSeqs: number[];
}
export const encodeRoomExitForcing: ProtocolEncoder<RoomExitForcingRequest> = (
req: RoomExitForcingRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
bodyList.push({ type: PacketBodyValue.String, value: req.type });
bodyList.push({ type: PacketBodyValue.Integer, value: req.senderSeq });
req.userSeqs.forEach(userSeq => {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
});
return bodyList;
};
export const decodeRoomExitForcing: ProtocolDecoder<RoomExitForcingResponse> = (
message: ProtocolMessage
) => {
let userSeqs: number[] = [];
if (message.bodyList.length > 3) {
userSeqs = message.bodyList.slice(3);
}
return {
roomSeq: message.bodyList[0],
type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2],
userSeqs
} as RoomExitForcingResponse;
};
export const decodeRoomExitForcingNotification: ProtocolDecoder<
RoomExitForcingResponse
> = (message: ProtocolMessage) => {
let userSeqs: number[] = [];
if (message.bodyList.length > 3) {
userSeqs = message.bodyList.slice(3);
}
return {
roomSeq: message.bodyList[0],
type: message.bodyList[1] as RoomExitType,
senderSeq: message.bodyList[2],
userSeqs
} as RoomExitForcingResponse;
};

View File

@ -203,7 +203,7 @@ export const decodeRoomInfoData: ProtocolDecoder<RoomInfoDataResponse> = (
if (info.length > 11) { if (info.length > 11) {
roomInfo = { roomInfo = {
roomSeq: info[0], roomSeq: info[0],
roomType: info[1], roomType: info[1] as RoomType,
roomName: info[2], roomName: info[2],
finalEventType: info[3] as EventType, finalEventType: info[3] as EventType,
finalEventMessage: info[4], finalEventMessage: info[4],
@ -300,3 +300,35 @@ export const decodeRoomUserData: ProtocolDecoder<RoomUserDataResponse> = (
userInfos userInfos
} as RoomUserDataResponse; } as RoomUserDataResponse;
}; };
export interface RoomUserStatusOfflineRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
}
export interface RoomUserStatusOfflineResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 사용자SEQ(n)...
userSeqs: number[];
}
export const encodeRoomUserStatusOffline: ProtocolEncoder<
RoomUserStatusOfflineRequest
> = (req: RoomUserStatusOfflineRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
return bodyList;
};
export const decodeRoomUserStatusOffline: ProtocolDecoder<
RoomUserStatusOfflineResponse
> = (message: ProtocolMessage) => {
let userSeqs: number[] = [];
if (message.bodyList.length > 1) {
userSeqs = message.bodyList.slice(1);
}
return {
roomSeq: message.bodyList[0],
userSeqs
} as RoomUserStatusOfflineResponse;
};

View File

@ -0,0 +1,220 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomOpenRequest extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpenResponse extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방SEQ(s)
roomSeq: string;
// 2. 신규여부(y)
newRoom: boolean;
}
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
req: RoomOpenRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
message: ProtocolMessage
) => {
return {
divCd: message.bodyList[0],
roomSeq: message.bodyList[1],
newRoom: message.bodyList[2] === 'Y' ? true : false
} as RoomOpenResponse;
};
export interface RoomOpen2Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpen2Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 대화방SEQ(s)
roomSeq: string;
// 3. 신규여부(y)
newRoom: boolean;
}
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
req: RoomOpen2Request
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
message: ProtocolMessage
) => {
return {
divCd: message.bodyList[0],
roomName: message.bodyList[1],
roomSeq: message.bodyList[2],
newRoom: message.bodyList[3] === 'Y' ? true : false
} as RoomOpen2Response;
};
export interface RoomOpen3Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 3. 타이머시간(n)
timerRoomInterval: number;
// 4n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpen3Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 대화방SEQ(s)
roomSeq: string;
// 3. 신규여부(y)
newRoom: boolean;
// 4. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 5. 타이머시간(n)
timerRoomInterval: number;
}
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
req: RoomOpen3Request
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
bodyList.push({
type: PacketBodyValue.String,
value: req.isTimerRoom === true ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
});
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
message: ProtocolMessage
) => {
return {
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 RoomOpen3Response;
};
export interface RoomOpen4Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 3. 타이머시간(n)
timerRoomInterval: number;
// 4n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpen4Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 대화방SEQ(s)
roomSeq: string;
// 3. 신규여부(y)
newRoom: boolean;
// 4. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 5. 타이머시간(n)
timerRoomInterval: number;
}
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
req: RoomOpen4Request
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
bodyList.push({
type: PacketBodyValue.String,
value: req.isTimerRoom === true ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
});
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
message: ProtocolMessage
) => {
return {
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[4] !== 'Y' ? 0 : message.bodyList[5] || 0
} as RoomOpen4Response;
};

View File

@ -1,48 +0,0 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomOpenRequest extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpenResponse extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방SEQ(s)
roomSeq: string;
// 2. 신규여부(y)
newRoom: boolean;
}
export const encodeRoomOpen: ProtocolEncoder<RoomOpenRequest> = (
req: RoomOpenRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen: ProtocolDecoder<RoomOpenResponse> = (
message: ProtocolMessage
) => {
return {
divCd: message.bodyList[0],
roomSeq: message.bodyList[1],
newRoom: message.bodyList[2] === 'Y' ? true : false
} as RoomOpenResponse;
};

View File

@ -1,54 +0,0 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomOpen2Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpen2Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 대화방SEQ(s)
roomSeq: string;
// 3. 신규여부(y)
newRoom: boolean;
}
export const encodeRoomOpen2: ProtocolEncoder<RoomOpen2Request> = (
req: RoomOpen2Request
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen2: ProtocolDecoder<RoomOpen2Response> = (
message: ProtocolMessage
) => {
return {
divCd: message.bodyList[0],
roomName: message.bodyList[1],
roomSeq: message.bodyList[2],
newRoom: message.bodyList[3] === 'Y' ? true : false
} as RoomOpen2Response;
};

View File

@ -1,72 +0,0 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomOpen3Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 3. 타이머시간(n)
timerRoomInterval: number;
// 4n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpen3Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 대화방SEQ(s)
roomSeq: string;
// 3. 신규여부(y)
newRoom: boolean;
// 4. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 5. 타이머시간(n)
timerRoomInterval: number;
}
export const encodeRoomOpen3: ProtocolEncoder<RoomOpen3Request> = (
req: RoomOpen3Request
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
bodyList.push({
type: PacketBodyValue.String,
value: req.isTimerRoom === true ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
});
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen3: ProtocolDecoder<RoomOpen3Response> = (
message: ProtocolMessage
) => {
return {
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 RoomOpen3Response;
};

View File

@ -1,73 +0,0 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomOpen4Request extends ProtocolRequest {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 3. 타이머시간(n)
timerRoomInterval: number;
// 4n. 초대자 userSeq(n)...
userSeqs: number[];
}
export interface RoomOpen4Response extends ProtocolResponse {
// 0. 구분자
divCd: string;
// 1. 대화방제목(s)
roomName: string;
// 2. 대화방SEQ(s)
roomSeq: string;
// 3. 신규여부(y)
newRoom: boolean;
// 4. 타이머대화방여부YN(s)
isTimerRoom: boolean;
// 5. 타이머시간(n)
timerRoomInterval: number;
}
export const encodeRoomOpen4: ProtocolEncoder<RoomOpen4Request> = (
req: RoomOpen4Request
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.divCd });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName.trim() });
bodyList.push({
type: PacketBodyValue.String,
value: req.isTimerRoom === true ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.Integer,
value: req.isTimerRoom !== true ? 0 : req.timerRoomInterval
});
for (const userSeq of req.userSeqs) {
bodyList.push({ type: PacketBodyValue.Integer, value: userSeq });
}
return bodyList;
};
export const decodeRoomOpen4: ProtocolDecoder<RoomOpen4Response> = (
message: ProtocolMessage
) => {
return {
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[4] !== 'Y' ? 0 : message.bodyList[5] || 0
} as RoomOpen4Response;
};

View File

@ -0,0 +1,142 @@
import {
ProtocolRequest,
ProtocolResponse,
ProtocolEncoder,
PacketBody,
PacketBodyValue,
ProtocolDecoder,
ProtocolMessage
} from '@ucap-webmessenger/protocol';
export interface RoomUpdateRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 대화방제목(s)
roomName: string;
// 알람여부(y)
isAlarm: boolean;
// 동기화여부(s)
isSyncAll: boolean;
}
export interface RoomUpdateResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 대화방제목(s)
roomName: string;
// 알람여부(y)
isAlarm: boolean;
// 동기화여부(s)
isSyncAll: boolean;
}
export const encodeRoomUpdate: ProtocolEncoder<RoomUpdateRequest> = (
req: RoomUpdateRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
bodyList.push({ type: PacketBodyValue.String, value: req.roomName });
bodyList.push({
type: PacketBodyValue.String,
value: req.isAlarm ? 'Y' : 'N'
});
bodyList.push({
type: PacketBodyValue.String,
value: req.isSyncAll ? 'Y' : 'N'
});
return bodyList;
};
export const decodeRoomUpdate: ProtocolDecoder<RoomUpdateResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0],
roomName: message.bodyList[1],
isAlarm: message.bodyList[2] === 'Y' ? true : false,
isSyncAll: message.bodyList[3] === 'Y' ? true : false
} as RoomUpdateResponse;
};
export interface RoomUpdateTimerSetRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 타이머시간(n)
timerInterval: number;
}
export interface RoomUpdateTimerSetResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 타이머시간(n)
timerInterval: number;
}
export const encodeRoomUpdateTimerSet: ProtocolEncoder<
RoomUpdateTimerSetRequest
> = (req: RoomUpdateTimerSetRequest) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
bodyList.push({ type: PacketBodyValue.Integer, value: req.timerInterval });
return bodyList;
};
export const decodeRoomUpdateTimerSet: ProtocolDecoder<
RoomUpdateTimerSetResponse
> = (message: ProtocolMessage) => {
return {
roomSeq: message.bodyList[0],
timerInterval: message.bodyList[1] || 0
} as RoomUpdateTimerSetResponse;
};
export interface RoomUpdateFontRequest extends ProtocolRequest {
// 대화방SEQ(s)
roomSeq: string;
// 폰트색(s) cf)0x000000 형태의 스트링
fontColor: string;
// sender사용자SEQ(n)
senderSeq: number;
}
export interface RoomUpdateFontResponse extends ProtocolResponse {
// 대화방SEQ(s)
roomSeq: string;
// 폰트색(s) cf)0x000000 형태의 스트링
fontColor: string;
// sender사용자SEQ(n)
senderSeq: number;
}
export const encodeRoomUpdateFont: ProtocolEncoder<RoomUpdateFontRequest> = (
req: RoomUpdateFontRequest
) => {
const bodyList: PacketBody[] = [];
bodyList.push({ type: PacketBodyValue.String, value: req.roomSeq });
bodyList.push({ type: PacketBodyValue.String, value: req.fontColor });
bodyList.push({ type: PacketBodyValue.Integer, value: req.senderSeq });
return bodyList;
};
export const decodeRoomUpdateFont: ProtocolDecoder<RoomUpdateFontResponse> = (
message: ProtocolMessage
) => {
return {
roomSeq: message.bodyList[0],
fontColor: message.bodyList[1],
senderSeq: message.bodyList[2]
} as RoomUpdateFontResponse;
};
export const decodeRoomUpdateFontNotification: ProtocolDecoder<
RoomUpdateFontResponse
> = (message: ProtocolMessage) => {
return {
roomSeq: message.bodyList[0],
fontColor: message.bodyList[1],
senderSeq: message.bodyList[2]
} as RoomUpdateFontResponse;
};

View File

@ -15,38 +15,39 @@ import {
SSVC_TYPE_ROOM_INFO_RES, SSVC_TYPE_ROOM_INFO_RES,
SSVC_TYPE_ROOM_INFO_REQ, SSVC_TYPE_ROOM_INFO_REQ,
SSVC_TYPE_ROOM_INFO_USER, SSVC_TYPE_ROOM_INFO_USER,
SSVC_TYPE_ROOM_INFO_USER2 SSVC_TYPE_ROOM_INFO_USER2,
SSVC_TYPE_ROOM_EXIT_REQ,
SSVC_TYPE_ROOM_EXIT_ALL_REQ,
SSVC_TYPE_ROOM_EXIT_FORCING_REQ,
SSVC_TYPE_ROOM_USER_STATUS_REQ,
SSVC_TYPE_ROOM_UPD_REQ,
SSVC_TYPE_ROOM_INFO_UPD_REQ,
SSVC_TYPE_ROOM_FONT_UPD_REQ
} from '../types/service'; } from '../types/service';
import { import {
RoomOpenRequest, RoomOpenRequest,
encodeRoomOpen, encodeRoomOpen,
decodeRoomOpen, decodeRoomOpen,
RoomOpenResponse RoomOpenResponse,
} from '../models/room-open';
import {
RoomOpen2Request, RoomOpen2Request,
RoomOpen2Response, RoomOpen2Response,
decodeRoomOpen2, decodeRoomOpen2,
encodeRoomOpen2 encodeRoomOpen2,
} from '../models/room-open2';
import {
RoomOpen3Request, RoomOpen3Request,
RoomOpen3Response, RoomOpen3Response,
encodeRoomOpen3, encodeRoomOpen3,
decodeRoomOpen3 decodeRoomOpen3,
} from '../models/room-open3';
import {
RoomOpen4Request, RoomOpen4Request,
RoomOpen4Response, RoomOpen4Response,
encodeRoomOpen4, encodeRoomOpen4,
decodeRoomOpen4 decodeRoomOpen4
} from '../models/room-open4'; } from '../models/open';
import { import {
RoomInviteRequest, RoomInviteRequest,
RoomInviteResponse, RoomInviteResponse,
encodeRoomInvite, encodeRoomInvite,
decodeRoomInvite decodeRoomInvite
} from '../models/room-invite'; } from '../models/invite';
import { import {
RoomInfoRequest, RoomInfoRequest,
RoomInfoResponse, RoomInfoResponse,
@ -57,8 +58,38 @@ import {
decodeRoomInfoData, decodeRoomInfoData,
decodeRoomInfo, decodeRoomInfo,
decodeRoomUserShortData, decodeRoomUserShortData,
decodeRoomUserData decodeRoomUserData,
} from '../models/room-info'; RoomUserStatusOfflineRequest,
RoomUserStatusOfflineResponse,
encodeRoomUserStatusOffline,
decodeRoomUserStatusOffline
} from '../models/info';
import {
RoomExitRequest,
RoomExitResponse,
encodeRoomExit,
decodeRoomExit,
RoomExitAllRequest,
encodeRoomAllExit,
RoomExitForcingRequest,
RoomExitForcingResponse,
encodeRoomExitForcing,
decodeRoomExitForcing
} from '../models/exit';
import {
RoomUpdateRequest,
RoomUpdateResponse,
encodeRoomUpdate,
decodeRoomUpdate,
RoomUpdateTimerSetRequest,
RoomUpdateTimerSetResponse,
encodeRoomUpdateTimerSet,
decodeRoomUpdateTimerSet,
RoomUpdateFontRequest,
RoomUpdateFontResponse,
encodeRoomUpdateFont,
decodeRoomUpdateFont
} from '../models/update';
@Injectable({ @Injectable({
providedIn: 'root' providedIn: 'root'
@ -74,7 +105,6 @@ export class RoomProtocolService {
map(res => decodeRoomOpen(res)) map(res => decodeRoomOpen(res))
); );
} }
public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> { public roomOpen2(req: RoomOpen2Request): Observable<RoomOpen2Response> {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN2_REQ, ...encodeRoomOpen2(req))
@ -83,7 +113,6 @@ export class RoomProtocolService {
map(res => decodeRoomOpen2(res)) map(res => decodeRoomOpen2(res))
); );
} }
public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> { public roomOpen3(req: RoomOpen3Request): Observable<RoomOpen3Response> {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN3_REQ, ...encodeRoomOpen3(req))
@ -92,7 +121,6 @@ export class RoomProtocolService {
map(res => decodeRoomOpen3(res)) map(res => decodeRoomOpen3(res))
); );
} }
public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> { public roomOpen4(req: RoomOpen4Request): Observable<RoomOpen4Response> {
return this.protocolService return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req)) .call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_OPEN4_REQ, ...encodeRoomOpen4(req))
@ -136,4 +164,103 @@ export class RoomProtocolService {
}) })
); );
} }
public roomUserStatusOffline(
req: RoomUserStatusOfflineRequest
): Observable<RoomUserStatusOfflineResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_USER_STATUS_REQ,
...encodeRoomUserStatusOffline(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomUserStatusOffline(res);
})
);
}
public roomExit(req: RoomExitRequest): Observable<RoomExitResponse> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_EXIT_REQ, ...encodeRoomExit(req))
.pipe(
map(res => {
take(1);
return decodeRoomExit(res);
})
);
}
public roomExitAll(req: RoomExitAllRequest): Observable<void> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_EXIT_ALL_REQ,
...encodeRoomAllExit(req)
)
.pipe(
map(res => {
take(1);
})
);
}
public roomExitForcing(
req: RoomExitForcingRequest
): Observable<RoomExitForcingResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_EXIT_FORCING_REQ,
...encodeRoomExitForcing(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomExitForcing(res);
})
);
}
public roomUpdate(req: RoomUpdateRequest): Observable<RoomUpdateResponse> {
return this.protocolService
.call(SVC_TYPE_ROOM, SSVC_TYPE_ROOM_UPD_REQ, ...encodeRoomUpdate(req))
.pipe(
map(res => {
take(1);
return decodeRoomUpdate(res);
})
);
}
public roomUpdateTimerSet(
req: RoomUpdateTimerSetRequest
): Observable<RoomUpdateTimerSetResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_INFO_UPD_REQ,
...encodeRoomUpdateTimerSet(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomUpdateTimerSet(res);
})
);
}
public roomUpdateFont(
req: RoomUpdateFontRequest
): Observable<RoomUpdateFontResponse> {
return this.protocolService
.call(
SVC_TYPE_ROOM,
SSVC_TYPE_ROOM_FONT_UPD_REQ,
...encodeRoomUpdateFont(req)
)
.pipe(
map(res => {
take(1);
return decodeRoomUpdateFont(res);
})
);
}
} }

View File

@ -18,3 +18,8 @@ export enum RoomType {
// K: MyTalk(나와의 대화) // K: MyTalk(나와의 대화)
Mytalk = 'K' Mytalk = 'K'
} }
export enum RoomExitType {
// A 만 사용하고 있고, 서버에서도 달리 처리하지는 않음, 하지만 추후 사용성을 위해 생성.
All = 'A'
}

View File

@ -2,12 +2,9 @@
* Public API Surface of ucap-webmessenger-protocol-room * Public API Surface of ucap-webmessenger-protocol-room
*/ */
export * from './lib/models/room-info'; export * from './lib/models/info';
export * from './lib/models/room-invite'; export * from './lib/models/invite';
export * from './lib/models/room-open'; export * from './lib/models/open';
export * from './lib/models/room-open2';
export * from './lib/models/room-open3';
export * from './lib/models/room-open4';
export * from './lib/services/room-protocol.service'; export * from './lib/services/room-protocol.service';
export * from './lib/types/employee.type'; export * from './lib/types/employee.type';