update protocol for devices system
This commit is contained in:
@@ -9,6 +9,7 @@ export enum HandshakeState {
|
||||
export interface Device {
|
||||
deviceId: string;
|
||||
deviceName: string;
|
||||
deviceOs: string;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -28,7 +29,8 @@ export default class PacketHandshake extends Packet {
|
||||
private heartbeatInterval : number = 15;
|
||||
private device: Device = {
|
||||
deviceId: "",
|
||||
deviceName: ""
|
||||
deviceName: "",
|
||||
deviceOs: ""
|
||||
};
|
||||
private handshakeState:
|
||||
HandshakeState = HandshakeState.NEED_DEVICE_VERIFICATION;
|
||||
@@ -44,7 +46,8 @@ export default class PacketHandshake extends Packet {
|
||||
this.heartbeatInterval = stream.readInt8();
|
||||
this.device = {
|
||||
deviceId: stream.readString(),
|
||||
deviceName: stream.readString()
|
||||
deviceName: stream.readString(),
|
||||
deviceOs: stream.readString()
|
||||
}
|
||||
this.handshakeState = stream.readInt8();
|
||||
}
|
||||
@@ -58,6 +61,7 @@ export default class PacketHandshake extends Packet {
|
||||
stream.writeInt8(this.heartbeatInterval);
|
||||
stream.writeString(this.device.deviceId);
|
||||
stream.writeString(this.device.deviceName);
|
||||
stream.writeString(this.device.deviceOs);
|
||||
stream.writeInt8(this.handshakeState);
|
||||
return stream;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user