klf-200-api
Version:
This module provides a wrapper to the socket API of a Velux KLF-200 interface. You will need at least firmware 0.2.0.0.71 on your KLF interface for this library to work.
42 lines • 1.69 kB
JavaScript
import { GW_FRAME_NTF } from "./common.js";
export var GW_ERROR;
(function (GW_ERROR) {
GW_ERROR[GW_ERROR["NotFurtherDefined"] = 0] = "NotFurtherDefined";
GW_ERROR[GW_ERROR["UnknownCommand"] = 1] = "UnknownCommand";
GW_ERROR[GW_ERROR["InvalidFrameStructure"] = 2] = "InvalidFrameStructure";
GW_ERROR[GW_ERROR["Busy"] = 7] = "Busy";
GW_ERROR[GW_ERROR["InvalidSystemTableIndex"] = 8] = "InvalidSystemTableIndex";
GW_ERROR[GW_ERROR["NotAuthenticated"] = 12] = "NotAuthenticated";
GW_ERROR[GW_ERROR["UnknonwErrorCode"] = 255] = "UnknonwErrorCode";
})(GW_ERROR || (GW_ERROR = {}));
export class GW_ERROR_NTF extends GW_FRAME_NTF {
ErrorNumber;
constructor(Data) {
super(Data);
const errorNumber = this.Data.readUInt8(0);
if (errorNumber in GW_ERROR)
this.ErrorNumber = errorNumber;
else
this.ErrorNumber = GW_ERROR.UnknonwErrorCode;
}
getError() {
switch (this.ErrorNumber) {
case GW_ERROR.NotFurtherDefined:
return "Not further defined error.";
case GW_ERROR.UnknownCommand:
return "Unknown command.";
case GW_ERROR.InvalidFrameStructure:
return "Invalid frame structure.";
case GW_ERROR.Busy:
return "Busy.";
case GW_ERROR.InvalidSystemTableIndex:
return "Invalid system table index.";
case GW_ERROR.NotAuthenticated:
return "Not authenticated.";
default:
return `Unknown error (${this.ErrorNumber.toString()}).`;
}
}
}
//# sourceMappingURL=GW_ERROR_NTF.js.map
;