UNPKG

@kvaser/canking-api

Version:

CanKing API to communicate with the CanKing service using Node.js.

461 lines (460 loc) 16.6 kB
var d = Object.defineProperty; var g = (r, e, s) => e in r ? d(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s; var n = (r, e, s) => g(r, typeof e != "symbol" ? e + "" : e, s); import u from "long"; import { c as C, e as R } from "./ElectronAPIFake.mjs"; import { q as T, p as y, u as z, v as J, y as L, w, B as v, A as E, k as q, ag as M, Q as D, D as b, ah as A, H as G, E as P, ak as B, F as k, $ as U, a0 as j, z as H, a1 as V, o as W, Z as $, _ as X, G as Y, a2 as K, a3 as Q, m as Z, n as _, a4 as ee, a5 as se, x as ae, C as te, J as ie, K as ne, I as re, i as oe, j as le, L as he, g as de, h as ge, aa as ue, ai as Se, ad as ce, aj as me, M as Fe, Y as xe, al as pe, am as fe, X as Ne, R as Ie, O as Ce, N as Re, e as Oe, t as Te, a6 as ye, a7 as ze, T as Je, W as Le, S as we, U as ve, P as Ee, V as qe, c as Me, d as De, f as be, a as Ae, l as Ge, b as Pe, ab as Be, ac as ke, ae as Ue, af as je, r as He, s as Ve, a8 as We, a9 as $e } from "./status_params.mjs"; import { Y as Ye, A as Ke, aE as Qe, h as Ze, g as _e, i as es, a as ss, l as as, an as ts, k as is, j as ns, C as rs, F as os, at as ls, $ as hs, U as ds, m as gs, ap as us, aG as Ss, Q as cs, av as ms, ae as Fs, n as xs, D as ps, x as fs, o as Ns, ab as Is, J as Cs, N as Rs, O as Os, I as Ts, az as ys, K as zs, M as Js, r as Ls, s as ws, v as vs, w as Es, t as qs, u as Ms, G as Ds, q as bs, aw as As, ax as Gs, ao as Ps, L as Bs, H as ks, a8 as Us, aq as js, ar as Hs, aI as Vs, aC as Ws, as as $s, P as Xs, T as Ys, R as Ks, ah as Qs, ay as Zs, aP as _s, aQ as ea, aR as sa, aJ as aa, au as ta, aD as ia, aM as na, S as ra, aA as oa, a2 as la, aF as ha, aH as da, ak as ga, a5 as ua, aB as Sa, W as ca, Z as ma, _ as Fa, c as xa, b as pa, y as fa, z as Na, a0 as Ia, a1 as Ca, V as Ra, X as Oa, af as Ta, ag as ya, e as za, f as Ja, ac as La, ad as wa, B as va, E as Ea, a9 as qa, aa as Ma, p as Da, d as ba, ai as Aa, aj as Ga, aK as Pa, aL as Ba, aN as ka, aO as Ua, a3 as ja, a4 as Ha, al as Va, am as Wa, a6 as $a, a7 as Xa } from "./measurement_settings.mjs"; class o { constructor(e, s, a, t, i, h) { n(this, "data"); n(this, "index"); n(this, "size"); n(this, "endIndex"); n(this, "length"); n(this, "normalizedIndex"); n(this, "filterCallback"); this.data = e, this.index = a, this.size = s, this.endIndex = t, this.length = i, this.normalizedIndex = 0, this.filterCallback = h; } next() { for (; this.normalizedIndex < this.length; ) { this.normalizedIndex += 1; const e = { value: this.data[this.index], done: !1 }; if (this.index += 1, this.index === this.size && (this.index = 0), !this.filterCallback || this.filterCallback(e.value)) return e; } return { value: this.data[this.index], done: !0 }; } findIndex(e) { let s = this.index, a = this.normalizedIndex; for (; a < this.length; ) { if (e(this.data[s])) return s; a += 1, s += 1, s === this.size && (s = 0); } return -1; } /** * Returns an iterator of a section of this buffer. * @param start The beginning index of the specified portion of the buffer. * @param end The end index of the specified portion of the buffer. This is exclusive of the element at the index 'end'. * If end is undefined, then the slice extends to the end of the buffer. */ slice(e, s) { if (this.length === 0) return new o(this.data, this.size, 0, 0, 0); if (e < 0 || e >= this.length) throw new Error("Invalid start index"); if (s !== void 0 && (s < 0 || s >= this.length)) throw new Error("Invalid end index"); let a = this.index + e; a >= this.size && (a -= this.size); let t = s !== void 0 ? this.index + s : this.endIndex; t >= this.size && (t -= this.size); const i = s !== void 0 ? s - e : this.length - e; return new o(this.data, this.size, a, t, i); } /** * Returns an iterator of a section of this buffer. * @param filter An optional callback filter. */ filter(e) { return new o(this.data, this.size, this.index, this.endIndex, this.length, e); } /** * Returns an iterator of a section of this buffer. * @param start The beginning index of the specified portion of the buffer. * @param end The end index of the specified portion of the buffer. This is exclusive of the element at the index 'end'. * If end is undefined, then the slice extends to the end of the buffer. * @param filter An optional callback filter. */ sliceAndFilter(e, s, a) { if (this.length === 0) return new o(this.data, this.size, 0, 0, 0, a); if (e < 0 || e >= this.length) throw new Error("Invalid start index"); if (s !== void 0 && (s < 0 || s >= this.length)) throw new Error("Invalid end index"); let t = this.index + e; t >= this.size && (t -= this.size); let i = s !== void 0 ? this.index + s : this.endIndex; i >= this.size && (i -= this.size); const h = s !== void 0 ? s - e : this.length - e; return new o(this.data, this.size, t, i, h, a); } [Symbol.iterator]() { return this; } } class m { /** * Constructor. * @param size An optional buffer size. */ constructor(e = 0) { n(this, "length", 0); n(this, "size", 0); n(this, "startIndex", 0); n(this, "endIndex", 0); n(this, "data", []); this.clear(e); } /** * Clears this DataBuffer. * @param size An optional new buffer size. */ clear(e) { this.size = e !== void 0 ? e : this.size, this.startIndex = 0, this.endIndex = 0, this.length = 0, this.data = this.size > 0 ? new Array(this.size) : []; } /** * Adds data to this DataBuffer. * @param elements The new elements. */ push(...e) { for (let s = 0; s < e.length; s += 1) { const a = e[s]; this.length > 0 && (this.endIndex += 1, this.endIndex === this.size && (this.endIndex = 0), this.length === this.size && (this.startIndex += 1, this.startIndex === this.size && (this.startIndex = 0))), this.data[this.endIndex] = a, this.length < this.size && (this.length += 1); } } /** * Takes an integer value and returns the item at that index, * allowing for positive and negative integers. * Negative integers count back from the last item in the array. */ at(e) { if (Math.abs(e) >= this.length) throw new Error("Argument out of range!"); return e < 0 ? this.endIndex - e >= 0 ? this.data[this.endIndex - e] : this.data[this.size + (this.endIndex - e)] : this.startIndex + e < this.size ? this.data[this.startIndex + e] : this.data[this.startIndex + e - this.size]; } /** * Returns an iterator of a section of this buffer. * @param start The beginning index of the specified portion of the buffer. * @param end The end index of the specified portion of the buffer. This is exclusive of the element at the index 'end'. * If end is undefined, then the slice extends to the end of the buffer. */ slice(e, s) { if (this.length === 0) return new o(this.data, this.size, 0, 0, 0); if (e < 0 || e >= this.length) throw new Error("Invalid start index"); if (s !== void 0 && (s < 0 || s >= this.length)) throw new Error("Invalid end index"); let a = this.startIndex + e; a >= this.size && (a -= this.size); let t = s !== void 0 ? this.startIndex + s : this.endIndex; t >= this.size && (t -= this.size); const i = s !== void 0 ? s - e : this.length - e; return new o(this.data, this.size, a, t, i); } /** * Returns an iterator of a section of this buffer. * @param filter An optional callback filter. */ filter(e) { return new o(this.data, this.size, this.startIndex, this.endIndex, this.length, e); } /** * Returns an iterator of a section of this buffer. * @param start The beginning index of the specified portion of the buffer. * @param end The end index of the specified portion of the buffer. This is exclusive of the element at the index 'end'. * If end is undefined, then the slice extends to the end of the buffer. * @param filter An optional callback filter. */ sliceAndFilter(e, s, a) { if (this.length === 0) return new o(this.data, this.size, 0, 0, 0, a); if (e < 0 || e >= this.length) throw new Error("Invalid start index"); if (s !== void 0 && (s < 0 || s >= this.length)) throw new Error("Invalid end index"); let t = this.startIndex + e; t >= this.size && (t -= this.size); let i = s !== void 0 ? this.startIndex + s : this.endIndex; i >= this.size && (i -= this.size); const h = s !== void 0 ? s - e : this.length - e; return new o(this.data, this.size, t, i, h, a); } view() { return new o(this.data, this.size, this.startIndex, this.endIndex, this.length); } [Symbol.iterator]() { return new o(this.data, this.size, this.startIndex, this.endIndex, this.length); } } class l { constructor(e, s) { n(this, "x"); n(this, "y"); this.x = Number(e.toFixed(1)), this.y = Number(s.toFixed(1)); } add(e) { return new l(this.x + e.x, this.y + e.y); } subtract(e) { return new l(this.x - e.x, this.y - e.y); } multiply(e) { return new l(this.x * e, this.y * e); } divide(e) { return new l(this.x / e, this.y / e); } // Normalize to the device pixel ratio (zoom + HiDPI) // This is only needed for direct pixel manipulation (i.e. canvas), not HTML, CSS, or SVG normalize() { return this.multiply(window.devicePixelRatio); } static vectorWidth(e) { return Math.abs(e.end.x - e.start.x); } static vectorHeight(e) { return Math.abs(e.end.y - e.start.y); } static vectorLength(e) { return Math.sqrt(l.vectorHeight(e) ** 2 + l.vectorWidth(e) ** 2); } distanceFrom(e) { return Math.abs( (e.end.y - e.start.y) * this.x - (e.end.x - e.start.x) * this.y + e.end.x * e.start.y - e.end.y * e.start.x ) / l.vectorLength(e); } isInsideOf(e) { const s = Math.min(e.start.x, e.end.x), a = Math.min(e.start.y, e.end.y), t = Math.max(e.start.x, e.end.x), i = Math.max(e.start.y, e.end.y); return s <= this.x && this.x <= t && a <= this.y && this.y <= i; } } const F = (r, e = 2, s = !1) => { let a = r.toString(16).toUpperCase(); for (; a.length < e; ) a = `0${a}`; return s ? `0x${a}` : a; }, x = (r, e = 3) => { let s = r.toString(); for (; s.length < e; ) s = `0${s}`; return s; }, p = (r) => { try { return new u(r.low, r.high, r.unsigned).toNumber(); } catch { return NaN; } }, f = { version: "1.0.0", theme: "light", language: "en", strings: {}, showToolsPanel: !0, useHexNumericBase: !0, maxDataBytes: 16, defaultProjectFolder: "", defaultLogFilesFolder: "", defaultCANDatabasesFolder: "", defaultLINDatabasesFolder: "", currentProjectFile: "", currentProjectFileName: "", recentProjectFiles: [], closeAppServiceAction: "prompt" }; export { T as AboutInformation, Ye as AccessMode, y as ActivateLicenseRequest, z as AddAllConnectedCanChannelsRequest, J as AddAllConnectedLinChannelsRequest, L as AddOrUpdateDataProcessorRequest, w as AddOrUpdateSourceRequest, v as AddOrUpdateTargetRequest, Ke as ApiPreferences, E as AppEvent, q as AppEventArgs, Qe as BaseNodeProperties, M as BusStatus, Ze as CanBusParamLimits, _e as CanBusParams, es as CanBusSpeedInfo, ss as CanChannelCap, as as CanChannelCapacity, ts as CanChannelConfiguration, is as CanFDBusSpeedCombination, ns as CanFDBusSpeedInfo, rs as CanFrameFlag, os as CanFrameFlags, ls as CanMessageFilterSettings, hs as CanMessageFilterType, ds as CanMode, gs as Channel, us as ChannelSettings, D as ClearLinMessageRequest, b as ConnectNodesRequest, m as DataBuffer, o as DataBufferView, A as DataProcessingStatus, Ss as DataProcessorNodeProperties, cs as DatabaseFiles, ms as DatabasesSettings, Fs as DecimalChar, xs as Device, ps as DeviceEvent, fs as DeviceEventArgs, Ns as Devices, G as DisconnectNodesRequest, P as Empty, B as ErrorStatus, Is as FileConflictAction, k as FileType, Cs as Frame, Rs as FrameDefinition, Os as FrameDefinitions, Ts as FramePropertyValue, ys as FrameReceivedTrigger, zs as Frame_PropertiesEntry, Js as Frames, Ls as GetCanChannelBusSpeedsRequest, ws as GetCanChannelBusSpeedsResponse, vs as GetCanFdBusSpeedsRequest, Es as GetCanFdBusSpeedsResponse, U as GetChannelsFromLogFileRequest, j as GetChannelsFromLogFileResponse, qs as GetClassicCanBusSpeedsRequest, Ms as GetClassicCanBusSpeedsResponse, H as GetDataProcessorResponse, Ds as GetDevicesRequest, bs as GetDevicesResponse, V as GetFrameDefinitionsFromDatabaseFilesRequest, W as GetLicensesResponse, $ as GetLogFileFormatsRequest, X as GetLogFileFormatsResponse, Y as GetLogLevelResponse, K as GetScheduleTablesFromDatabaseFilesRequest, Q as GetScheduleTablesFromDatabaseFilesResponse, Z as GetServiceExtensionInfoRequest, _ as GetServiceExtensionInfoResponse, ee as GetSignalDataFromMessageDataRequest, se as GetSignalDataFromMessageDataResponse, ae as GetSourceResponse, te as GetTargetResponse, ie as IdentifierRequest, ne as IdentifiersRequest, re as InstallServiceExtensionRequest, As as InterpreterSettings, Gs as J1939InterpreterSettings, oe as LicenseInformation, le as Licenses, Ps as LinChannelConfiguration, Bs as LinFrameFlag, ks as LinFrameFlags, Us as LogFileFormat, he as LogLevel, de as LogMessage, ge as LogMessages, js as LogReplaySettings, Hs as LogReplaySettings_ChannelIdentifiersEntry, ue as LogReplayState, Se as LogReplayStatus, ce as LoggerState, me as LoggerStatus, Fe as MeasurementEvent, xe as MeasurementEventArgs, Vs as MeasurementSetup, Ws as MessageLoggerSettings, pe as NodeStatus, fe as NodeStatuses, Ne as OnlineStatus, $s as PeriodicTransmissionSettings, l as Point, Xs as Protocols, Ie as RequestLinMessageRequest, Ys as ScheduleTable, Ks as ScheduleTableEntry, Ce as SendLinWakeupFrameRequest, Re as SendMessageRequest, Qs as Separator, Zs as ServiceExtensionSettings, Oe as SetLogLevelRequest, Te as SetMeasurementSetupRequest, ye as SetSignalDataToMessageDataRequest, ze as SetSignalDataToMessageDataResponse, _s as SignalDefinition, ea as SignalDefinition_EnumValuesEntry, sa as SignalDefinitions, aa as SignalEncoding, ta as SignalFilterSettings, ia as SignalLoggerSettings, na as SignalType, ra as SignalValue, oa as SignalValueTrigger, la as SignalValueTriggerOperator, ha as SourceNodeProperties, Je as StartPeriodicTransmissionRequest, Le as StartPeriodicTransmissionResponse, we as StatusLevel, da as TargetNodeProperties, ga as TimeReference, ua as TriggerOperator, Sa as TriggerSettings, ve as UninstallServiceExtensionRequest, Ee as UpdateLinMessageRequest, qe as UpdatePeriodicTransmissionRequest, ca as WriteFrame, ma as accessModeFromJSON, Fa as accessModeToJSON, Me as appEventFromJSON, De as appEventToJSON, xa as canChannelCapFromJSON, pa as canChannelCapToJSON, fa as canFrameFlagFromJSON, Na as canFrameFlagToJSON, Ia as canMessageFilterTypeFromJSON, Ca as canMessageFilterTypeToJSON, Ra as canModeFromJSON, Oa as canModeToJSON, C as createElectronApiFake, Ta as decimalCharFromJSON, ya as decimalCharToJSON, x as decimalToFixed, F as decimalToHex, f as defaultUserSettings, za as deviceEventFromJSON, Ja as deviceEventToJSON, R as electronApiFake, La as fileConflictActionFromJSON, wa as fileConflictActionToJSON, be as fileTypeFromJSON, Ae as fileTypeToJSON, va as linFrameFlagFromJSON, Ea as linFrameFlagToJSON, qa as logFileFormatFromJSON, Ma as logFileFormatToJSON, Ge as logLevelFromJSON, Pe as logLevelToJSON, Be as logReplayStateFromJSON, ke as logReplayStateToJSON, Ue as loggerStateFromJSON, je as loggerStateToJSON, p as longToNumber, He as measurementEventFromJSON, Ve as measurementEventToJSON, Da as protocolsFromJSON, ba as protocolsToJSON, Aa as separatorFromJSON, Ga as separatorToJSON, Pa as signalEncodingFromJSON, Ba as signalEncodingToJSON, ka as signalTypeFromJSON, Ua as signalTypeToJSON, ja as signalValueTriggerOperatorFromJSON, Ha as signalValueTriggerOperatorToJSON, We as statusLevelFromJSON, $e as statusLevelToJSON, Va as timeReferenceFromJSON, Wa as timeReferenceToJSON, $a as triggerOperatorFromJSON, Xa as triggerOperatorToJSON };