Add uuid to Hardware configuration

Closes #267
This commit is contained in:
József Farkas
2017-03-12 17:32:46 +01:00
parent 76a718c324
commit a3f3dc673e
@@ -1,4 +1,4 @@
import { assertUInt8 } from '../assert'; import { assertUInt8, assertUInt32 } from '../assert';
import { UhkBuffer } from '../UhkBuffer'; import { UhkBuffer } from '../UhkBuffer';
export class HardwareConfiguration { export class HardwareConfiguration {
@@ -14,6 +14,9 @@ export class HardwareConfiguration {
@assertUInt8 @assertUInt8
brandId: number; brandId: number;
@assertUInt32
uuid: number;
isIso: boolean; isIso: boolean;
hasBacklighting: boolean; hasBacklighting: boolean;
@@ -23,6 +26,7 @@ export class HardwareConfiguration {
this.dataModelVersion = jsonObject.dataModelVersion; this.dataModelVersion = jsonObject.dataModelVersion;
this.hardwareId = jsonObject.hardwareId; this.hardwareId = jsonObject.hardwareId;
this.brandId = jsonObject.brandId; this.brandId = jsonObject.brandId;
this.uuid = jsonObject.uuid;
this.isIso = jsonObject.isIso; this.isIso = jsonObject.isIso;
this.hasBacklighting = jsonObject.hasBacklighting; this.hasBacklighting = jsonObject.hasBacklighting;
return this; return this;
@@ -32,6 +36,7 @@ export class HardwareConfiguration {
this.signature = buffer.readString(); this.signature = buffer.readString();
this.dataModelVersion = buffer.readUInt16(); this.dataModelVersion = buffer.readUInt16();
this.hardwareId = buffer.readUInt8(); this.hardwareId = buffer.readUInt8();
this.uuid = buffer.readUInt32();
this.brandId = buffer.readUInt8(); this.brandId = buffer.readUInt8();
this.isIso = buffer.readBoolean(); this.isIso = buffer.readBoolean();
this.hasBacklighting = buffer.readBoolean(); this.hasBacklighting = buffer.readBoolean();
@@ -44,6 +49,7 @@ export class HardwareConfiguration {
dataModelVersion: this.dataModelVersion, dataModelVersion: this.dataModelVersion,
hardwareId: this.hardwareId, hardwareId: this.hardwareId,
brandId: this.brandId, brandId: this.brandId,
uuid: this.uuid,
isIso: this.isIso, isIso: this.isIso,
hasBacklighting: this.hasBacklighting hasBacklighting: this.hasBacklighting
}; };
@@ -54,6 +60,7 @@ export class HardwareConfiguration {
buffer.writeUInt16(this.dataModelVersion); buffer.writeUInt16(this.dataModelVersion);
buffer.writeUInt8(this.hardwareId); buffer.writeUInt8(this.hardwareId);
buffer.writeUInt8(this.brandId); buffer.writeUInt8(this.brandId);
buffer.writeUInt32(this.uuid);
buffer.writeBoolean(this.isIso); buffer.writeBoolean(this.isIso);
buffer.writeBoolean(this.hasBacklighting); buffer.writeBoolean(this.hasBacklighting);
} }