diff --git a/src/core/communication/codec/BinaryReader.ts b/src/core/communication/codec/BinaryReader.ts index 6409eb82..0f7ab479 100644 --- a/src/core/communication/codec/BinaryReader.ts +++ b/src/core/communication/codec/BinaryReader.ts @@ -36,6 +36,15 @@ export class BinaryReader return short; } + public readDouble(): number + { + const double = this._dataView.getFloat64(this._position); + + this._position += 8; + + return double; + } + public readInt(): number { const int = this._dataView.getInt32(this._position); @@ -59,4 +68,4 @@ export class BinaryReader { return this._dataView.buffer; } -} \ No newline at end of file +} diff --git a/src/core/communication/codec/evawire/EvaWireDataWrapper.ts b/src/core/communication/codec/evawire/EvaWireDataWrapper.ts index c03c45e1..42e76c0f 100644 --- a/src/core/communication/codec/evawire/EvaWireDataWrapper.ts +++ b/src/core/communication/codec/evawire/EvaWireDataWrapper.ts @@ -38,6 +38,13 @@ export class EvaWireDataWrapper implements IMessageDataWrapper return this._buffer.readShort(); } + public readDouble(): number + { + if(!this._buffer) return -1; + + return this._buffer.readDouble(); + } + public readInt(): number { if(!this._buffer) return -1; @@ -62,4 +69,4 @@ export class EvaWireDataWrapper implements IMessageDataWrapper { return (this._buffer && (this._buffer.remaining() > 0)); } -} \ No newline at end of file +} diff --git a/src/core/communication/messages/IMessageDataWrapper.ts b/src/core/communication/messages/IMessageDataWrapper.ts index 0623d859..4a75eed9 100644 --- a/src/core/communication/messages/IMessageDataWrapper.ts +++ b/src/core/communication/messages/IMessageDataWrapper.ts @@ -6,8 +6,9 @@ export interface IMessageDataWrapper readBytes(length: number): BinaryReader; readBoolean(): boolean; readShort(): number; + readDouble(): number; readInt(): number; readString(): string; header: number; bytesAvailable: boolean; -} \ No newline at end of file +}