UNPKG

@kvaser/canking-api

Version:

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

261 lines (260 loc) 11.3 kB
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import Long from "long"; import { ApiPreferences } from "./common_params"; /** 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 protocols supported by a channel or device. */ export declare enum Protocols { /** PROTOCOLS_UNSPECIFIED - No protocol is supported. */ PROTOCOLS_UNSPECIFIED = 0, /** PROTOCOLS_CAN - CAN protocol. */ PROTOCOLS_CAN = 1, /** PROTOCOLS_LIN - LIN protocol. */ PROTOCOLS_LIN = 2, UNRECOGNIZED = -1 } export declare function protocolsFromJSON(object: any): Protocols; export declare function protocolsToJSON(object: Protocols): string; /** Possible events. */ 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 { tq: number; phase1: number; phase2: number; sjw: number; prop: number; prescaler: number; } /** CAN channel bus parameter limits. */ export interface CanBusParamLimits { arbitrationMin: CanBusParams | undefined; arbitrationMax: CanBusParams | undefined; dataMin: CanBusParams | undefined; dataMax: CanBusParams | undefined; isValid: boolean; } /** Bus speed information, used for listing available bus speed settings for CAN. */ 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. */ 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. */ export interface CanFDBusSpeedCombination { arbitrationBusSpeed: CanFDBusSpeedInfo | undefined; dataBusSpeeds: CanFDBusSpeedInfo[]; } /** CAN channel capacity. */ export interface CanChannelCapacity { busParamLimits: CanBusParamLimits | undefined; channelCaps: CanChannelCap[]; /** Maximum bitrate of the channel. Zero means no limit on bitrate. */ maxBitRate: number; clockFrequency: number; } /** A channel of any type, could be CAN and/or LIN. */ export interface Channel { channelNumber: number; channelNumberOnDevice: number; name: string; protocols: Protocols[]; canChannelCapacity?: CanChannelCapacity | undefined; } /** A hardware device. */ export interface Device { cardType: number; cardNumber: number; productCode: string; serialNumber: string; name: string; protocols: Protocols[]; channels: Channel[]; } export interface Devices { items: Device[]; } /** A request message to get all connected devices. */ export interface GetDevicesRequest { preferences: ApiPreferences | undefined; includeVirtual: boolean; } /** A response on the GetDevices request. */ export interface GetDevicesResponse { devices: Device[]; } /** A request message to get a CAN channel's available bus speeds. */ export interface GetCanChannelBusSpeedsRequest { preferences: ApiPreferences | undefined; channelNumber: number; bitRate?: number | undefined; bitRateArbitrationPhase?: number | undefined; bitRateDataPhase?: number | undefined; } /** A response on GetCanChannelBusSpeeds request. */ 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. */ export interface GetClassicCanBusSpeedsRequest { preferences: ApiPreferences | undefined; channelNumber: number; bitRates: number[]; } /** A response on GetClassicCanBusSpeeds request request. */ 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. */ export interface GetCanFdBusSpeedsRequest { preferences: ApiPreferences | undefined; channelNumber: number; bitRatesArbitrationPhase: number[]; bitRatesDataPhase: number[]; } /** A response on GetCanFdBusSpeeds request request. */ export interface GetCanFdBusSpeedsResponse { /** Available bus speeds on CAN FD. */ availableBusSpeedsFd: CanFDBusSpeedCombination[]; } /** Event arguments */ 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 {};