UNPKG

@kvaser/canking-api

Version:

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

311 lines (310 loc) 12 kB
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import Long from "long"; /** Possible CAN channel capacity flags. */ export declare enum CanChannelCap { CAN_CHANNEL_CAP_UNSPECIFIED = 0, /** CAN_CHANNEL_CAP_EXTENDED_CAN - Can use extended identifiers. */ CAN_CHANNEL_CAP_EXTENDED_CAN = 1, /** CAN_CHANNEL_CAP_BUS_STATISTICS - Can report busload etc. */ CAN_CHANNEL_CAP_BUS_STATISTICS = 2, /** CAN_CHANNEL_CAP_ERROR_COUNTERS - Can return error counters. */ CAN_CHANNEL_CAP_ERROR_COUNTERS = 3, /** CAN_CHANNEL_CAP_GENERATE_ERROR - Can send error frames. */ CAN_CHANNEL_CAP_GENERATE_ERROR = 4, /** CAN_CHANNEL_CAP_GENERATE_OVERLOAD - Can send CAN overload frame. */ CAN_CHANNEL_CAP_GENERATE_OVERLOAD = 5, /** CAN_CHANNEL_CAP_TXREQUEST - Can report when a CAN message transmission is initiated. */ CAN_CHANNEL_CAP_TXREQUEST = 6, /** CAN_CHANNEL_CAP_TXACKNOWLEDGE - Can report when a CAN messages has been transmitted. */ CAN_CHANNEL_CAP_TXACKNOWLEDGE = 7, /** CAN_CHANNEL_CAP_VIRTUAL - Virtual CAN channel. */ CAN_CHANNEL_CAP_VIRTUAL = 8, /** CAN_CHANNEL_CAP_SIMULATED - Simulated CAN channel. */ CAN_CHANNEL_CAP_SIMULATED = 9, /** CAN_CHANNEL_CAP_CAN_FD - CAN-FD ISO compliant channel. */ CAN_CHANNEL_CAP_CAN_FD = 10, /** CAN_CHANNEL_CAP_CAN_FD_NONISO - CAN-FD NON-ISO compliant channel. */ CAN_CHANNEL_CAP_CAN_FD_NONISO = 11, /** CAN_CHANNEL_CAP_SILENT_MODE - Channel supports Silent mode. */ CAN_CHANNEL_CAP_SILENT_MODE = 12, /** CAN_CHANNEL_CAP_SINGLE_SHOT - Channel supports Single Shot messages. */ CAN_CHANNEL_CAP_SINGLE_SHOT = 13, /** CAN_CHANNEL_CAP_LOGGER - Channel has logger capabilities. */ CAN_CHANNEL_CAP_LOGGER = 14, /** CAN_CHANNEL_CAP_REMOTE_ACCESS - Channel has remote capabilities. */ CAN_CHANNEL_CAP_REMOTE_ACCESS = 15, /** CAN_CHANNEL_CAP_SCRIPT - Channel has script capabilities. */ CAN_CHANNEL_CAP_SCRIPT = 16, /** CAN_CHANNEL_CAP_LIN_HYBRID - Channel has LIN capabilities. */ CAN_CHANNEL_CAP_LIN_HYBRID = 17, /** CAN_CHANNEL_CAP_IO_API - Channel has IO API capabilities. */ CAN_CHANNEL_CAP_IO_API = 18, /** CAN_CHANNEL_CAP_CANTEGRITY - Channel has CANtegrity capabilities. */ CAN_CHANNEL_CAP_CANTEGRITY = 19, /** CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ - Channel has BusParams TQ API. */ CAN_CHANNEL_CAP_EX_BUSPARAMS_TQ = 20, UNRECOGNIZED = -1 } export declare function canChannelCapFromJSON(object: any): CanChannelCap; export declare function canChannelCapToJSON(object: CanChannelCap): string; /** * Possible events. * @internal */ export declare enum DeviceEvent { DEVICE_EVENT_UNSPECIFIED = 0, /** DEVICE_EVENT_DEVICES_CHANGED - Raised when the Device collection has changed, will pass the new Device collection as event data */ DEVICE_EVENT_DEVICES_CHANGED = 1, UNRECOGNIZED = -1 } export declare function deviceEventFromJSON(object: any): DeviceEvent; export declare function deviceEventToJSON(object: DeviceEvent): string; /** * CanBusParams is used for getting the channels bus params capacity and it can be used for * setting up a correct bus speed configuration for a specific CAN channel. * * Constraints that must be fulfilled when opening channel in classic CAN Mode: * * tq = 1 + prop + phase1 + phase2 * tq >= 3 * sjw <= min(phase1, phase2) * prescaler >= 1 * * Constraints that must be fulfilled when opening channel in CAN FD Mode: * * arbitration.tq = 1 + arbitration.prop + arbitration.phase1 + arbitration.phase2 * arbitration.tq >= 3 * arbitration.sjw <= min(arbitration.phase1, arbitration.phase2) * arbitration.prescaler >= 1 (<=2 will enable Transmitter Delay Compensation Mechanism) * * data.tq = 1 + data.phase1 + data.phase2 * data.tq >= 3 * data.sjw <= min(data.phase1, data.phase2) * data.prop = 0 * data.prescaler = arbitration.prescaler */ export interface CanBusParams { /** The total number of time quantas (TQ). */ tq: number; /** The number of time quantas in phase 1. */ phase1: number; /** The number of time quantas in phase 2. */ phase2: number; /** The synchronization jump width in time quantas. */ sjw: number; /** The propagation segment in time quantas. */ prop: number; /** The prescaler value. */ prescaler: number; } /** CAN channel bus parameter limits. */ export interface CanBusParamLimits { /** Minimum bus parameters for arbitration phase. */ arbitrationMin: CanBusParams | undefined; /** Maximum bus parameters for arbitration phase. */ arbitrationMax: CanBusParams | undefined; /** Minimum bus parameters for data phase. */ dataMin: CanBusParams | undefined; /** Maximum bus parameters for data phase. */ dataMax: CanBusParams | undefined; /** Indicates if the limits are valid. */ isValid: boolean; } /** * Bus speed information, used for listing available bus speed settings for CAN. * @internal */ export interface CanBusSpeedInfo { /** The target bit rate (measured in bits per second). */ bitRate: number; /** The actual bit rate (measured in bits per second). */ actualBitRate: number; /** The bit rate error with these settings. */ bitRateError: number; /** The sample point in percentage. */ samplePoint: number; /** A text description of the bus speed. */ description: string; /** Bus parameters for this bus speed. */ busParams: CanBusParams | undefined; } /** * Bus speed information, used for listing available bus speed settings for CAN FD. * @internal */ export interface CanFDBusSpeedInfo { /** The target bit rate (measured in bits per second). */ bitRate: number; /** The sample point in percentage. */ samplePoint: number; /** A text description of the bus speed. */ description: string; /** Bus parameters for this bus speed. */ busParams: CanBusParams | undefined; } /** * CAN FD bus speed combination, holds one arbitration phase speed together with available data phase speeds. * @internal */ export interface CanFDBusSpeedCombination { arbitrationBusSpeed: CanFDBusSpeedInfo | undefined; dataBusSpeeds: CanFDBusSpeedInfo[]; } /** CAN channel capacity. */ export interface CanChannelCapacity { /** Bus parameter limits for the channel. */ busParamLimits: CanBusParamLimits | undefined; /** Supported channel capabilities. */ channelCaps: CanChannelCap[]; /** Maximum bitrate of the channel. Zero means no limit on bitrate. */ maxBitRate: number; /** Clock frequency of the channel in Hz. */ clockFrequency: number; } /** A channel of any type, could be CAN and/or LIN. */ export interface Channel { /** The channel number. */ channelNumber: number; /** The channel number on the device. */ channelNumberOnDevice: number; /** The channel name. */ name: string; /** Supported protocols by the channel. */ protocols: string[]; /** The channel capacity. */ canChannelCapacity?: CanChannelCapacity | undefined; } /** A hardware device. */ export interface Device { /** The device type/card type. */ cardType: number; /** The device card number. */ cardNumber: number; /** The device product code. */ productCode: string; /** The device serial number. */ serialNumber: string; /** The device name. */ name: string; /** Supported protocols by the device. */ protocols: string[]; /** The device channels. */ channels: Channel[]; } /** A collection of devices. */ export interface Devices { /** The device items. */ items: Device[]; } /** * A request message to get all connected devices. * @internal */ export interface GetDevicesRequest { includeVirtual: boolean; } /** * A response on the GetDevices request. * @internal */ export interface GetDevicesResponse { devices: Device[]; } /** * A request message to get a CAN channel's available bus speeds. * @internal */ export interface GetCanChannelBusSpeedsRequest { channelNumber: number; bitRate?: number | undefined; bitRateArbitrationPhase?: number | undefined; bitRateDataPhase?: number | undefined; } /** * A response on GetCanChannelBusSpeeds request. * @internal */ export interface GetCanChannelBusSpeedsResponse { /** Available bus speeds on classic CAN. */ availableBusSpeeds: CanBusSpeedInfo[]; /** Available bus speeds on CAN FD. */ availableBusSpeedsFd: CanFDBusSpeedCombination[]; } /** * A request message to get a CAN channel's classic CAN bus speeds for the specified bit rates. * @internal */ export interface GetClassicCanBusSpeedsRequest { channelNumber: number; bitRates: number[]; } /** * A response on GetClassicCanBusSpeeds request request. * @internal */ export interface GetClassicCanBusSpeedsResponse { /** Available bus speeds on classic CAN. */ availableBusSpeeds: CanBusSpeedInfo[]; } /** * A request message to get a CAN channel's CAN FD bus speeds for a given bit rate. * @internal */ export interface GetCanFdBusSpeedsRequest { channelNumber: number; bitRatesArbitrationPhase: number[]; bitRatesDataPhase: number[]; } /** * A response on GetCanFdBusSpeeds request request. * @internal */ export interface GetCanFdBusSpeedsResponse { /** Available bus speeds on CAN FD. */ availableBusSpeedsFd: CanFDBusSpeedCombination[]; } /** * Event arguments * @internal */ export interface DeviceEventArgs { eventType: DeviceEvent; devices?: Devices | undefined; } export declare const CanBusParams: MessageFns<CanBusParams>; export declare const CanBusParamLimits: MessageFns<CanBusParamLimits>; export declare const CanBusSpeedInfo: MessageFns<CanBusSpeedInfo>; export declare const CanFDBusSpeedInfo: MessageFns<CanFDBusSpeedInfo>; export declare const CanFDBusSpeedCombination: MessageFns<CanFDBusSpeedCombination>; export declare const CanChannelCapacity: MessageFns<CanChannelCapacity>; export declare const Channel: MessageFns<Channel>; export declare const Device: MessageFns<Device>; export declare const Devices: MessageFns<Devices>; export declare const GetDevicesRequest: MessageFns<GetDevicesRequest>; export declare const GetDevicesResponse: MessageFns<GetDevicesResponse>; export declare const GetCanChannelBusSpeedsRequest: MessageFns<GetCanChannelBusSpeedsRequest>; export declare const GetCanChannelBusSpeedsResponse: MessageFns<GetCanChannelBusSpeedsResponse>; export declare const GetClassicCanBusSpeedsRequest: MessageFns<GetClassicCanBusSpeedsRequest>; export declare const GetClassicCanBusSpeedsResponse: MessageFns<GetClassicCanBusSpeedsResponse>; export declare const GetCanFdBusSpeedsRequest: MessageFns<GetCanFdBusSpeedsRequest>; export declare const GetCanFdBusSpeedsResponse: MessageFns<GetCanFdBusSpeedsResponse>; export declare const DeviceEventArgs: MessageFns<DeviceEventArgs>; type Builtin = Date | Function | Uint8Array | string | number | boolean | undefined; type DeepPartial<T> = T extends Builtin ? T : T extends Long ? string | number | Long : T extends globalThis.Array<infer U> ? globalThis.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; type Exact<P, I extends P> = P extends Builtin ? P : P & { [K in keyof P]: Exact<P[K], I[K]>; } & { [K in Exclude<keyof I, KeysOfUnion<P>>]: never; }; interface MessageFns<T> { encode(message: T, writer?: BinaryWriter): BinaryWriter; decode(input: BinaryReader | Uint8Array, length?: number): T; fromJSON(object: any): T; toJSON(message: T): unknown; create<I extends Exact<DeepPartial<T>, I>>(base?: I): T; fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T; } export {};