update protocol for devices system

This commit is contained in:
RoyceDa
2026-01-31 03:01:25 +02:00
parent 45e9f84cbe
commit 9194bf5c5f
3 changed files with 145 additions and 2 deletions

View File

@@ -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;
}