Display "Invalid hardware configuration" when the hardware configuration area is uninitialized instead of a general error message. Improves #623.
This commit is contained in:
@@ -41,16 +41,20 @@ export class HardwareConfiguration {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fromBinary(buffer: UhkBuffer): HardwareConfiguration {
|
fromBinary(buffer: UhkBuffer): HardwareConfiguration {
|
||||||
this.signature = buffer.readString();
|
try {
|
||||||
this.majorVersion = buffer.readUInt8();
|
this.signature = buffer.readString();
|
||||||
this.minorVersion = buffer.readUInt8();
|
this.majorVersion = buffer.readUInt8();
|
||||||
this.patchVersion = buffer.readUInt8();
|
this.minorVersion = buffer.readUInt8();
|
||||||
this.brandId = buffer.readUInt8();
|
this.patchVersion = buffer.readUInt8();
|
||||||
this.deviceId = buffer.readUInt8();
|
this.brandId = buffer.readUInt8();
|
||||||
this.uniqueId = buffer.readUInt32();
|
this.deviceId = buffer.readUInt8();
|
||||||
this.isVendorModeOn = buffer.readBoolean();
|
this.uniqueId = buffer.readUInt32();
|
||||||
this.isIso = buffer.readBoolean();
|
this.isVendorModeOn = buffer.readBoolean();
|
||||||
return this;
|
this.isIso = buffer.readBoolean();
|
||||||
|
return this;
|
||||||
|
} catch (e) {
|
||||||
|
throw new Error('Invalid hardware configuration');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
toJsonObject(): any {
|
toJsonObject(): any {
|
||||||
|
|||||||
Reference in New Issue
Block a user