@hg8496/definitions
Version:
ProtoBuf definitions an JS lib
1,172 lines (1,101 loc) • 107 kB
JavaScript
/*eslint-disable block-scoped-var, id-length, no-control-regex, no-magic-numbers, no-prototype-builtins, no-redeclare, no-shadow, no-var, sort-vars*/
"use strict";
var $protobuf = require("protobufjs/minimal");
// Common aliases
var $Reader = $protobuf.Reader, $Writer = $protobuf.Writer, $util = $protobuf.util;
// Exported root namespace
var $root = $protobuf.roots["default"] || ($protobuf.roots["default"] = {});
$root.janitza = (function() {
/**
* Namespace janitza.
* @exports janitza
* @namespace
*/
var janitza = {};
janitza.device = (function() {
/**
* Namespace device.
* @memberof janitza
* @namespace
*/
var device = {};
device.Device = (function() {
/**
* Properties of a Device.
* @memberof janitza.device
* @interface IDevice
* @property {janitza.device.Device.DeviceType|null} [deviceType] Device deviceType
* @property {string|null} [serialNumber] Device serialNumber
* @property {string|null} [deviceName] Device deviceName
* @property {string|null} [firmwareVersion] Device firmwareVersion
* @property {string|null} [communication] Device communication
* @property {string|null} [gridVisID] Device gridVisID
* @property {string|null} [referenceKey] Device referenceKey
*/
/**
* Constructs a new Device.
* @memberof janitza.device
* @classdesc Represents a Device.
* @implements IDevice
* @constructor
* @param {janitza.device.IDevice=} [properties] Properties to set
*/
function Device(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Device deviceType.
* @member {janitza.device.Device.DeviceType} deviceType
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.deviceType = 0;
/**
* Device serialNumber.
* @member {string} serialNumber
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.serialNumber = "";
/**
* Device deviceName.
* @member {string} deviceName
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.deviceName = "";
/**
* Device firmwareVersion.
* @member {string} firmwareVersion
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.firmwareVersion = "";
/**
* Device communication.
* @member {string} communication
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.communication = "";
/**
* Device gridVisID.
* @member {string} gridVisID
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.gridVisID = "";
/**
* Device referenceKey.
* @member {string} referenceKey
* @memberof janitza.device.Device
* @instance
*/
Device.prototype.referenceKey = "";
/**
* Creates a new Device instance using the specified properties.
* @function create
* @memberof janitza.device.Device
* @static
* @param {janitza.device.IDevice=} [properties] Properties to set
* @returns {janitza.device.Device} Device instance
*/
Device.create = function create(properties) {
return new Device(properties);
};
/**
* Encodes the specified Device message. Does not implicitly {@link janitza.device.Device.verify|verify} messages.
* @function encode
* @memberof janitza.device.Device
* @static
* @param {janitza.device.IDevice} message Device message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Device.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.deviceType != null && Object.hasOwnProperty.call(message, "deviceType"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.deviceType);
if (message.serialNumber != null && Object.hasOwnProperty.call(message, "serialNumber"))
writer.uint32(/* id 2, wireType 2 =*/18).string(message.serialNumber);
if (message.deviceName != null && Object.hasOwnProperty.call(message, "deviceName"))
writer.uint32(/* id 3, wireType 2 =*/26).string(message.deviceName);
if (message.firmwareVersion != null && Object.hasOwnProperty.call(message, "firmwareVersion"))
writer.uint32(/* id 4, wireType 2 =*/34).string(message.firmwareVersion);
if (message.communication != null && Object.hasOwnProperty.call(message, "communication"))
writer.uint32(/* id 5, wireType 2 =*/42).string(message.communication);
if (message.gridVisID != null && Object.hasOwnProperty.call(message, "gridVisID"))
writer.uint32(/* id 6, wireType 2 =*/50).string(message.gridVisID);
if (message.referenceKey != null && Object.hasOwnProperty.call(message, "referenceKey"))
writer.uint32(/* id 7, wireType 2 =*/58).string(message.referenceKey);
return writer;
};
/**
* Encodes the specified Device message, length delimited. Does not implicitly {@link janitza.device.Device.verify|verify} messages.
* @function encodeDelimited
* @memberof janitza.device.Device
* @static
* @param {janitza.device.IDevice} message Device message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Device.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Device message from the specified reader or buffer.
* @function decode
* @memberof janitza.device.Device
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {janitza.device.Device} Device
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Device.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.janitza.device.Device();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.deviceType = reader.int32();
break;
case 2:
message.serialNumber = reader.string();
break;
case 3:
message.deviceName = reader.string();
break;
case 4:
message.firmwareVersion = reader.string();
break;
case 5:
message.communication = reader.string();
break;
case 6:
message.gridVisID = reader.string();
break;
case 7:
message.referenceKey = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Device message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof janitza.device.Device
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {janitza.device.Device} Device
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Device.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Device message.
* @function verify
* @memberof janitza.device.Device
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Device.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.deviceType != null && message.hasOwnProperty("deviceType"))
switch (message.deviceType) {
default:
return "deviceType: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
case 13:
case 14:
case 15:
case 16:
case 17:
case 18:
case 19:
case 20:
case 21:
case 99:
case 100:
case 101:
case 102:
break;
}
if (message.serialNumber != null && message.hasOwnProperty("serialNumber"))
if (!$util.isString(message.serialNumber))
return "serialNumber: string expected";
if (message.deviceName != null && message.hasOwnProperty("deviceName"))
if (!$util.isString(message.deviceName))
return "deviceName: string expected";
if (message.firmwareVersion != null && message.hasOwnProperty("firmwareVersion"))
if (!$util.isString(message.firmwareVersion))
return "firmwareVersion: string expected";
if (message.communication != null && message.hasOwnProperty("communication"))
if (!$util.isString(message.communication))
return "communication: string expected";
if (message.gridVisID != null && message.hasOwnProperty("gridVisID"))
if (!$util.isString(message.gridVisID))
return "gridVisID: string expected";
if (message.referenceKey != null && message.hasOwnProperty("referenceKey"))
if (!$util.isString(message.referenceKey))
return "referenceKey: string expected";
return null;
};
/**
* Creates a Device message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof janitza.device.Device
* @static
* @param {Object.<string,*>} object Plain object
* @returns {janitza.device.Device} Device
*/
Device.fromObject = function fromObject(object) {
if (object instanceof $root.janitza.device.Device)
return object;
var message = new $root.janitza.device.Device();
switch (object.deviceType) {
case "Unknown":
case 0:
message.deviceType = 0;
break;
case "UMG507":
case 1:
message.deviceType = 1;
break;
case "UMG508":
case 2:
message.deviceType = 2;
break;
case "UMG509":
case 3:
message.deviceType = 3;
break;
case "UMG510":
case 4:
message.deviceType = 4;
break;
case "UMG511":
case 5:
message.deviceType = 5;
break;
case "UMG512":
case 6:
message.deviceType = 6;
break;
case "UMG604":
case 7:
message.deviceType = 7;
break;
case "UMG605":
case 8:
message.deviceType = 8;
break;
case "UMG96S":
case 9:
message.deviceType = 9;
break;
case "UMG96S2":
case 10:
message.deviceType = 10;
break;
case "UMG96RM":
case 11:
message.deviceType = 11;
break;
case "UMG96RME":
case 12:
message.deviceType = 12;
break;
case "UMG96RMEL":
case 13:
message.deviceType = 13;
break;
case "UMG96PA":
case 14:
message.deviceType = 14;
break;
case "PRODATA":
case 15:
message.deviceType = 15;
break;
case "UMG96PN":
case 16:
message.deviceType = 16;
break;
case "UMG801":
case 17:
message.deviceType = 17;
break;
case "UMG801_BASE":
case 18:
message.deviceType = 18;
break;
case "UMG801_MG":
case 19:
message.deviceType = 19;
break;
case "UMG801_MG2":
case 20:
message.deviceType = 20;
break;
case "UMG801_MG3":
case 21:
message.deviceType = 21;
break;
case "GENERIC":
case 99:
message.deviceType = 99;
break;
case "VIRTUAL":
case 100:
message.deviceType = 100;
break;
case "KPI":
case 101:
message.deviceType = 101;
break;
case "DI":
case 102:
message.deviceType = 102;
break;
}
if (object.serialNumber != null)
message.serialNumber = String(object.serialNumber);
if (object.deviceName != null)
message.deviceName = String(object.deviceName);
if (object.firmwareVersion != null)
message.firmwareVersion = String(object.firmwareVersion);
if (object.communication != null)
message.communication = String(object.communication);
if (object.gridVisID != null)
message.gridVisID = String(object.gridVisID);
if (object.referenceKey != null)
message.referenceKey = String(object.referenceKey);
return message;
};
/**
* Creates a plain object from a Device message. Also converts values to other types if specified.
* @function toObject
* @memberof janitza.device.Device
* @static
* @param {janitza.device.Device} message Device
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Device.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.defaults) {
object.deviceType = options.enums === String ? "Unknown" : 0;
object.serialNumber = "";
object.deviceName = "";
object.firmwareVersion = "";
object.communication = "";
object.gridVisID = "";
object.referenceKey = "";
}
if (message.deviceType != null && message.hasOwnProperty("deviceType"))
object.deviceType = options.enums === String ? $root.janitza.device.Device.DeviceType[message.deviceType] : message.deviceType;
if (message.serialNumber != null && message.hasOwnProperty("serialNumber"))
object.serialNumber = message.serialNumber;
if (message.deviceName != null && message.hasOwnProperty("deviceName"))
object.deviceName = message.deviceName;
if (message.firmwareVersion != null && message.hasOwnProperty("firmwareVersion"))
object.firmwareVersion = message.firmwareVersion;
if (message.communication != null && message.hasOwnProperty("communication"))
object.communication = message.communication;
if (message.gridVisID != null && message.hasOwnProperty("gridVisID"))
object.gridVisID = message.gridVisID;
if (message.referenceKey != null && message.hasOwnProperty("referenceKey"))
object.referenceKey = message.referenceKey;
return object;
};
/**
* Converts this Device to JSON.
* @function toJSON
* @memberof janitza.device.Device
* @instance
* @returns {Object.<string,*>} JSON object
*/
Device.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
/**
* DeviceType enum.
* @name janitza.device.Device.DeviceType
* @enum {number}
* @property {number} Unknown=0 Unknown value
* @property {number} UMG507=1 UMG507 value
* @property {number} UMG508=2 UMG508 value
* @property {number} UMG509=3 UMG509 value
* @property {number} UMG510=4 UMG510 value
* @property {number} UMG511=5 UMG511 value
* @property {number} UMG512=6 UMG512 value
* @property {number} UMG604=7 UMG604 value
* @property {number} UMG605=8 UMG605 value
* @property {number} UMG96S=9 UMG96S value
* @property {number} UMG96S2=10 UMG96S2 value
* @property {number} UMG96RM=11 UMG96RM value
* @property {number} UMG96RME=12 UMG96RME value
* @property {number} UMG96RMEL=13 UMG96RMEL value
* @property {number} UMG96PA=14 UMG96PA value
* @property {number} PRODATA=15 PRODATA value
* @property {number} UMG96PN=16 UMG96PN value
* @property {number} UMG801=17 UMG801 value
* @property {number} UMG801_BASE=18 UMG801_BASE value
* @property {number} UMG801_MG=19 UMG801_MG value
* @property {number} UMG801_MG2=20 UMG801_MG2 value
* @property {number} UMG801_MG3=21 UMG801_MG3 value
* @property {number} GENERIC=99 GENERIC value
* @property {number} VIRTUAL=100 VIRTUAL value
* @property {number} KPI=101 KPI value
* @property {number} DI=102 DI value
*/
Device.DeviceType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "Unknown"] = 0;
values[valuesById[1] = "UMG507"] = 1;
values[valuesById[2] = "UMG508"] = 2;
values[valuesById[3] = "UMG509"] = 3;
values[valuesById[4] = "UMG510"] = 4;
values[valuesById[5] = "UMG511"] = 5;
values[valuesById[6] = "UMG512"] = 6;
values[valuesById[7] = "UMG604"] = 7;
values[valuesById[8] = "UMG605"] = 8;
values[valuesById[9] = "UMG96S"] = 9;
values[valuesById[10] = "UMG96S2"] = 10;
values[valuesById[11] = "UMG96RM"] = 11;
values[valuesById[12] = "UMG96RME"] = 12;
values[valuesById[13] = "UMG96RMEL"] = 13;
values[valuesById[14] = "UMG96PA"] = 14;
values[valuesById[15] = "PRODATA"] = 15;
values[valuesById[16] = "UMG96PN"] = 16;
values[valuesById[17] = "UMG801"] = 17;
values[valuesById[18] = "UMG801_BASE"] = 18;
values[valuesById[19] = "UMG801_MG"] = 19;
values[valuesById[20] = "UMG801_MG2"] = 20;
values[valuesById[21] = "UMG801_MG3"] = 21;
values[valuesById[99] = "GENERIC"] = 99;
values[valuesById[100] = "VIRTUAL"] = 100;
values[valuesById[101] = "KPI"] = 101;
values[valuesById[102] = "DI"] = 102;
return values;
})();
return Device;
})();
device.Devices = (function() {
/**
* Properties of a Devices.
* @memberof janitza.device
* @interface IDevices
* @property {Array.<janitza.device.IDevice>|null} [devices] Devices devices
*/
/**
* Constructs a new Devices.
* @memberof janitza.device
* @classdesc Represents a Devices.
* @implements IDevices
* @constructor
* @param {janitza.device.IDevices=} [properties] Properties to set
*/
function Devices(properties) {
this.devices = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Devices devices.
* @member {Array.<janitza.device.IDevice>} devices
* @memberof janitza.device.Devices
* @instance
*/
Devices.prototype.devices = $util.emptyArray;
/**
* Creates a new Devices instance using the specified properties.
* @function create
* @memberof janitza.device.Devices
* @static
* @param {janitza.device.IDevices=} [properties] Properties to set
* @returns {janitza.device.Devices} Devices instance
*/
Devices.create = function create(properties) {
return new Devices(properties);
};
/**
* Encodes the specified Devices message. Does not implicitly {@link janitza.device.Devices.verify|verify} messages.
* @function encode
* @memberof janitza.device.Devices
* @static
* @param {janitza.device.IDevices} message Devices message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Devices.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.devices != null && message.devices.length)
for (var i = 0; i < message.devices.length; ++i)
$root.janitza.device.Device.encode(message.devices[i], writer.uint32(/* id 1, wireType 2 =*/10).fork()).ldelim();
return writer;
};
/**
* Encodes the specified Devices message, length delimited. Does not implicitly {@link janitza.device.Devices.verify|verify} messages.
* @function encodeDelimited
* @memberof janitza.device.Devices
* @static
* @param {janitza.device.IDevices} message Devices message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Devices.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes a Devices message from the specified reader or buffer.
* @function decode
* @memberof janitza.device.Devices
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {janitza.device.Devices} Devices
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Devices.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.janitza.device.Devices();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
if (!(message.devices && message.devices.length))
message.devices = [];
message.devices.push($root.janitza.device.Device.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes a Devices message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof janitza.device.Devices
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {janitza.device.Devices} Devices
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Devices.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies a Devices message.
* @function verify
* @memberof janitza.device.Devices
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Devices.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
if (message.devices != null && message.hasOwnProperty("devices")) {
if (!Array.isArray(message.devices))
return "devices: array expected";
for (var i = 0; i < message.devices.length; ++i) {
var error = $root.janitza.device.Device.verify(message.devices[i]);
if (error)
return "devices." + error;
}
}
return null;
};
/**
* Creates a Devices message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof janitza.device.Devices
* @static
* @param {Object.<string,*>} object Plain object
* @returns {janitza.device.Devices} Devices
*/
Devices.fromObject = function fromObject(object) {
if (object instanceof $root.janitza.device.Devices)
return object;
var message = new $root.janitza.device.Devices();
if (object.devices) {
if (!Array.isArray(object.devices))
throw TypeError(".janitza.device.Devices.devices: array expected");
message.devices = [];
for (var i = 0; i < object.devices.length; ++i) {
if (typeof object.devices[i] !== "object")
throw TypeError(".janitza.device.Devices.devices: object expected");
message.devices[i] = $root.janitza.device.Device.fromObject(object.devices[i]);
}
}
return message;
};
/**
* Creates a plain object from a Devices message. Also converts values to other types if specified.
* @function toObject
* @memberof janitza.device.Devices
* @static
* @param {janitza.device.Devices} message Devices
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Devices.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (options.arrays || options.defaults)
object.devices = [];
if (message.devices && message.devices.length) {
object.devices = [];
for (var j = 0; j < message.devices.length; ++j)
object.devices[j] = $root.janitza.device.Device.toObject(message.devices[j], options);
}
return object;
};
/**
* Converts this Devices to JSON.
* @function toJSON
* @memberof janitza.device.Devices
* @instance
* @returns {Object.<string,*>} JSON object
*/
Devices.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return Devices;
})();
return device;
})();
janitza.values = (function() {
/**
* Namespace values.
* @memberof janitza
* @namespace
*/
var values = {};
/**
* TimeBase enum.
* @name janitza.values.TimeBase
* @enum {number}
* @property {number} Unknown=0 Unknown value
* @property {number} Minutes1=1 Minutes1 value
* @property {number} Minutes5=2 Minutes5 value
* @property {number} Minutes10=3 Minutes10 value
* @property {number} Minutes15=4 Minutes15 value
* @property {number} Minutes30=5 Minutes30 value
* @property {number} Minutes60=6 Minutes60 value
* @property {number} Seconds10=7 Seconds10 value
*/
values.TimeBase = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "Unknown"] = 0;
values[valuesById[1] = "Minutes1"] = 1;
values[valuesById[2] = "Minutes5"] = 2;
values[valuesById[3] = "Minutes10"] = 3;
values[valuesById[4] = "Minutes15"] = 4;
values[valuesById[5] = "Minutes30"] = 5;
values[valuesById[6] = "Minutes60"] = 6;
values[valuesById[7] = "Seconds10"] = 7;
return values;
})();
/**
* Line enum.
* @name janitza.values.Line
* @enum {number}
* @property {number} Unknown=0 Unknown value
* @property {number} L1=1 L1 value
* @property {number} L2=2 L2 value
* @property {number} L3=3 L3 value
* @property {number} N=4 N value
* @property {number} SUM13=5 SUM13 value
* @property {number} L4=6 L4 value
*/
values.Line = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "Unknown"] = 0;
values[valuesById[1] = "L1"] = 1;
values[valuesById[2] = "L2"] = 2;
values[valuesById[3] = "L3"] = 3;
values[valuesById[4] = "N"] = 4;
values[valuesById[5] = "SUM13"] = 5;
values[valuesById[6] = "L4"] = 6;
return values;
})();
/**
* EnergyValueType enum.
* @name janitza.values.EnergyValueType
* @enum {number}
* @property {number} Unknown=0 Unknown value
* @property {number} ActiveEnergyConsumed=1 ActiveEnergyConsumed value
* @property {number} ActiveEnergySupplied=2 ActiveEnergySupplied value
* @property {number} ActiveEnergy=3 ActiveEnergy value
* @property {number} ActivePower=4 ActivePower value
* @property {number} ReactiveEnergy=5 ReactiveEnergy value
* @property {number} ReactivePower=6 ReactivePower value
* @property {number} ApparentPower=7 ApparentPower value
* @property {number} ApparentEnergy=8 ApparentEnergy value
* @property {number} Water=9 Water value
* @property {number} Gas=10 Gas value
* @property {number} HeatQuantity=11 HeatQuantity value
* @property {number} CompressedAir=12 CompressedAir value
* @property {number} Oil=13 Oil value
* @property {number} KPI_Result=100 KPI_Result value
* @property {number} KPI_A=101 KPI_A value
* @property {number} KPI_B=102 KPI_B value
* @property {number} KPI_C=103 KPI_C value
* @property {number} KPI_D=104 KPI_D value
*/
values.EnergyValueType = (function() {
var valuesById = {}, values = Object.create(valuesById);
values[valuesById[0] = "Unknown"] = 0;
values[valuesById[1] = "ActiveEnergyConsumed"] = 1;
values[valuesById[2] = "ActiveEnergySupplied"] = 2;
values[valuesById[3] = "ActiveEnergy"] = 3;
values[valuesById[4] = "ActivePower"] = 4;
values[valuesById[5] = "ReactiveEnergy"] = 5;
values[valuesById[6] = "ReactivePower"] = 6;
values[valuesById[7] = "ApparentPower"] = 7;
values[valuesById[8] = "ApparentEnergy"] = 8;
values[valuesById[9] = "Water"] = 9;
values[valuesById[10] = "Gas"] = 10;
values[valuesById[11] = "HeatQuantity"] = 11;
values[valuesById[12] = "CompressedAir"] = 12;
values[valuesById[13] = "Oil"] = 13;
values[valuesById[100] = "KPI_Result"] = 100;
values[valuesById[101] = "KPI_A"] = 101;
values[valuesById[102] = "KPI_B"] = 102;
values[valuesById[103] = "KPI_C"] = 103;
values[valuesById[104] = "KPI_D"] = 104;
return values;
})();
values.Input = (function() {
/**
* Properties of an Input.
* @memberof janitza.values
* @interface IInput
* @property {janitza.values.Line|null} [line] Input line
* @property {number|null} [channel] Input channel
*/
/**
* Constructs a new Input.
* @memberof janitza.values
* @classdesc Represents an Input.
* @implements IInput
* @constructor
* @param {janitza.values.IInput=} [properties] Properties to set
*/
function Input(properties) {
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* Input line.
* @member {janitza.values.Line} line
* @memberof janitza.values.Input
* @instance
*/
Input.prototype.line = 0;
/**
* Input channel.
* @member {number} channel
* @memberof janitza.values.Input
* @instance
*/
Input.prototype.channel = 0;
// OneOf field names bound to virtual getters and setters
var $oneOfFields;
/**
* Input input.
* @member {"line"|"channel"|undefined} input
* @memberof janitza.values.Input
* @instance
*/
Object.defineProperty(Input.prototype, "input", {
get: $util.oneOfGetter($oneOfFields = ["line", "channel"]),
set: $util.oneOfSetter($oneOfFields)
});
/**
* Creates a new Input instance using the specified properties.
* @function create
* @memberof janitza.values.Input
* @static
* @param {janitza.values.IInput=} [properties] Properties to set
* @returns {janitza.values.Input} Input instance
*/
Input.create = function create(properties) {
return new Input(properties);
};
/**
* Encodes the specified Input message. Does not implicitly {@link janitza.values.Input.verify|verify} messages.
* @function encode
* @memberof janitza.values.Input
* @static
* @param {janitza.values.IInput} message Input message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Input.encode = function encode(message, writer) {
if (!writer)
writer = $Writer.create();
if (message.line != null && Object.hasOwnProperty.call(message, "line"))
writer.uint32(/* id 1, wireType 0 =*/8).int32(message.line);
if (message.channel != null && Object.hasOwnProperty.call(message, "channel"))
writer.uint32(/* id 2, wireType 0 =*/16).uint32(message.channel);
return writer;
};
/**
* Encodes the specified Input message, length delimited. Does not implicitly {@link janitza.values.Input.verify|verify} messages.
* @function encodeDelimited
* @memberof janitza.values.Input
* @static
* @param {janitza.values.IInput} message Input message or plain object to encode
* @param {$protobuf.Writer} [writer] Writer to encode to
* @returns {$protobuf.Writer} Writer
*/
Input.encodeDelimited = function encodeDelimited(message, writer) {
return this.encode(message, writer).ldelim();
};
/**
* Decodes an Input message from the specified reader or buffer.
* @function decode
* @memberof janitza.values.Input
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @param {number} [length] Message length if known beforehand
* @returns {janitza.values.Input} Input
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Input.decode = function decode(reader, length) {
if (!(reader instanceof $Reader))
reader = $Reader.create(reader);
var end = length === undefined ? reader.len : reader.pos + length, message = new $root.janitza.values.Input();
while (reader.pos < end) {
var tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.line = reader.int32();
break;
case 2:
message.channel = reader.uint32();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
};
/**
* Decodes an Input message from the specified reader or buffer, length delimited.
* @function decodeDelimited
* @memberof janitza.values.Input
* @static
* @param {$protobuf.Reader|Uint8Array} reader Reader or buffer to decode from
* @returns {janitza.values.Input} Input
* @throws {Error} If the payload is not a reader or valid buffer
* @throws {$protobuf.util.ProtocolError} If required fields are missing
*/
Input.decodeDelimited = function decodeDelimited(reader) {
if (!(reader instanceof $Reader))
reader = new $Reader(reader);
return this.decode(reader, reader.uint32());
};
/**
* Verifies an Input message.
* @function verify
* @memberof janitza.values.Input
* @static
* @param {Object.<string,*>} message Plain object to verify
* @returns {string|null} `null` if valid, otherwise the reason why it is not
*/
Input.verify = function verify(message) {
if (typeof message !== "object" || message === null)
return "object expected";
var properties = {};
if (message.line != null && message.hasOwnProperty("line")) {
properties.input = 1;
switch (message.line) {
default:
return "line: enum value expected";
case 0:
case 1:
case 2:
case 3:
case 4:
case 5:
case 6:
break;
}
}
if (message.channel != null && message.hasOwnProperty("channel")) {
if (properties.input === 1)
return "input: multiple values";
properties.input = 1;
if (!$util.isInteger(message.channel))
return "channel: integer expected";
}
return null;
};
/**
* Creates an Input message from a plain object. Also converts values to their respective internal types.
* @function fromObject
* @memberof janitza.values.Input
* @static
* @param {Object.<string,*>} object Plain object
* @returns {janitza.values.Input} Input
*/
Input.fromObject = function fromObject(object) {
if (object instanceof $root.janitza.values.Input)
return object;
var message = new $root.janitza.values.Input();
switch (object.line) {
case "Unknown":
case 0:
message.line = 0;
break;
case "L1":
case 1:
message.line = 1;
break;
case "L2":
case 2:
message.line = 2;
break;
case "L3":
case 3:
message.line = 3;
break;
case "N":
case 4:
message.line = 4;
break;
case "SUM13":
case 5:
message.line = 5;
break;
case "L4":
case 6:
message.line = 6;
break;
}
if (object.channel != null)
message.channel = object.channel >>> 0;
return message;
};
/**
* Creates a plain object from an Input message. Also converts values to other types if specified.
* @function toObject
* @memberof janitza.values.Input
* @static
* @param {janitza.values.Input} message Input
* @param {$protobuf.IConversionOptions} [options] Conversion options
* @returns {Object.<string,*>} Plain object
*/
Input.toObject = function toObject(message, options) {
if (!options)
options = {};
var object = {};
if (message.line != null && message.hasOwnProperty("line")) {
object.line = options.enums === String ? $root.janitza.values.Line[message.line] : message.line;
if (options.oneofs)
object.input = "line";
}
if (message.channel != null && message.hasOwnProperty("channel")) {
object.channel = message.channel;
if (options.oneofs)
object.input = "channel";
}
return object;
};
/**
* Converts this Input to JSON.
* @function toJSON
* @memberof janitza.values.Input
* @instance
* @returns {Object.<string,*>} JSON object
*/
Input.prototype.toJSON = function toJSON() {
return this.constructor.toObject(this, $protobuf.util.toJSONOptions);
};
return Input;
})();
values.ValueStream = (function() {
/**
* Properties of a ValueStream.
* @memberof janitza.values
* @interface IValueStream
* @property {janitza.values.TimeBase|null} [timebase] ValueStream timebase
* @property {janitza.values.EnergyValueType|null} [type] ValueStream type
* @property {janitza.values.IInput|null} [input] ValueStream input
* @property {Array.<number>|null} [values] ValueStream values
*/
/**
* Constructs a new ValueStream.
* @memberof janitza.values
* @classdesc Represents a ValueStream.
* @implements IValueStream
* @constructor
* @param {janitza.values.IValueStream=} [properties] Properties to set
*/
function ValueStream(properties) {
this.values = [];
if (properties)
for (var keys = Object.keys(properties), i = 0; i < keys.length; ++i)
if (properties[keys[i]] != null)
this[keys[i]] = properties[keys[i]];
}
/**
* ValueStream timebase.
* @member {janitza.values.TimeBase} timebase
* @memberof janitza.values.ValueStream
* @instance
*/
ValueStream.prototype.timebase = 0;
/**
* ValueStream type.