Innovenergy_trunk/csharp/lib/Wireformat/ts/VictronV1/BatteryStatus48TL.ts

1040 lines
27 KiB
TypeScript
Raw Normal View History

2023-02-16 12:57:06 +00:00
/* eslint-disable */
import Long from "long";
import _m0 from "protobufjs/minimal";
export const protobufPackage = "";
export enum Warnings {
NoWarning = 0,
TaM1_Bit1 = 1,
TbM1_Bit4 = 4,
VBm1_Bit6 = 6,
VBM1_Bit8 = 8,
IDM1_Bit10 = 10,
vsM1_Bit24 = 24,
iCM1_Bit26 = 26,
iDM1_Bit28 = 28,
MID1_Bit30 = 30,
BLPW_Bit32 = 32,
Ah_W_Bit35 = 35,
MPMM_Bit38 = 38,
TCMM_Bit39 = 39,
TCdi_Bit40 = 40,
WMTO_Bit41 = 41,
CELL1_Bit46 = 46,
UNRECOGNIZED = -1,
}
export function warningsFromJSON(object: any): Warnings {
switch (object) {
case 0:
case "NoWarning":
return Warnings.NoWarning;
case 1:
case "TaM1_Bit1":
return Warnings.TaM1_Bit1;
case 4:
case "TbM1_Bit4":
return Warnings.TbM1_Bit4;
case 6:
case "VBm1_Bit6":
return Warnings.VBm1_Bit6;
case 8:
case "VBM1_Bit8":
return Warnings.VBM1_Bit8;
case 10:
case "IDM1_Bit10":
return Warnings.IDM1_Bit10;
case 24:
case "vsM1_Bit24":
return Warnings.vsM1_Bit24;
case 26:
case "iCM1_Bit26":
return Warnings.iCM1_Bit26;
case 28:
case "iDM1_Bit28":
return Warnings.iDM1_Bit28;
case 30:
case "MID1_Bit30":
return Warnings.MID1_Bit30;
case 32:
case "BLPW_Bit32":
return Warnings.BLPW_Bit32;
case 35:
case "Ah_W_Bit35":
return Warnings.Ah_W_Bit35;
case 38:
case "MPMM_Bit38":
return Warnings.MPMM_Bit38;
case 39:
case "TCMM_Bit39":
return Warnings.TCMM_Bit39;
case 40:
case "TCdi_Bit40":
return Warnings.TCdi_Bit40;
case 41:
case "WMTO_Bit41":
return Warnings.WMTO_Bit41;
case 46:
case "CELL1_Bit46":
return Warnings.CELL1_Bit46;
case -1:
case "UNRECOGNIZED":
default:
return Warnings.UNRECOGNIZED;
}
}
export function warningsToJSON(object: Warnings): string {
switch (object) {
case Warnings.NoWarning:
return "NoWarning";
case Warnings.TaM1_Bit1:
return "TaM1_Bit1";
case Warnings.TbM1_Bit4:
return "TbM1_Bit4";
case Warnings.VBm1_Bit6:
return "VBm1_Bit6";
case Warnings.VBM1_Bit8:
return "VBM1_Bit8";
case Warnings.IDM1_Bit10:
return "IDM1_Bit10";
case Warnings.vsM1_Bit24:
return "vsM1_Bit24";
case Warnings.iCM1_Bit26:
return "iCM1_Bit26";
case Warnings.iDM1_Bit28:
return "iDM1_Bit28";
case Warnings.MID1_Bit30:
return "MID1_Bit30";
case Warnings.BLPW_Bit32:
return "BLPW_Bit32";
case Warnings.Ah_W_Bit35:
return "Ah_W_Bit35";
case Warnings.MPMM_Bit38:
return "MPMM_Bit38";
case Warnings.TCMM_Bit39:
return "TCMM_Bit39";
case Warnings.TCdi_Bit40:
return "TCdi_Bit40";
case Warnings.WMTO_Bit41:
return "WMTO_Bit41";
case Warnings.CELL1_Bit46:
return "CELL1_Bit46";
default:
return "UNKNOWN";
}
}
export enum Alarms {
Tam_Bit0 = 0,
TaM2_Bit2 = 2,
Tbm_Bit3 = 3,
TbM2_Bit5 = 5,
VBm2_Bit7 = 7,
VBM2_Bit8 = 8,
IDM2_Bit11 = 11,
ISOB_Bit12 = 12,
MSWE_Bit13 = 13,
FUSE_Bit14 = 14,
HTRE_Bit15 = 15,
TCPE_Bit16 = 16,
STRE_Bit17 = 17,
CME_Bit18 = 18,
HWFL_Bit19 = 19,
HWEM_Bit20 = 20,
ThM_Bit21 = 21,
vsm1_Bit22 = 22,
vsm2_Bit23 = 23,
vsM2_Bit25 = 25,
iCM2_Bit27 = 27,
iDM2_Bit29 = 29,
MID2_Bit31 = 31,
CCBF_Bit33 = 33,
AhFL_Bit34 = 34,
TbCM_Bit36 = 36,
BRNF_Bit37 = 37,
HTFS_Bit42 = 42,
DATA_Bit43 = 43,
CELL2_Bit45 = 45,
Undocumented_Bit44 = 44,
Undocumented_Bit47 = 47,
Undocumented_Bit48 = 48,
Undocumented_Bit49 = 49,
Undocumented_Bit50 = 50,
Undocumented_Bit51 = 51,
Undocumented_Bit52 = 52,
Undocumented_Bit53 = 53,
Undocumented_Bit54 = 54,
Undocumented_Bit55 = 55,
Undocumented_Bit56 = 56,
Undocumented_Bit57 = 57,
Undocumented_Bit58 = 58,
Undocumented_Bit59 = 59,
Undocumented_Bit60 = 60,
Undocumented_Bit61 = 61,
Undocumented_Bit62 = 62,
Undocumented_Bit63 = 63,
UNRECOGNIZED = -1,
}
export function alarmsFromJSON(object: any): Alarms {
switch (object) {
case 0:
case "Tam_Bit0":
return Alarms.Tam_Bit0;
case 2:
case "TaM2_Bit2":
return Alarms.TaM2_Bit2;
case 3:
case "Tbm_Bit3":
return Alarms.Tbm_Bit3;
case 5:
case "TbM2_Bit5":
return Alarms.TbM2_Bit5;
case 7:
case "VBm2_Bit7":
return Alarms.VBm2_Bit7;
case 8:
case "VBM2_Bit8":
return Alarms.VBM2_Bit8;
case 11:
case "IDM2_Bit11":
return Alarms.IDM2_Bit11;
case 12:
case "ISOB_Bit12":
return Alarms.ISOB_Bit12;
case 13:
case "MSWE_Bit13":
return Alarms.MSWE_Bit13;
case 14:
case "FUSE_Bit14":
return Alarms.FUSE_Bit14;
case 15:
case "HTRE_Bit15":
return Alarms.HTRE_Bit15;
case 16:
case "TCPE_Bit16":
return Alarms.TCPE_Bit16;
case 17:
case "STRE_Bit17":
return Alarms.STRE_Bit17;
case 18:
case "CME_Bit18":
return Alarms.CME_Bit18;
case 19:
case "HWFL_Bit19":
return Alarms.HWFL_Bit19;
case 20:
case "HWEM_Bit20":
return Alarms.HWEM_Bit20;
case 21:
case "ThM_Bit21":
return Alarms.ThM_Bit21;
case 22:
case "vsm1_Bit22":
return Alarms.vsm1_Bit22;
case 23:
case "vsm2_Bit23":
return Alarms.vsm2_Bit23;
case 25:
case "vsM2_Bit25":
return Alarms.vsM2_Bit25;
case 27:
case "iCM2_Bit27":
return Alarms.iCM2_Bit27;
case 29:
case "iDM2_Bit29":
return Alarms.iDM2_Bit29;
case 31:
case "MID2_Bit31":
return Alarms.MID2_Bit31;
case 33:
case "CCBF_Bit33":
return Alarms.CCBF_Bit33;
case 34:
case "AhFL_Bit34":
return Alarms.AhFL_Bit34;
case 36:
case "TbCM_Bit36":
return Alarms.TbCM_Bit36;
case 37:
case "BRNF_Bit37":
return Alarms.BRNF_Bit37;
case 42:
case "HTFS_Bit42":
return Alarms.HTFS_Bit42;
case 43:
case "DATA_Bit43":
return Alarms.DATA_Bit43;
case 45:
case "CELL2_Bit45":
return Alarms.CELL2_Bit45;
case 44:
case "Undocumented_Bit44":
return Alarms.Undocumented_Bit44;
case 47:
case "Undocumented_Bit47":
return Alarms.Undocumented_Bit47;
case 48:
case "Undocumented_Bit48":
return Alarms.Undocumented_Bit48;
case 49:
case "Undocumented_Bit49":
return Alarms.Undocumented_Bit49;
case 50:
case "Undocumented_Bit50":
return Alarms.Undocumented_Bit50;
case 51:
case "Undocumented_Bit51":
return Alarms.Undocumented_Bit51;
case 52:
case "Undocumented_Bit52":
return Alarms.Undocumented_Bit52;
case 53:
case "Undocumented_Bit53":
return Alarms.Undocumented_Bit53;
case 54:
case "Undocumented_Bit54":
return Alarms.Undocumented_Bit54;
case 55:
case "Undocumented_Bit55":
return Alarms.Undocumented_Bit55;
case 56:
case "Undocumented_Bit56":
return Alarms.Undocumented_Bit56;
case 57:
case "Undocumented_Bit57":
return Alarms.Undocumented_Bit57;
case 58:
case "Undocumented_Bit58":
return Alarms.Undocumented_Bit58;
case 59:
case "Undocumented_Bit59":
return Alarms.Undocumented_Bit59;
case 60:
case "Undocumented_Bit60":
return Alarms.Undocumented_Bit60;
case 61:
case "Undocumented_Bit61":
return Alarms.Undocumented_Bit61;
case 62:
case "Undocumented_Bit62":
return Alarms.Undocumented_Bit62;
case 63:
case "Undocumented_Bit63":
return Alarms.Undocumented_Bit63;
case -1:
case "UNRECOGNIZED":
default:
return Alarms.UNRECOGNIZED;
}
}
export function alarmsToJSON(object: Alarms): string {
switch (object) {
case Alarms.Tam_Bit0:
return "Tam_Bit0";
case Alarms.TaM2_Bit2:
return "TaM2_Bit2";
case Alarms.Tbm_Bit3:
return "Tbm_Bit3";
case Alarms.TbM2_Bit5:
return "TbM2_Bit5";
case Alarms.VBm2_Bit7:
return "VBm2_Bit7";
case Alarms.VBM2_Bit8:
return "VBM2_Bit8";
case Alarms.IDM2_Bit11:
return "IDM2_Bit11";
case Alarms.ISOB_Bit12:
return "ISOB_Bit12";
case Alarms.MSWE_Bit13:
return "MSWE_Bit13";
case Alarms.FUSE_Bit14:
return "FUSE_Bit14";
case Alarms.HTRE_Bit15:
return "HTRE_Bit15";
case Alarms.TCPE_Bit16:
return "TCPE_Bit16";
case Alarms.STRE_Bit17:
return "STRE_Bit17";
case Alarms.CME_Bit18:
return "CME_Bit18";
case Alarms.HWFL_Bit19:
return "HWFL_Bit19";
case Alarms.HWEM_Bit20:
return "HWEM_Bit20";
case Alarms.ThM_Bit21:
return "ThM_Bit21";
case Alarms.vsm1_Bit22:
return "vsm1_Bit22";
case Alarms.vsm2_Bit23:
return "vsm2_Bit23";
case Alarms.vsM2_Bit25:
return "vsM2_Bit25";
case Alarms.iCM2_Bit27:
return "iCM2_Bit27";
case Alarms.iDM2_Bit29:
return "iDM2_Bit29";
case Alarms.MID2_Bit31:
return "MID2_Bit31";
case Alarms.CCBF_Bit33:
return "CCBF_Bit33";
case Alarms.AhFL_Bit34:
return "AhFL_Bit34";
case Alarms.TbCM_Bit36:
return "TbCM_Bit36";
case Alarms.BRNF_Bit37:
return "BRNF_Bit37";
case Alarms.HTFS_Bit42:
return "HTFS_Bit42";
case Alarms.DATA_Bit43:
return "DATA_Bit43";
case Alarms.CELL2_Bit45:
return "CELL2_Bit45";
case Alarms.Undocumented_Bit44:
return "Undocumented_Bit44";
case Alarms.Undocumented_Bit47:
return "Undocumented_Bit47";
case Alarms.Undocumented_Bit48:
return "Undocumented_Bit48";
case Alarms.Undocumented_Bit49:
return "Undocumented_Bit49";
case Alarms.Undocumented_Bit50:
return "Undocumented_Bit50";
case Alarms.Undocumented_Bit51:
return "Undocumented_Bit51";
case Alarms.Undocumented_Bit52:
return "Undocumented_Bit52";
case Alarms.Undocumented_Bit53:
return "Undocumented_Bit53";
case Alarms.Undocumented_Bit54:
return "Undocumented_Bit54";
case Alarms.Undocumented_Bit55:
return "Undocumented_Bit55";
case Alarms.Undocumented_Bit56:
return "Undocumented_Bit56";
case Alarms.Undocumented_Bit57:
return "Undocumented_Bit57";
case Alarms.Undocumented_Bit58:
return "Undocumented_Bit58";
case Alarms.Undocumented_Bit59:
return "Undocumented_Bit59";
case Alarms.Undocumented_Bit60:
return "Undocumented_Bit60";
case Alarms.Undocumented_Bit61:
return "Undocumented_Bit61";
case Alarms.Undocumented_Bit62:
return "Undocumented_Bit62";
case Alarms.Undocumented_Bit63:
return "Undocumented_Bit63";
default:
return "UNKNOWN";
}
}
export enum IoStatus {
NoStatus = 0,
DisconnectedFromDc = 1,
AlarmActive = 2,
VoltMeasurementAllowed = 4,
AuxRelay = 5,
RemoteState = 6,
HeaterActive = 7,
/** BatteryCold - fake */
BatteryCold = 8,
/** EocReached - fake */
EocReached = 9,
UNRECOGNIZED = -1,
}
export function ioStatusFromJSON(object: any): IoStatus {
switch (object) {
case 0:
case "NoStatus":
return IoStatus.NoStatus;
case 1:
case "DisconnectedFromDc":
return IoStatus.DisconnectedFromDc;
case 2:
case "AlarmActive":
return IoStatus.AlarmActive;
case 4:
case "VoltMeasurementAllowed":
return IoStatus.VoltMeasurementAllowed;
case 5:
case "AuxRelay":
return IoStatus.AuxRelay;
case 6:
case "RemoteState":
return IoStatus.RemoteState;
case 7:
case "HeaterActive":
return IoStatus.HeaterActive;
case 8:
case "BatteryCold":
return IoStatus.BatteryCold;
case 9:
case "EocReached":
return IoStatus.EocReached;
case -1:
case "UNRECOGNIZED":
default:
return IoStatus.UNRECOGNIZED;
}
}
export function ioStatusToJSON(object: IoStatus): string {
switch (object) {
case IoStatus.NoStatus:
return "NoStatus";
case IoStatus.DisconnectedFromDc:
return "DisconnectedFromDc";
case IoStatus.AlarmActive:
return "AlarmActive";
case IoStatus.VoltMeasurementAllowed:
return "VoltMeasurementAllowed";
case IoStatus.AuxRelay:
return "AuxRelay";
case IoStatus.RemoteState:
return "RemoteState";
case IoStatus.HeaterActive:
return "HeaterActive";
case IoStatus.BatteryCold:
return "BatteryCold";
case IoStatus.EocReached:
return "EocReached";
default:
return "UNKNOWN";
}
}
export enum Led {
Off = 0,
On = 1,
BlinkingSlow = 2,
BlinkingFash = 3,
UNRECOGNIZED = -1,
}
export function ledFromJSON(object: any): Led {
switch (object) {
case 0:
case "Off":
return Led.Off;
case 1:
case "On":
return Led.On;
case 2:
case "BlinkingSlow":
return Led.BlinkingSlow;
case 3:
case "BlinkingFash":
return Led.BlinkingFash;
case -1:
case "UNRECOGNIZED":
default:
return Led.UNRECOGNIZED;
}
}
export function ledToJSON(object: Led): string {
switch (object) {
case Led.Off:
return "Off";
case Led.On:
return "On";
case Led.BlinkingSlow:
return "BlinkingSlow";
case Led.BlinkingFash:
return "BlinkingFash";
default:
return "UNKNOWN";
}
}
export interface Leds {
green: Led;
amber: Led;
blue: Led;
red: Led;
}
export interface Temperatures {
board: number;
cellsCenter: number;
cellsLateral1: number;
cellsLateral2: number;
heaterPowerCenterPct: number;
heaterPowerLateralPct: number;
}
export interface BatteryStatus48TL {
nodeId: number;
soc: number;
cellsVoltage: number;
cellsCurrent: number;
busVoltage: number;
temperature: number;
leds: Leds | undefined;
temperatures: Temperatures | undefined;
warnings: Warnings[];
alarms: Alarms[];
ioStatus: IoStatus[];
}
function createBaseLeds(): Leds {
return { green: 0, amber: 0, blue: 0, red: 0 };
}
export const Leds = {
encode(message: Leds, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
if (message.green !== 0) {
writer.uint32(8).int32(message.green);
}
if (message.amber !== 0) {
writer.uint32(16).int32(message.amber);
}
if (message.blue !== 0) {
writer.uint32(24).int32(message.blue);
}
if (message.red !== 0) {
writer.uint32(32).int32(message.red);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Leds {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseLeds();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.green = reader.int32() as any;
break;
case 2:
message.amber = reader.int32() as any;
break;
case 3:
message.blue = reader.int32() as any;
break;
case 4:
message.red = reader.int32() as any;
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Leds {
return {
green: isSet(object.green) ? ledFromJSON(object.green) : 0,
amber: isSet(object.amber) ? ledFromJSON(object.amber) : 0,
blue: isSet(object.blue) ? ledFromJSON(object.blue) : 0,
red: isSet(object.red) ? ledFromJSON(object.red) : 0,
};
},
toJSON(message: Leds): unknown {
const obj: any = {};
message.green !== undefined && (obj.green = ledToJSON(message.green));
message.amber !== undefined && (obj.amber = ledToJSON(message.amber));
message.blue !== undefined && (obj.blue = ledToJSON(message.blue));
message.red !== undefined && (obj.red = ledToJSON(message.red));
return obj;
},
fromPartial<I extends Exact<DeepPartial<Leds>, I>>(object: I): Leds {
const message = createBaseLeds();
message.green = object.green ?? 0;
message.amber = object.amber ?? 0;
message.blue = object.blue ?? 0;
message.red = object.red ?? 0;
return message;
},
};
function createBaseTemperatures(): Temperatures {
return {
board: 0,
cellsCenter: 0,
cellsLateral1: 0,
cellsLateral2: 0,
heaterPowerCenterPct: 0,
heaterPowerLateralPct: 0,
};
}
export const Temperatures = {
encode(
message: Temperatures,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.board !== 0) {
writer.uint32(13).float(message.board);
}
if (message.cellsCenter !== 0) {
writer.uint32(21).float(message.cellsCenter);
}
if (message.cellsLateral1 !== 0) {
writer.uint32(29).float(message.cellsLateral1);
}
if (message.cellsLateral2 !== 0) {
writer.uint32(37).float(message.cellsLateral2);
}
if (message.heaterPowerCenterPct !== 0) {
writer.uint32(45).float(message.heaterPowerCenterPct);
}
if (message.heaterPowerLateralPct !== 0) {
writer.uint32(53).float(message.heaterPowerLateralPct);
}
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): Temperatures {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseTemperatures();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.board = reader.float();
break;
case 2:
message.cellsCenter = reader.float();
break;
case 3:
message.cellsLateral1 = reader.float();
break;
case 4:
message.cellsLateral2 = reader.float();
break;
case 5:
message.heaterPowerCenterPct = reader.float();
break;
case 6:
message.heaterPowerLateralPct = reader.float();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Temperatures {
return {
board: isSet(object.board) ? Number(object.board) : 0,
cellsCenter: isSet(object.cellsCenter) ? Number(object.cellsCenter) : 0,
cellsLateral1: isSet(object.cellsLateral1)
? Number(object.cellsLateral1)
: 0,
cellsLateral2: isSet(object.cellsLateral2)
? Number(object.cellsLateral2)
: 0,
heaterPowerCenterPct: isSet(object.heaterPowerCenterPct)
? Number(object.heaterPowerCenterPct)
: 0,
heaterPowerLateralPct: isSet(object.heaterPowerLateralPct)
? Number(object.heaterPowerLateralPct)
: 0,
};
},
toJSON(message: Temperatures): unknown {
const obj: any = {};
message.board !== undefined && (obj.board = message.board);
message.cellsCenter !== undefined &&
(obj.cellsCenter = message.cellsCenter);
message.cellsLateral1 !== undefined &&
(obj.cellsLateral1 = message.cellsLateral1);
message.cellsLateral2 !== undefined &&
(obj.cellsLateral2 = message.cellsLateral2);
message.heaterPowerCenterPct !== undefined &&
(obj.heaterPowerCenterPct = message.heaterPowerCenterPct);
message.heaterPowerLateralPct !== undefined &&
(obj.heaterPowerLateralPct = message.heaterPowerLateralPct);
return obj;
},
fromPartial<I extends Exact<DeepPartial<Temperatures>, I>>(
object: I
): Temperatures {
const message = createBaseTemperatures();
message.board = object.board ?? 0;
message.cellsCenter = object.cellsCenter ?? 0;
message.cellsLateral1 = object.cellsLateral1 ?? 0;
message.cellsLateral2 = object.cellsLateral2 ?? 0;
message.heaterPowerCenterPct = object.heaterPowerCenterPct ?? 0;
message.heaterPowerLateralPct = object.heaterPowerLateralPct ?? 0;
return message;
},
};
function createBaseBatteryStatus48TL(): BatteryStatus48TL {
return {
nodeId: 0,
soc: 0,
cellsVoltage: 0,
cellsCurrent: 0,
busVoltage: 0,
temperature: 0,
leds: undefined,
temperatures: undefined,
warnings: [],
alarms: [],
ioStatus: [],
};
}
export const BatteryStatus48TL = {
encode(
message: BatteryStatus48TL,
writer: _m0.Writer = _m0.Writer.create()
): _m0.Writer {
if (message.nodeId !== 0) {
writer.uint32(8).int32(message.nodeId);
}
if (message.soc !== 0) {
writer.uint32(21).float(message.soc);
}
if (message.cellsVoltage !== 0) {
writer.uint32(29).float(message.cellsVoltage);
}
if (message.cellsCurrent !== 0) {
writer.uint32(37).float(message.cellsCurrent);
}
if (message.busVoltage !== 0) {
writer.uint32(45).float(message.busVoltage);
}
if (message.temperature !== 0) {
writer.uint32(53).float(message.temperature);
}
if (message.leds !== undefined) {
Leds.encode(message.leds, writer.uint32(58).fork()).ldelim();
}
if (message.temperatures !== undefined) {
Temperatures.encode(
message.temperatures,
writer.uint32(66).fork()
).ldelim();
}
writer.uint32(74).fork();
for (const v of message.warnings) {
writer.int32(v);
}
writer.ldelim();
writer.uint32(82).fork();
for (const v of message.alarms) {
writer.int32(v);
}
writer.ldelim();
writer.uint32(90).fork();
for (const v of message.ioStatus) {
writer.int32(v);
}
writer.ldelim();
return writer;
},
decode(input: _m0.Reader | Uint8Array, length?: number): BatteryStatus48TL {
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
let end = length === undefined ? reader.len : reader.pos + length;
const message = createBaseBatteryStatus48TL();
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.nodeId = reader.int32();
break;
case 2:
message.soc = reader.float();
break;
case 3:
message.cellsVoltage = reader.float();
break;
case 4:
message.cellsCurrent = reader.float();
break;
case 5:
message.busVoltage = reader.float();
break;
case 6:
message.temperature = reader.float();
break;
case 7:
message.leds = Leds.decode(reader, reader.uint32());
break;
case 8:
message.temperatures = Temperatures.decode(reader, reader.uint32());
break;
case 9:
if ((tag & 7) === 2) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.warnings.push(reader.int32() as any);
}
} else {
message.warnings.push(reader.int32() as any);
}
break;
case 10:
if ((tag & 7) === 2) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.alarms.push(reader.int32() as any);
}
} else {
message.alarms.push(reader.int32() as any);
}
break;
case 11:
if ((tag & 7) === 2) {
const end2 = reader.uint32() + reader.pos;
while (reader.pos < end2) {
message.ioStatus.push(reader.int32() as any);
}
} else {
message.ioStatus.push(reader.int32() as any);
}
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): BatteryStatus48TL {
return {
nodeId: isSet(object.nodeId) ? Number(object.nodeId) : 0,
soc: isSet(object.soc) ? Number(object.soc) : 0,
cellsVoltage: isSet(object.cellsVoltage)
? Number(object.cellsVoltage)
: 0,
cellsCurrent: isSet(object.cellsCurrent)
? Number(object.cellsCurrent)
: 0,
busVoltage: isSet(object.busVoltage) ? Number(object.busVoltage) : 0,
temperature: isSet(object.temperature) ? Number(object.temperature) : 0,
leds: isSet(object.leds) ? Leds.fromJSON(object.leds) : undefined,
temperatures: isSet(object.temperatures)
? Temperatures.fromJSON(object.temperatures)
: undefined,
warnings: Array.isArray(object?.warnings)
? object.warnings.map((e: any) => warningsFromJSON(e))
: [],
alarms: Array.isArray(object?.alarms)
? object.alarms.map((e: any) => alarmsFromJSON(e))
: [],
ioStatus: Array.isArray(object?.ioStatus)
? object.ioStatus.map((e: any) => ioStatusFromJSON(e))
: [],
};
},
toJSON(message: BatteryStatus48TL): unknown {
const obj: any = {};
message.nodeId !== undefined && (obj.nodeId = Math.round(message.nodeId));
message.soc !== undefined && (obj.soc = message.soc);
message.cellsVoltage !== undefined &&
(obj.cellsVoltage = message.cellsVoltage);
message.cellsCurrent !== undefined &&
(obj.cellsCurrent = message.cellsCurrent);
message.busVoltage !== undefined && (obj.busVoltage = message.busVoltage);
message.temperature !== undefined &&
(obj.temperature = message.temperature);
message.leds !== undefined &&
(obj.leds = message.leds ? Leds.toJSON(message.leds) : undefined);
message.temperatures !== undefined &&
(obj.temperatures = message.temperatures
? Temperatures.toJSON(message.temperatures)
: undefined);
if (message.warnings) {
obj.warnings = message.warnings.map((e) => warningsToJSON(e));
} else {
obj.warnings = [];
}
if (message.alarms) {
obj.alarms = message.alarms.map((e) => alarmsToJSON(e));
} else {
obj.alarms = [];
}
if (message.ioStatus) {
obj.ioStatus = message.ioStatus.map((e) => ioStatusToJSON(e));
} else {
obj.ioStatus = [];
}
return obj;
},
fromPartial<I extends Exact<DeepPartial<BatteryStatus48TL>, I>>(
object: I
): BatteryStatus48TL {
const message = createBaseBatteryStatus48TL();
message.nodeId = object.nodeId ?? 0;
message.soc = object.soc ?? 0;
message.cellsVoltage = object.cellsVoltage ?? 0;
message.cellsCurrent = object.cellsCurrent ?? 0;
message.busVoltage = object.busVoltage ?? 0;
message.temperature = object.temperature ?? 0;
message.leds =
object.leds !== undefined && object.leds !== null
? Leds.fromPartial(object.leds)
: undefined;
message.temperatures =
object.temperatures !== undefined && object.temperatures !== null
? Temperatures.fromPartial(object.temperatures)
: undefined;
message.warnings = object.warnings?.map((e) => e) || [];
message.alarms = object.alarms?.map((e) => e) || [];
message.ioStatus = object.ioStatus?.map((e) => e) || [];
return message;
},
};
type Builtin =
| Date
| Function
| Uint8Array
| string
| number
| boolean
| undefined;
export type DeepPartial<T> = T extends Builtin
? T
: T extends Array<infer U>
? Array<DeepPartial<U>>
: T extends ReadonlyArray<infer U>
? ReadonlyArray<DeepPartial<U>>
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
type KeysOfUnion<T> = T extends T ? keyof T : never;
export type Exact<P, I extends P> = P extends Builtin
? P
: P & { [K in keyof P]: Exact<P[K], I[K]> } & Record<
Exclude<keyof I, KeysOfUnion<P>>,
never
>;
if (_m0.util.Long !== Long) {
_m0.util.Long = Long as any;
_m0.configure();
}
function isSet(value: any): boolean {
return value !== null && value !== undefined;
}