@kvaser/canking-api
Version:
CanKing API to communicate with the CanKing service using Node.js.
1,594 lines • 204 kB
JavaScript
function Vn() {
let e = 0, n = 0;
for (let t = 0; t < 28; t += 7) {
let a = this.buf[this.pos++];
if (e |= (a & 127) << t, !(a & 128))
return this.assertBounds(), [e, n];
}
let i = this.buf[this.pos++];
if (e |= (i & 15) << 28, n = (i & 112) >> 4, !(i & 128))
return this.assertBounds(), [e, n];
for (let t = 3; t <= 31; t += 7) {
let a = this.buf[this.pos++];
if (n |= (a & 127) << t, !(a & 128))
return this.assertBounds(), [e, n];
}
throw new Error("invalid varint");
}
function se(e, n, i) {
for (let r = 0; r < 28; r = r + 7) {
const d = e >>> r, N = !(!(d >>> 7) && n == 0), O = (N ? d | 128 : d) & 255;
if (i.push(O), !N)
return;
}
const t = e >>> 28 & 15 | (n & 7) << 4, a = !!(n >> 3);
if (i.push((a ? t | 128 : t) & 255), !!a) {
for (let r = 3; r < 31; r = r + 7) {
const d = n >>> r, N = !!(d >>> 7), O = (N ? d | 128 : d) & 255;
if (i.push(O), !N)
return;
}
i.push(n >>> 31 & 1);
}
}
const re = 4294967296;
function Ne(e) {
const n = e[0] === "-";
n && (e = e.slice(1));
const i = 1e6;
let t = 0, a = 0;
function r(d, N) {
const O = Number(e.slice(d, N));
a *= i, t = t * i + O, t >= re && (a = a + (t / re | 0), t = t % re);
}
return r(-24, -18), r(-18, -12), r(-12, -6), r(-6), n ? pn(t, a) : ce(t, a);
}
function Un(e, n) {
let i = ce(e, n);
const t = i.hi & 2147483648;
t && (i = pn(i.lo, i.hi));
const a = mn(i.lo, i.hi);
return t ? "-" + a : a;
}
function mn(e, n) {
if ({ lo: e, hi: n } = xn(e, n), n <= 2097151)
return String(re * n + e);
const i = e & 16777215, t = (e >>> 24 | n << 8) & 16777215, a = n >> 16 & 65535;
let r = i + t * 6777216 + a * 6710656, d = t + a * 8147497, N = a * 2;
const O = 1e7;
return r >= O && (d += Math.floor(r / O), r %= O), d >= O && (N += Math.floor(d / O), d %= O), N.toString() + _e(d) + _e(r);
}
function xn(e, n) {
return { lo: e >>> 0, hi: n >>> 0 };
}
function ce(e, n) {
return { lo: e | 0, hi: n | 0 };
}
function pn(e, n) {
return n = ~n, e ? e = ~e + 1 : n += 1, ce(e, n);
}
const _e = (e) => {
const n = String(e);
return "0000000".slice(n.length) + n;
};
function Ee(e, n) {
if (e >= 0) {
for (; e > 127; )
n.push(e & 127 | 128), e = e >>> 7;
n.push(e);
} else {
for (let i = 0; i < 9; i++)
n.push(e & 127 | 128), e = e >> 7;
n.push(1);
}
}
function Jn() {
let e = this.buf[this.pos++], n = e & 127;
if (!(e & 128))
return this.assertBounds(), n;
if (e = this.buf[this.pos++], n |= (e & 127) << 7, !(e & 128))
return this.assertBounds(), n;
if (e = this.buf[this.pos++], n |= (e & 127) << 14, !(e & 128))
return this.assertBounds(), n;
if (e = this.buf[this.pos++], n |= (e & 127) << 21, !(e & 128))
return this.assertBounds(), n;
e = this.buf[this.pos++], n |= (e & 15) << 28;
for (let i = 5; e & 128 && i < 10; i++)
e = this.buf[this.pos++];
if (e & 128)
throw new Error("invalid varint");
return this.assertBounds(), n >>> 0;
}
const M = /* @__PURE__ */ wn();
function wn() {
const e = new DataView(new ArrayBuffer(8));
if (typeof BigInt == "function" && typeof e.getBigInt64 == "function" && typeof e.getBigUint64 == "function" && typeof e.setBigInt64 == "function" && typeof e.setBigUint64 == "function" && (typeof process != "object" || typeof process.env != "object" || process.env.BUF_BIGINT_DISABLE !== "1")) {
const i = BigInt("-9223372036854775808"), t = BigInt("9223372036854775807"), a = BigInt("0"), r = BigInt("18446744073709551615");
return {
zero: BigInt(0),
supported: !0,
parse(d) {
const N = typeof d == "bigint" ? d : BigInt(d);
if (N > t || N < i)
throw new Error(`invalid int64: ${d}`);
return N;
},
uParse(d) {
const N = typeof d == "bigint" ? d : BigInt(d);
if (N > r || N < a)
throw new Error(`invalid uint64: ${d}`);
return N;
},
enc(d) {
return e.setBigInt64(0, this.parse(d), !0), {
lo: e.getInt32(0, !0),
hi: e.getInt32(4, !0)
};
},
uEnc(d) {
return e.setBigInt64(0, this.uParse(d), !0), {
lo: e.getInt32(0, !0),
hi: e.getInt32(4, !0)
};
},
dec(d, N) {
return e.setInt32(0, d, !0), e.setInt32(4, N, !0), e.getBigInt64(0, !0);
},
uDec(d, N) {
return e.setInt32(0, d, !0), e.setInt32(4, N, !0), e.getBigUint64(0, !0);
}
};
}
return {
zero: "0",
supported: !1,
parse(i) {
return typeof i != "string" && (i = i.toString()), Ae(i), i;
},
uParse(i) {
return typeof i != "string" && (i = i.toString()), Se(i), i;
},
enc(i) {
return typeof i != "string" && (i = i.toString()), Ae(i), Ne(i);
},
uEnc(i) {
return typeof i != "string" && (i = i.toString()), Se(i), Ne(i);
},
dec(i, t) {
return Un(i, t);
},
uDec(i, t) {
return mn(i, t);
}
};
}
function Ae(e) {
if (!/^-?[0-9]+$/.test(e))
throw new Error("invalid int64: " + e);
}
function Se(e) {
if (!/^[0-9]+$/.test(e))
throw new Error("invalid uint64: " + e);
}
const ue = Symbol.for("@bufbuild/protobuf/text-encoding");
function Cn() {
if (globalThis[ue] == null) {
const e = new globalThis.TextEncoder(), n = new globalThis.TextDecoder();
globalThis[ue] = {
encodeUtf8(i) {
return e.encode(i);
},
decodeUtf8(i) {
return n.decode(i);
},
checkUtf8(i) {
try {
return encodeURIComponent(i), !0;
} catch {
return !1;
}
}
};
}
return globalThis[ue];
}
var P;
(function(e) {
e[e.Varint = 0] = "Varint", e[e.Bit64 = 1] = "Bit64", e[e.LengthDelimited = 2] = "LengthDelimited", e[e.StartGroup = 3] = "StartGroup", e[e.EndGroup = 4] = "EndGroup", e[e.Bit32 = 5] = "Bit32";
})(P || (P = {}));
const Hn = 34028234663852886e22, zn = -34028234663852886e22, Qn = 4294967295, Xn = 2147483647, qn = -2147483648;
class o {
constructor(n = Cn().encodeUtf8) {
this.encodeUtf8 = n, this.stack = [], this.chunks = [], this.buf = [];
}
/**
* Return all bytes written and reset this writer.
*/
finish() {
this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []);
let n = 0;
for (let a = 0; a < this.chunks.length; a++)
n += this.chunks[a].length;
let i = new Uint8Array(n), t = 0;
for (let a = 0; a < this.chunks.length; a++)
i.set(this.chunks[a], t), t += this.chunks[a].length;
return this.chunks = [], i;
}
/**
* Start a new fork for length-delimited data like a message
* or a packed repeated field.
*
* Must be joined later with `join()`.
*/
fork() {
return this.stack.push({ chunks: this.chunks, buf: this.buf }), this.chunks = [], this.buf = [], this;
}
/**
* Join the last fork. Write its length and bytes, then
* return to the previous state.
*/
join() {
let n = this.finish(), i = this.stack.pop();
if (!i)
throw new Error("invalid state, fork stack empty");
return this.chunks = i.chunks, this.buf = i.buf, this.uint32(n.byteLength), this.raw(n);
}
/**
* Writes a tag (field number and wire type).
*
* Equivalent to `uint32( (fieldNo << 3 | type) >>> 0 )`.
*
* Generated code should compute the tag ahead of time and call `uint32()`.
*/
tag(n, i) {
return this.uint32((n << 3 | i) >>> 0);
}
/**
* Write a chunk of raw bytes.
*/
raw(n) {
return this.buf.length && (this.chunks.push(new Uint8Array(this.buf)), this.buf = []), this.chunks.push(n), this;
}
/**
* Write a `uint32` value, an unsigned 32 bit varint.
*/
uint32(n) {
for (Re(n); n > 127; )
this.buf.push(n & 127 | 128), n = n >>> 7;
return this.buf.push(n), this;
}
/**
* Write a `int32` value, a signed 32 bit varint.
*/
int32(n) {
return de(n), Ee(n, this.buf), this;
}
/**
* Write a `bool` value, a variant.
*/
bool(n) {
return this.buf.push(n ? 1 : 0), this;
}
/**
* Write a `bytes` value, length-delimited arbitrary data.
*/
bytes(n) {
return this.uint32(n.byteLength), this.raw(n);
}
/**
* Write a `string` value, length-delimited data converted to UTF-8 text.
*/
string(n) {
let i = this.encodeUtf8(n);
return this.uint32(i.byteLength), this.raw(i);
}
/**
* Write a `float` value, 32-bit floating point number.
*/
float(n) {
Zn(n);
let i = new Uint8Array(4);
return new DataView(i.buffer).setFloat32(0, n, !0), this.raw(i);
}
/**
* Write a `double` value, a 64-bit floating point number.
*/
double(n) {
let i = new Uint8Array(8);
return new DataView(i.buffer).setFloat64(0, n, !0), this.raw(i);
}
/**
* Write a `fixed32` value, an unsigned, fixed-length 32-bit integer.
*/
fixed32(n) {
Re(n);
let i = new Uint8Array(4);
return new DataView(i.buffer).setUint32(0, n, !0), this.raw(i);
}
/**
* Write a `sfixed32` value, a signed, fixed-length 32-bit integer.
*/
sfixed32(n) {
de(n);
let i = new Uint8Array(4);
return new DataView(i.buffer).setInt32(0, n, !0), this.raw(i);
}
/**
* Write a `sint32` value, a signed, zigzag-encoded 32-bit varint.
*/
sint32(n) {
return de(n), n = (n << 1 ^ n >> 31) >>> 0, Ee(n, this.buf), this;
}
/**
* Write a `fixed64` value, a signed, fixed-length 64-bit integer.
*/
sfixed64(n) {
let i = new Uint8Array(8), t = new DataView(i.buffer), a = M.enc(n);
return t.setInt32(0, a.lo, !0), t.setInt32(4, a.hi, !0), this.raw(i);
}
/**
* Write a `fixed64` value, an unsigned, fixed-length 64 bit integer.
*/
fixed64(n) {
let i = new Uint8Array(8), t = new DataView(i.buffer), a = M.uEnc(n);
return t.setInt32(0, a.lo, !0), t.setInt32(4, a.hi, !0), this.raw(i);
}
/**
* Write a `int64` value, a signed 64-bit varint.
*/
int64(n) {
let i = M.enc(n);
return se(i.lo, i.hi, this.buf), this;
}
/**
* Write a `sint64` value, a signed, zig-zag-encoded 64-bit varint.
*/
sint64(n) {
let i = M.enc(n), t = i.hi >> 31, a = i.lo << 1 ^ t, r = (i.hi << 1 | i.lo >>> 31) ^ t;
return se(a, r, this.buf), this;
}
/**
* Write a `uint64` value, an unsigned 64-bit varint.
*/
uint64(n) {
let i = M.uEnc(n);
return se(i.lo, i.hi, this.buf), this;
}
}
class u {
constructor(n, i = Cn().decodeUtf8) {
this.decodeUtf8 = i, this.varint64 = Vn, this.uint32 = Jn, this.buf = n, this.len = n.length, this.pos = 0, this.view = new DataView(n.buffer, n.byteOffset, n.byteLength);
}
/**
* Reads a tag - field number and wire type.
*/
tag() {
let n = this.uint32(), i = n >>> 3, t = n & 7;
if (i <= 0 || t < 0 || t > 5)
throw new Error("illegal tag: field no " + i + " wire type " + t);
return [i, t];
}
/**
* Skip one element and return the skipped data.
*
* When skipping StartGroup, provide the tags field number to check for
* matching field number in the EndGroup tag.
*/
skip(n, i) {
let t = this.pos;
switch (n) {
case P.Varint:
for (; this.buf[this.pos++] & 128; )
;
break;
case P.Bit64:
this.pos += 4;
case P.Bit32:
this.pos += 4;
break;
case P.LengthDelimited:
let a = this.uint32();
this.pos += a;
break;
case P.StartGroup:
for (; ; ) {
const [r, d] = this.tag();
if (d === P.EndGroup) {
if (i !== void 0 && r !== i)
throw new Error("invalid end group tag");
break;
}
this.skip(d, r);
}
break;
default:
throw new Error("cant skip wire type " + n);
}
return this.assertBounds(), this.buf.subarray(t, this.pos);
}
/**
* Throws error if position in byte array is out of range.
*/
assertBounds() {
if (this.pos > this.len)
throw new RangeError("premature EOF");
}
/**
* Read a `int32` field, a signed 32 bit varint.
*/
int32() {
return this.uint32() | 0;
}
/**
* Read a `sint32` field, a signed, zigzag-encoded 32-bit varint.
*/
sint32() {
let n = this.uint32();
return n >>> 1 ^ -(n & 1);
}
/**
* Read a `int64` field, a signed 64-bit varint.
*/
int64() {
return M.dec(...this.varint64());
}
/**
* Read a `uint64` field, an unsigned 64-bit varint.
*/
uint64() {
return M.uDec(...this.varint64());
}
/**
* Read a `sint64` field, a signed, zig-zag-encoded 64-bit varint.
*/
sint64() {
let [n, i] = this.varint64(), t = -(n & 1);
return n = (n >>> 1 | (i & 1) << 31) ^ t, i = i >>> 1 ^ t, M.dec(n, i);
}
/**
* Read a `bool` field, a variant.
*/
bool() {
let [n, i] = this.varint64();
return n !== 0 || i !== 0;
}
/**
* Read a `fixed32` field, an unsigned, fixed-length 32-bit integer.
*/
fixed32() {
return this.view.getUint32((this.pos += 4) - 4, !0);
}
/**
* Read a `sfixed32` field, a signed, fixed-length 32-bit integer.
*/
sfixed32() {
return this.view.getInt32((this.pos += 4) - 4, !0);
}
/**
* Read a `fixed64` field, an unsigned, fixed-length 64 bit integer.
*/
fixed64() {
return M.uDec(this.sfixed32(), this.sfixed32());
}
/**
* Read a `fixed64` field, a signed, fixed-length 64-bit integer.
*/
sfixed64() {
return M.dec(this.sfixed32(), this.sfixed32());
}
/**
* Read a `float` field, 32-bit floating point number.
*/
float() {
return this.view.getFloat32((this.pos += 4) - 4, !0);
}
/**
* Read a `double` field, a 64-bit floating point number.
*/
double() {
return this.view.getFloat64((this.pos += 8) - 8, !0);
}
/**
* Read a `bytes` field, length-delimited arbitrary data.
*/
bytes() {
let n = this.uint32(), i = this.pos;
return this.pos += n, this.assertBounds(), this.buf.subarray(i, i + n);
}
/**
* Read a `string` field, length-delimited data converted to UTF-8 text.
*/
string() {
return this.decodeUtf8(this.bytes());
}
}
function de(e) {
if (typeof e == "string")
e = Number(e);
else if (typeof e != "number")
throw new Error("invalid int32: " + typeof e);
if (!Number.isInteger(e) || e > Xn || e < qn)
throw new Error("invalid int32: " + e);
}
function Re(e) {
if (typeof e == "string")
e = Number(e);
else if (typeof e != "number")
throw new Error("invalid uint32: " + typeof e);
if (!Number.isInteger(e) || e > Qn || e < 0)
throw new Error("invalid uint32: " + e);
}
function Zn(e) {
if (typeof e == "string") {
const n = e;
if (e = Number(e), isNaN(e) && n !== "NaN")
throw new Error("invalid float32: " + n);
} else if (typeof e != "number")
throw new Error("invalid float32: " + typeof e);
if (Number.isFinite(e) && (e > Hn || e < zn))
throw new Error("invalid float32: " + e);
}
function Oe() {
return { version: "", language: "", useHexNumericBase: !1, username: "" };
}
const E = {
encode(e, n = new o()) {
return e.version !== "" && n.uint32(10).string(e.version), e.language !== "" && n.uint32(18).string(e.language), e.useHexNumericBase !== !1 && n.uint32(24).bool(e.useHexNumericBase), e.username !== "" && n.uint32(34).string(e.username), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Oe();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.version = i.string();
continue;
}
case 2: {
if (r !== 18)
break;
a.language = i.string();
continue;
}
case 3: {
if (r !== 24)
break;
a.useHexNumericBase = i.bool();
continue;
}
case 4: {
if (r !== 34)
break;
a.username = i.string();
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
version: ie(e.version) ? globalThis.String(e.version) : "",
language: ie(e.language) ? globalThis.String(e.language) : "",
useHexNumericBase: ie(e.useHexNumericBase) ? globalThis.Boolean(e.useHexNumericBase) : !1,
username: ie(e.username) ? globalThis.String(e.username) : ""
};
},
toJSON(e) {
const n = {};
return e.version !== "" && (n.version = e.version), e.language !== "" && (n.language = e.language), e.useHexNumericBase !== !1 && (n.useHexNumericBase = e.useHexNumericBase), e.username !== "" && (n.username = e.username), n;
},
create(e) {
return E.fromPartial(e ?? {});
},
fromPartial(e) {
const n = Oe();
return n.version = e.version ?? "", n.language = e.language ?? "", n.useHexNumericBase = e.useHexNumericBase ?? !1, n.username = e.username ?? "", n;
}
};
function ie(e) {
return e != null;
}
var Yn = /* @__PURE__ */ ((e) => (e[e.CAN_CHANNEL_CAP_UNSPECIFIED = 0] = "CAN_CHANNEL_CAP_UNSPECIFIED", e[e.CAN_CHANNEL_CAP_EXTENDED_CAN = 1] = "CAN_CHANNEL_CAP_EXTENDED_CAN", e[e.CAN_CHANNEL_CAP_BUS_STATISTICS = 2] = "CAN_CHANNEL_CAP_BUS_STATISTICS", e[e.CAN_CHANNEL_CAP_ERROR_COUNTERS = 3] = "CAN_CHANNEL_CAP_ERROR_COUNTERS", e[e.CAN_CHANNEL_CAP_GENERATE_ERROR = 4] = "CAN_CHANNEL_CAP_GENERATE_ERROR", e[e.CAN_CHANNEL_CAP_GENERATE_OVERLOAD = 5] = "CAN_CHANNEL_CAP_GENERATE_OVERLOAD", e[e.CAN_CHANNEL_CAP_TXREQUEST = 6] = "CAN_CHANNEL_CAP_TXREQUEST", e[e.CAN_CHANNEL_CAP_TXACKNOWLEDGE = 7] = "CAN_CHANNEL_CAP_TXACKNOWLEDGE", e[e.CAN_CHANNEL_CAP_VIRTUAL = 8] = "CAN_CHANNEL_CAP_VIRTUAL", e[e.CAN_CHANNEL_CAP_SIMULATED = 9] = "CAN_CHANNEL_CAP_SIMULATED", e[e.CAN_CHANNEL_CAP_CAN_FD = 10] = "CAN_CHANNEL_CAP_CAN_FD", e[e.CAN_CHANNEL_CAP_CAN_FD_NONISO = 11] = "CAN_CHANNEL_CAP_CAN_FD_NONISO", e[e.CAN_CHANNEL_CAP_SILENT_MODE = 12] = "CAN_CHANNEL_CAP_SILENT_MODE", e[e.CAN_CHANNEL_CAP_SINGLE_SHOT = 13] = "CAN_CHANNEL_CAP_SINGLE_SHOT", e[e.CAN_CHANNEL_CAP_LOGGER = 14] = "CAN_CHANNEL_CAP_LOGGER", e[e.CAN_CHANNEL_CAP_REMOTE_ACCESS = 15] = "CAN_CHANNEL_CAP_REMOTE_ACCESS", e[e.CAN_CHANNEL_CAP_SCRIPT = 16] = "CAN_CHANNEL_CAP_SCRIPT", e[e.CAN_CHANNEL_CAP_LIN_HYBRID = 17] = "CAN_CHANNEL_CAP_LIN_HYBRID", e[e.CAN_CHANNEL_CAP_IO_API = 18] = "CAN_CHANNEL_CAP_IO_API", e[e.CAN_CHANNEL_CAP_CANTEGRITY = 19] = "CAN_CHANNEL_CAP_CANTEGRITY", e[e.CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ = 20] = "CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(Yn || {});
function Kn(e) {
switch (e) {
case 0:
case "CAN_CHANNEL_CAP_UNSPECIFIED":
return 0;
case 1:
case "CAN_CHANNEL_CAP_EXTENDED_CAN":
return 1;
case 2:
case "CAN_CHANNEL_CAP_BUS_STATISTICS":
return 2;
case 3:
case "CAN_CHANNEL_CAP_ERROR_COUNTERS":
return 3;
case 4:
case "CAN_CHANNEL_CAP_GENERATE_ERROR":
return 4;
case 5:
case "CAN_CHANNEL_CAP_GENERATE_OVERLOAD":
return 5;
case 6:
case "CAN_CHANNEL_CAP_TXREQUEST":
return 6;
case 7:
case "CAN_CHANNEL_CAP_TXACKNOWLEDGE":
return 7;
case 8:
case "CAN_CHANNEL_CAP_VIRTUAL":
return 8;
case 9:
case "CAN_CHANNEL_CAP_SIMULATED":
return 9;
case 10:
case "CAN_CHANNEL_CAP_CAN_FD":
return 10;
case 11:
case "CAN_CHANNEL_CAP_CAN_FD_NONISO":
return 11;
case 12:
case "CAN_CHANNEL_CAP_SILENT_MODE":
return 12;
case 13:
case "CAN_CHANNEL_CAP_SINGLE_SHOT":
return 13;
case 14:
case "CAN_CHANNEL_CAP_LOGGER":
return 14;
case 15:
case "CAN_CHANNEL_CAP_REMOTE_ACCESS":
return 15;
case 16:
case "CAN_CHANNEL_CAP_SCRIPT":
return 16;
case 17:
case "CAN_CHANNEL_CAP_LIN_HYBRID":
return 17;
case 18:
case "CAN_CHANNEL_CAP_IO_API":
return 18;
case 19:
case "CAN_CHANNEL_CAP_CANTEGRITY":
return 19;
case 20:
case "CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ":
return 20;
case -1:
case "UNRECOGNIZED":
default:
return -1;
}
}
function Wn(e) {
switch (e) {
case 0:
return "CAN_CHANNEL_CAP_UNSPECIFIED";
case 1:
return "CAN_CHANNEL_CAP_EXTENDED_CAN";
case 2:
return "CAN_CHANNEL_CAP_BUS_STATISTICS";
case 3:
return "CAN_CHANNEL_CAP_ERROR_COUNTERS";
case 4:
return "CAN_CHANNEL_CAP_GENERATE_ERROR";
case 5:
return "CAN_CHANNEL_CAP_GENERATE_OVERLOAD";
case 6:
return "CAN_CHANNEL_CAP_TXREQUEST";
case 7:
return "CAN_CHANNEL_CAP_TXACKNOWLEDGE";
case 8:
return "CAN_CHANNEL_CAP_VIRTUAL";
case 9:
return "CAN_CHANNEL_CAP_SIMULATED";
case 10:
return "CAN_CHANNEL_CAP_CAN_FD";
case 11:
return "CAN_CHANNEL_CAP_CAN_FD_NONISO";
case 12:
return "CAN_CHANNEL_CAP_SILENT_MODE";
case 13:
return "CAN_CHANNEL_CAP_SINGLE_SHOT";
case 14:
return "CAN_CHANNEL_CAP_LOGGER";
case 15:
return "CAN_CHANNEL_CAP_REMOTE_ACCESS";
case 16:
return "CAN_CHANNEL_CAP_SCRIPT";
case 17:
return "CAN_CHANNEL_CAP_LIN_HYBRID";
case 18:
return "CAN_CHANNEL_CAP_IO_API";
case 19:
return "CAN_CHANNEL_CAP_CANTEGRITY";
case 20:
return "CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ";
case -1:
default:
return "UNRECOGNIZED";
}
}
var $n = /* @__PURE__ */ ((e) => (e[e.PROTOCOLS_UNSPECIFIED = 0] = "PROTOCOLS_UNSPECIFIED", e[e.PROTOCOLS_CAN = 1] = "PROTOCOLS_CAN", e[e.PROTOCOLS_LIN = 2] = "PROTOCOLS_LIN", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))($n || {});
function Fn(e) {
switch (e) {
case 0:
case "PROTOCOLS_UNSPECIFIED":
return 0;
case 1:
case "PROTOCOLS_CAN":
return 1;
case 2:
case "PROTOCOLS_LIN":
return 2;
case -1:
case "UNRECOGNIZED":
default:
return -1;
}
}
function Mn(e) {
switch (e) {
case 0:
return "PROTOCOLS_UNSPECIFIED";
case 1:
return "PROTOCOLS_CAN";
case 2:
return "PROTOCOLS_LIN";
case -1:
default:
return "UNRECOGNIZED";
}
}
var jn = /* @__PURE__ */ ((e) => (e[e.DEVICE_EVENT_UNSPECIFIED = 0] = "DEVICE_EVENT_UNSPECIFIED", e[e.DEVICE_EVENT_DEVICES_CHANGED = 1] = "DEVICE_EVENT_DEVICES_CHANGED", e[e.UNRECOGNIZED = -1] = "UNRECOGNIZED", e))(jn || {});
function ei(e) {
switch (e) {
case 0:
case "DEVICE_EVENT_UNSPECIFIED":
return 0;
case 1:
case "DEVICE_EVENT_DEVICES_CHANGED":
return 1;
case -1:
case "UNRECOGNIZED":
default:
return -1;
}
}
function ni(e) {
switch (e) {
case 0:
return "DEVICE_EVENT_UNSPECIFIED";
case 1:
return "DEVICE_EVENT_DEVICES_CHANGED";
case -1:
default:
return "UNRECOGNIZED";
}
}
function Te() {
return { tq: 0, phase1: 0, phase2: 0, sjw: 0, prop: 0, prescaler: 0 };
}
const l = {
encode(e, n = new o()) {
return e.tq !== 0 && n.uint32(8).int32(e.tq), e.phase1 !== 0 && n.uint32(16).int32(e.phase1), e.phase2 !== 0 && n.uint32(24).int32(e.phase2), e.sjw !== 0 && n.uint32(32).int32(e.sjw), e.prop !== 0 && n.uint32(40).int32(e.prop), e.prescaler !== 0 && n.uint32(48).int32(e.prescaler), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Te();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 8)
break;
a.tq = i.int32();
continue;
}
case 2: {
if (r !== 16)
break;
a.phase1 = i.int32();
continue;
}
case 3: {
if (r !== 24)
break;
a.phase2 = i.int32();
continue;
}
case 4: {
if (r !== 32)
break;
a.sjw = i.int32();
continue;
}
case 5: {
if (r !== 40)
break;
a.prop = i.int32();
continue;
}
case 6: {
if (r !== 48)
break;
a.prescaler = i.int32();
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
tq: f(e.tq) ? globalThis.Number(e.tq) : 0,
phase1: f(e.phase1) ? globalThis.Number(e.phase1) : 0,
phase2: f(e.phase2) ? globalThis.Number(e.phase2) : 0,
sjw: f(e.sjw) ? globalThis.Number(e.sjw) : 0,
prop: f(e.prop) ? globalThis.Number(e.prop) : 0,
prescaler: f(e.prescaler) ? globalThis.Number(e.prescaler) : 0
};
},
toJSON(e) {
const n = {};
return e.tq !== 0 && (n.tq = Math.round(e.tq)), e.phase1 !== 0 && (n.phase1 = Math.round(e.phase1)), e.phase2 !== 0 && (n.phase2 = Math.round(e.phase2)), e.sjw !== 0 && (n.sjw = Math.round(e.sjw)), e.prop !== 0 && (n.prop = Math.round(e.prop)), e.prescaler !== 0 && (n.prescaler = Math.round(e.prescaler)), n;
},
create(e) {
return l.fromPartial(e ?? {});
},
fromPartial(e) {
const n = Te();
return n.tq = e.tq ?? 0, n.phase1 = e.phase1 ?? 0, n.phase2 = e.phase2 ?? 0, n.sjw = e.sjw ?? 0, n.prop = e.prop ?? 0, n.prescaler = e.prescaler ?? 0, n;
}
};
function he() {
return {
arbitrationMin: void 0,
arbitrationMax: void 0,
dataMin: void 0,
dataMax: void 0,
isValid: !1
};
}
const g = {
encode(e, n = new o()) {
return e.arbitrationMin !== void 0 && l.encode(e.arbitrationMin, n.uint32(10).fork()).join(), e.arbitrationMax !== void 0 && l.encode(e.arbitrationMax, n.uint32(18).fork()).join(), e.dataMin !== void 0 && l.encode(e.dataMin, n.uint32(26).fork()).join(), e.dataMax !== void 0 && l.encode(e.dataMax, n.uint32(34).fork()).join(), e.isValid !== !1 && n.uint32(40).bool(e.isValid), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = he();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.arbitrationMin = l.decode(i, i.uint32());
continue;
}
case 2: {
if (r !== 18)
break;
a.arbitrationMax = l.decode(i, i.uint32());
continue;
}
case 3: {
if (r !== 26)
break;
a.dataMin = l.decode(i, i.uint32());
continue;
}
case 4: {
if (r !== 34)
break;
a.dataMax = l.decode(i, i.uint32());
continue;
}
case 5: {
if (r !== 40)
break;
a.isValid = i.bool();
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
arbitrationMin: f(e.arbitrationMin) ? l.fromJSON(e.arbitrationMin) : void 0,
arbitrationMax: f(e.arbitrationMax) ? l.fromJSON(e.arbitrationMax) : void 0,
dataMin: f(e.dataMin) ? l.fromJSON(e.dataMin) : void 0,
dataMax: f(e.dataMax) ? l.fromJSON(e.dataMax) : void 0,
isValid: f(e.isValid) ? globalThis.Boolean(e.isValid) : !1
};
},
toJSON(e) {
const n = {};
return e.arbitrationMin !== void 0 && (n.arbitrationMin = l.toJSON(e.arbitrationMin)), e.arbitrationMax !== void 0 && (n.arbitrationMax = l.toJSON(e.arbitrationMax)), e.dataMin !== void 0 && (n.dataMin = l.toJSON(e.dataMin)), e.dataMax !== void 0 && (n.dataMax = l.toJSON(e.dataMax)), e.isValid !== !1 && (n.isValid = e.isValid), n;
},
create(e) {
return g.fromPartial(e ?? {});
},
fromPartial(e) {
const n = he();
return n.arbitrationMin = e.arbitrationMin !== void 0 && e.arbitrationMin !== null ? l.fromPartial(e.arbitrationMin) : void 0, n.arbitrationMax = e.arbitrationMax !== void 0 && e.arbitrationMax !== null ? l.fromPartial(e.arbitrationMax) : void 0, n.dataMin = e.dataMin !== void 0 && e.dataMin !== null ? l.fromPartial(e.dataMin) : void 0, n.dataMax = e.dataMax !== void 0 && e.dataMax !== null ? l.fromPartial(e.dataMax) : void 0, n.isValid = e.isValid ?? !1, n;
}
};
function Ie() {
return { bitRate: 0, actualBitRate: 0, bitRateError: 0, samplePoint: 0, description: "", busParams: void 0 };
}
const h = {
encode(e, n = new o()) {
return e.bitRate !== 0 && n.uint32(8).int32(e.bitRate), e.actualBitRate !== 0 && n.uint32(16).int32(e.actualBitRate), e.bitRateError !== 0 && n.uint32(25).double(e.bitRateError), e.samplePoint !== 0 && n.uint32(33).double(e.samplePoint), e.description !== "" && n.uint32(42).string(e.description), e.busParams !== void 0 && l.encode(e.busParams, n.uint32(50).fork()).join(), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Ie();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 8)
break;
a.bitRate = i.int32();
continue;
}
case 2: {
if (r !== 16)
break;
a.actualBitRate = i.int32();
continue;
}
case 3: {
if (r !== 25)
break;
a.bitRateError = i.double();
continue;
}
case 4: {
if (r !== 33)
break;
a.samplePoint = i.double();
continue;
}
case 5: {
if (r !== 42)
break;
a.description = i.string();
continue;
}
case 6: {
if (r !== 50)
break;
a.busParams = l.decode(i, i.uint32());
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
bitRate: f(e.bitRate) ? globalThis.Number(e.bitRate) : 0,
actualBitRate: f(e.actualBitRate) ? globalThis.Number(e.actualBitRate) : 0,
bitRateError: f(e.bitRateError) ? globalThis.Number(e.bitRateError) : 0,
samplePoint: f(e.samplePoint) ? globalThis.Number(e.samplePoint) : 0,
description: f(e.description) ? globalThis.String(e.description) : "",
busParams: f(e.busParams) ? l.fromJSON(e.busParams) : void 0
};
},
toJSON(e) {
const n = {};
return e.bitRate !== 0 && (n.bitRate = Math.round(e.bitRate)), e.actualBitRate !== 0 && (n.actualBitRate = Math.round(e.actualBitRate)), e.bitRateError !== 0 && (n.bitRateError = e.bitRateError), e.samplePoint !== 0 && (n.samplePoint = e.samplePoint), e.description !== "" && (n.description = e.description), e.busParams !== void 0 && (n.busParams = l.toJSON(e.busParams)), n;
},
create(e) {
return h.fromPartial(e ?? {});
},
fromPartial(e) {
const n = Ie();
return n.bitRate = e.bitRate ?? 0, n.actualBitRate = e.actualBitRate ?? 0, n.bitRateError = e.bitRateError ?? 0, n.samplePoint = e.samplePoint ?? 0, n.description = e.description ?? "", n.busParams = e.busParams !== void 0 && e.busParams !== null ? l.fromPartial(e.busParams) : void 0, n;
}
};
function me() {
return { bitRate: 0, samplePoint: 0, description: "", busParams: void 0 };
}
const T = {
encode(e, n = new o()) {
return e.bitRate !== 0 && n.uint32(8).int32(e.bitRate), e.samplePoint !== 0 && n.uint32(17).double(e.samplePoint), e.description !== "" && n.uint32(26).string(e.description), e.busParams !== void 0 && l.encode(e.busParams, n.uint32(34).fork()).join(), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = me();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 8)
break;
a.bitRate = i.int32();
continue;
}
case 2: {
if (r !== 17)
break;
a.samplePoint = i.double();
continue;
}
case 3: {
if (r !== 26)
break;
a.description = i.string();
continue;
}
case 4: {
if (r !== 34)
break;
a.busParams = l.decode(i, i.uint32());
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
bitRate: f(e.bitRate) ? globalThis.Number(e.bitRate) : 0,
samplePoint: f(e.samplePoint) ? globalThis.Number(e.samplePoint) : 0,
description: f(e.description) ? globalThis.String(e.description) : "",
busParams: f(e.busParams) ? l.fromJSON(e.busParams) : void 0
};
},
toJSON(e) {
const n = {};
return e.bitRate !== 0 && (n.bitRate = Math.round(e.bitRate)), e.samplePoint !== 0 && (n.samplePoint = e.samplePoint), e.description !== "" && (n.description = e.description), e.busParams !== void 0 && (n.busParams = l.toJSON(e.busParams)), n;
},
create(e) {
return T.fromPartial(e ?? {});
},
fromPartial(e) {
const n = me();
return n.bitRate = e.bitRate ?? 0, n.samplePoint = e.samplePoint ?? 0, n.description = e.description ?? "", n.busParams = e.busParams !== void 0 && e.busParams !== null ? l.fromPartial(e.busParams) : void 0, n;
}
};
function pe() {
return { arbitrationBusSpeed: void 0, dataBusSpeeds: [] };
}
const I = {
encode(e, n = new o()) {
e.arbitrationBusSpeed !== void 0 && T.encode(e.arbitrationBusSpeed, n.uint32(10).fork()).join();
for (const i of e.dataBusSpeeds)
T.encode(i, n.uint32(18).fork()).join();
return n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = pe();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.arbitrationBusSpeed = T.decode(i, i.uint32());
continue;
}
case 2: {
if (r !== 18)
break;
a.dataBusSpeeds.push(T.decode(i, i.uint32()));
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
arbitrationBusSpeed: f(e.arbitrationBusSpeed) ? T.fromJSON(e.arbitrationBusSpeed) : void 0,
dataBusSpeeds: globalThis.Array.isArray(e == null ? void 0 : e.dataBusSpeeds) ? e.dataBusSpeeds.map((n) => T.fromJSON(n)) : []
};
},
toJSON(e) {
var i;
const n = {};
return e.arbitrationBusSpeed !== void 0 && (n.arbitrationBusSpeed = T.toJSON(e.arbitrationBusSpeed)), (i = e.dataBusSpeeds) != null && i.length && (n.dataBusSpeeds = e.dataBusSpeeds.map((t) => T.toJSON(t))), n;
},
create(e) {
return I.fromPartial(e ?? {});
},
fromPartial(e) {
var i;
const n = pe();
return n.arbitrationBusSpeed = e.arbitrationBusSpeed !== void 0 && e.arbitrationBusSpeed !== null ? T.fromPartial(e.arbitrationBusSpeed) : void 0, n.dataBusSpeeds = ((i = e.dataBusSpeeds) == null ? void 0 : i.map((t) => T.fromPartial(t))) || [], n;
}
};
function Ce() {
return { busParamLimits: void 0, channelCaps: [], maxBitRate: 0, clockFrequency: 0 };
}
const b = {
encode(e, n = new o()) {
e.busParamLimits !== void 0 && g.encode(e.busParamLimits, n.uint32(10).fork()).join(), n.uint32(18).fork();
for (const i of e.channelCaps)
n.int32(i);
return n.join(), e.maxBitRate !== 0 && n.uint32(24).int32(e.maxBitRate), e.clockFrequency !== 0 && n.uint32(33).double(e.clockFrequency), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Ce();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.busParamLimits = g.decode(i, i.uint32());
continue;
}
case 2: {
if (r === 16) {
a.channelCaps.push(i.int32());
continue;
}
if (r === 18) {
const d = i.uint32() + i.pos;
for (; i.pos < d; )
a.channelCaps.push(i.int32());
continue;
}
break;
}
case 3: {
if (r !== 24)
break;
a.maxBitRate = i.int32();
continue;
}
case 4: {
if (r !== 33)
break;
a.clockFrequency = i.double();
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
busParamLimits: f(e.busParamLimits) ? g.fromJSON(e.busParamLimits) : void 0,
channelCaps: globalThis.Array.isArray(e == null ? void 0 : e.channelCaps) ? e.channelCaps.map((n) => Kn(n)) : [],
maxBitRate: f(e.maxBitRate) ? globalThis.Number(e.maxBitRate) : 0,
clockFrequency: f(e.clockFrequency) ? globalThis.Number(e.clockFrequency) : 0
};
},
toJSON(e) {
var i;
const n = {};
return e.busParamLimits !== void 0 && (n.busParamLimits = g.toJSON(e.busParamLimits)), (i = e.channelCaps) != null && i.length && (n.channelCaps = e.channelCaps.map((t) => Wn(t))), e.maxBitRate !== 0 && (n.maxBitRate = Math.round(e.maxBitRate)), e.clockFrequency !== 0 && (n.clockFrequency = e.clockFrequency), n;
},
create(e) {
return b.fromPartial(e ?? {});
},
fromPartial(e) {
var i;
const n = Ce();
return n.busParamLimits = e.busParamLimits !== void 0 && e.busParamLimits !== null ? g.fromPartial(e.busParamLimits) : void 0, n.channelCaps = ((i = e.channelCaps) == null ? void 0 : i.map((t) => t)) || [], n.maxBitRate = e.maxBitRate ?? 0, n.clockFrequency = e.clockFrequency ?? 0, n;
}
};
function Fe() {
return { channelNumber: 0, channelNumberOnDevice: 0, name: "", protocols: [], canChannelCapacity: void 0 };
}
const G = {
encode(e, n = new o()) {
e.channelNumber !== 0 && n.uint32(8).int32(e.channelNumber), e.channelNumberOnDevice !== 0 && n.uint32(16).int32(e.channelNumberOnDevice), e.name !== "" && n.uint32(26).string(e.name), n.uint32(34).fork();
for (const i of e.protocols)
n.int32(i);
return n.join(), e.canChannelCapacity !== void 0 && b.encode(e.canChannelCapacity, n.uint32(42).fork()).join(), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Fe();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 8)
break;
a.channelNumber = i.int32();
continue;
}
case 2: {
if (r !== 16)
break;
a.channelNumberOnDevice = i.int32();
continue;
}
case 3: {
if (r !== 26)
break;
a.name = i.string();
continue;
}
case 4: {
if (r === 32) {
a.protocols.push(i.int32());
continue;
}
if (r === 34) {
const d = i.uint32() + i.pos;
for (; i.pos < d; )
a.protocols.push(i.int32());
continue;
}
break;
}
case 5: {
if (r !== 42)
break;
a.canChannelCapacity = b.decode(i, i.uint32());
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
channelNumber: f(e.channelNumber) ? globalThis.Number(e.channelNumber) : 0,
channelNumberOnDevice: f(e.channelNumberOnDevice) ? globalThis.Number(e.channelNumberOnDevice) : 0,
name: f(e.name) ? globalThis.String(e.name) : "",
protocols: globalThis.Array.isArray(e == null ? void 0 : e.protocols) ? e.protocols.map((n) => Fn(n)) : [],
canChannelCapacity: f(e.canChannelCapacity) ? b.fromJSON(e.canChannelCapacity) : void 0
};
},
toJSON(e) {
var i;
const n = {};
return e.channelNumber !== 0 && (n.channelNumber = Math.round(e.channelNumber)), e.channelNumberOnDevice !== 0 && (n.channelNumberOnDevice = Math.round(e.channelNumberOnDevice)), e.name !== "" && (n.name = e.name), (i = e.protocols) != null && i.length && (n.protocols = e.protocols.map((t) => Mn(t))), e.canChannelCapacity !== void 0 && (n.canChannelCapacity = b.toJSON(e.canChannelCapacity)), n;
},
create(e) {
return G.fromPartial(e ?? {});
},
fromPartial(e) {
var i;
const n = Fe();
return n.channelNumber = e.channelNumber ?? 0, n.channelNumberOnDevice = e.channelNumberOnDevice ?? 0, n.name = e.name ?? "", n.protocols = ((i = e.protocols) == null ? void 0 : i.map((t) => t)) || [], n.canChannelCapacity = e.canChannelCapacity !== void 0 && e.canChannelCapacity !== null ? b.fromPartial(e.canChannelCapacity) : void 0, n;
}
};
function Me() {
return { cardType: 0, cardNumber: 0, productCode: "", serialNumber: "", name: "", protocols: [], channels: [] };
}
const m = {
encode(e, n = new o()) {
e.cardType !== 0 && n.uint32(8).int32(e.cardType), e.cardNumber !== 0 && n.uint32(16).int32(e.cardNumber), e.productCode !== "" && n.uint32(26).string(e.productCode), e.serialNumber !== "" && n.uint32(34).string(e.serialNumber), e.name !== "" && n.uint32(42).string(e.name), n.uint32(50).fork();
for (const i of e.protocols)
n.int32(i);
n.join();
for (const i of e.channels)
G.encode(i, n.uint32(58).fork()).join();
return n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Me();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 8)
break;
a.cardType = i.int32();
continue;
}
case 2: {
if (r !== 16)
break;
a.cardNumber = i.int32();
continue;
}
case 3: {
if (r !== 26)
break;
a.productCode = i.string();
continue;
}
case 4: {
if (r !== 34)
break;
a.serialNumber = i.string();
continue;
}
case 5: {
if (r !== 42)
break;
a.name = i.string();
continue;
}
case 6: {
if (r === 48) {
a.protocols.push(i.int32());
continue;
}
if (r === 50) {
const d = i.uint32() + i.pos;
for (; i.pos < d; )
a.protocols.push(i.int32());
continue;
}
break;
}
case 7: {
if (r !== 58)
break;
a.channels.push(G.decode(i, i.uint32()));
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
cardType: f(e.cardType) ? globalThis.Number(e.cardType) : 0,
cardNumber: f(e.cardNumber) ? globalThis.Number(e.cardNumber) : 0,
productCode: f(e.productCode) ? globalThis.String(e.productCode) : "",
serialNumber: f(e.serialNumber) ? globalThis.String(e.serialNumber) : "",
name: f(e.name) ? globalThis.String(e.name) : "",
protocols: globalThis.Array.isArray(e == null ? void 0 : e.protocols) ? e.protocols.map((n) => Fn(n)) : [],
channels: globalThis.Array.isArray(e == null ? void 0 : e.channels) ? e.channels.map((n) => G.fromJSON(n)) : []
};
},
toJSON(e) {
var i, t;
const n = {};
return e.cardType !== 0 && (n.cardType = Math.round(e.cardType)), e.cardNumber !== 0 && (n.cardNumber = Math.round(e.cardNumber)), e.productCode !== "" && (n.productCode = e.productCode), e.serialNumber !== "" && (n.serialNumber = e.serialNumber), e.name !== "" && (n.name = e.name), (i = e.protocols) != null && i.length && (n.protocols = e.protocols.map((a) => Mn(a))), (t = e.channels) != null && t.length && (n.channels = e.channels.map((a) => G.toJSON(a))), n;
},
create(e) {
return m.fromPartial(e ?? {});
},
fromPartial(e) {
var i, t;
const n = Me();
return n.cardType = e.cardType ?? 0, n.cardNumber = e.cardNumber ?? 0, n.productCode = e.productCode ?? "", n.serialNumber = e.serialNumber ?? "", n.name = e.name ?? "", n.protocols = ((i = e.protocols) == null ? void 0 : i.map((a) => a)) || [], n.channels = ((t = e.channels) == null ? void 0 : t.map((a) => G.fromPartial(a))) || [], n;
}
};
function Le() {
return { items: [] };
}
const k = {
encode(e, n = new o()) {
for (const i of e.items)
m.encode(i, n.uint32(10).fork()).join();
return n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Le();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.items.push(m.decode(i, i.uint32()));
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return { items: globalThis.Array.isArray(e == null ? void 0 : e.items) ? e.items.map((n) => m.fromJSON(n)) : [] };
},
toJSON(e) {
var i;
const n = {};
return (i = e.items) != null && i.length && (n.items = e.items.map((t) => m.toJSON(t))), n;
},
create(e) {
return k.fromPartial(e ?? {});
},
fromPartial(e) {
var i;
const n = Le();
return n.items = ((i = e.items) == null ? void 0 : i.map((t) => m.fromPartial(t))) || [], n;
}
};
function Pe() {
return { preferences: void 0, includeVirtual: !1 };
}
const ii = {
encode(e, n = new o()) {
return e.preferences !== void 0 && E.encode(e.preferences, n.uint32(10).fork()).join(), e.includeVirtual !== !1 && n.uint32(16).bool(e.includeVirtual), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = Pe();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.preferences = E.decode(i, i.uint32());
continue;
}
case 2: {
if (r !== 16)
break;
a.includeVirtual = i.bool();
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
preferences: f(e.preferences) ? E.fromJSON(e.preferences) : void 0,
includeVirtual: f(e.includeVirtual) ? globalThis.Boolean(e.includeVirtual) : !1
};
},
toJSON(e) {
const n = {};
return e.preferences !== void 0 && (n.preferences = E.toJSON(e.preferences)), e.includeVirtual !== !1 && (n.includeVirtual = e.includeVirtual), n;
},
create(e) {
return ii.fromPartial(e ?? {});
},
fromPartial(e) {
const n = Pe();
return n.preferences = e.preferences !== void 0 && e.preferences !== null ? E.fromPartial(e.preferences) : void 0, n.includeVirtual = e.includeVirtual ?? !1, n;
}
};
function ge() {
return { devices: [] };
}
const ri = {
encode(e, n = new o()) {
for (const i of e.devices)
m.encode(i, n.uint32(10).fork()).join();
return n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = ge();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.devices.push(m.decode(i, i.uint32()));
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7);
}
return a;
},
fromJSON(e) {
return {
devices: globalThis.Array.isArray(e == null ? void 0 : e.devices) ? e.devices.map((n) => m.fromJSON(n)) : []
};
},
toJSON(e) {
var i;
const n = {};
return (i = e.devices) != null && i.length && (n.devices = e.devices.map((t) => m.toJSON(t))), n;
},
create(e) {
return ri.fromPartial(e ?? {});
},
fromPartial(e) {
var i;
const n = ge();
return n.devices = ((i = e.devices) == null ? void 0 : i.map((t) => m.fromPartial(t))) || [], n;
}
};
function be() {
return {
preferences: void 0,
channelNumber: 0,
bitRate: void 0,
bitRateArbitrationPhase: void 0,
bitRateDataPhase: void 0
};
}
const ai = {
encode(e, n = new o()) {
return e.preferences !== void 0 && E.encode(e.preferences, n.uint32(10).fork()).join(), e.channelNumber !== 0 && n.uint32(16).int32(e.channelNumber), e.bitRate !== void 0 && n.uint32(24).int32(e.bitRate), e.bitRateArbitrationPhase !== void 0 && n.uint32(32).int32(e.bitRateArbitrationPhase), e.bitRateDataPhase !== void 0 && n.uint32(40).int32(e.bitRateDataPhase), n;
},
decode(e, n) {
const i = e instanceof u ? e : new u(e);
let t = n === void 0 ? i.len : i.pos + n;
const a = be();
for (; i.pos < t; ) {
const r = i.uint32();
switch (r >>> 3) {
case 1: {
if (r !== 10)
break;
a.preferences = E.decode(i, i.uint32());
continue;
}
case 2: {
if (r !== 16)
break;
a.channelNumber = i.int32();
continue;
}
case 3: {
if (r !== 24)
break;
a.bitRate = i.int32();
continue;
}
case 4: {
if (r !== 32)
break;
a.bitRateArbitrationPhase = i.int32();
continue;
}
case 5: {
if (r !== 40)
break;
a.bitRateDataPhase = i.int32();
continue;
}
}
if ((r & 7) === 4 || r === 0)
break;
i.skip(r & 7