UNPKG

@kvaser/canking-api

Version:

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

302 lines (301 loc) 12.5 kB
import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire"; import Long from "long"; import { SignalDefinition } from "./signal_params"; /** Possible CAN frame flags. The flag value must match the canlib flag value. */ export declare enum CanFrameFlag { /** CAN_FRAME_FLAG_UNSPECIFIED - No flag has been set. */ CAN_FRAME_FLAG_UNSPECIFIED = 0, /** CAN_FRAME_FLAG_RTR - Message is a remote request, only valid for classic CAN. */ CAN_FRAME_FLAG_RTR = 1, /** CAN_FRAME_FLAG_STD - Message has a standard (11-bit) identifier. */ CAN_FRAME_FLAG_STD = 2, /** CAN_FRAME_FLAG_EXT - Message has an extended (29-bit) identifier. */ CAN_FRAME_FLAG_EXT = 4, /** CAN_FRAME_FLAG_WAKEUP - Message is a WAKEUP message (SWC hardware.) */ CAN_FRAME_FLAG_WAKEUP = 8, /** CAN_FRAME_FLAG_NERR - NERR was active during the message (TJA1054 hardware). */ CAN_FRAME_FLAG_NERR = 16, /** CAN_FRAME_FLAG_ERROR_FRAME - Message represents an error frame. */ CAN_FRAME_FLAG_ERROR_FRAME = 32, /** CAN_FRAME_FLAG_TXACK - Message is a TX ACK (msg has really been sent). */ CAN_FRAME_FLAG_TXACK = 64, /** CAN_FRAME_FLAG_TXRQ - Message is a TX REQUEST (msg was transfered to the chip). */ CAN_FRAME_FLAG_TXRQ = 128, /** * CAN_FRAME_FLAG_DELAY_MSG - Message is NOT sent on the bus. The transmission of messages are delayed. * The dlc specifies the delay in milliseconds (1..1000). */ CAN_FRAME_FLAG_DELAY_MSG = 256, /** CAN_FRAME_FLAG_LOCAL_TXACK - Message was sent from another handle on the same can channel. */ CAN_FRAME_FLAG_LOCAL_TXACK = 268435456, /** * CAN_FRAME_FLAG_SINGLE_SHOT - Message is Single Shot, try to send once, no retransmission. * This flag can only be used with transmitted messages. */ CAN_FRAME_FLAG_SINGLE_SHOT = 16777216, /** CAN_FRAME_FLAG_TXNACK - Message is a failed Single Shot, message was not sent. This flag is only used with received messages. */ CAN_FRAME_FLAG_TXNACK = 33554432, /** * CAN_FRAME_FLAG_ABL - Only together with TxNack, Single shot message was not sent because arbitration was lost. * This flag is only used with received messages. */ CAN_FRAME_FLAG_ABL = 67108864, /** CAN_FRAME_FLAG_FD_FDF - Message is an FD message (CAN FD). */ CAN_FRAME_FLAG_FD_FDF = 65536, /** CAN_FRAME_FLAG_FD_BRS - Message is sent/received with bit rate switch (CAN FD). */ CAN_FRAME_FLAG_FD_BRS = 131072, /** CAN_FRAME_FLAG_FD_ESI - Sender of the message is in error passive mode (CAN FD). */ CAN_FRAME_FLAG_FD_ESI = 262144, /** CAN_FRAME_FLAG_ERR_HW_OVERRUN - HW buffer overrun. */ CAN_FRAME_FLAG_ERR_HW_OVERRUN = 512, /** CAN_FRAME_FLAG_ERR_SW_OVERRUN - SW buffer overrun. */ CAN_FRAME_FLAG_ERR_SW_OVERRUN = 1024, /** CAN_FRAME_FLAG_ERR_STUFF - Stuff error. */ CAN_FRAME_FLAG_ERR_STUFF = 2048, /** CAN_FRAME_FLAG_ERR_FORM - Form error. */ CAN_FRAME_FLAG_ERR_FORM = 4096, /** CAN_FRAME_FLAG_ERR_CRC - CRC error. */ CAN_FRAME_FLAG_ERR_CRC = 8192, /** CAN_FRAME_FLAG_ERR_BIT0 - Sent dominant, read recessive. */ CAN_FRAME_FLAG_ERR_BIT0 = 16384, /** CAN_FRAME_FLAG_ERR_BIT1 - Sent recessive, read dominant. */ CAN_FRAME_FLAG_ERR_BIT1 = 32768, /** CAN_FRAME_FLAG_XL_XLF - CAN XL frame. */ CAN_FRAME_FLAG_XL_XLF = 1048576, /** CAN_FRAME_FLAG_XL_VCID - CAN XL Virtual CAN network ID (VCID). */ CAN_FRAME_FLAG_XL_VCID = 2097152, UNRECOGNIZED = -1 } export declare function canFrameFlagFromJSON(object: any): CanFrameFlag; export declare function canFrameFlagToJSON(object: CanFrameFlag): string; /** Possible LIN frame flags. The flag value must match the linlib flag value. */ export declare enum LinFrameFlag { /** LIN_FRAME_FLAG_UNSPECIFIED - No flag has been set. */ LIN_FRAME_FLAG_UNSPECIFIED = 0, /** LIN_FRAME_FLAG_TX - The message was something we transmitted to the bus. */ LIN_FRAME_FLAG_TX = 1, /** LIN_FRAME_FLAG_RX - The message was something we received from the bus. */ LIN_FRAME_FLAG_RX = 2, /** LIN_FRAME_FLAG_WAKEUP_FRAME - A wake up frame was received. Id/msg/dlc are undefined. */ LIN_FRAME_FLAG_WAKEUP_FRAME = 4, /** LIN_FRAME_FLAG_NODATA - No data, only a header. */ LIN_FRAME_FLAG_NODATA = 8, /** LIN_FRAME_FLAG_CSUM_ERROR - Checksum error. */ LIN_FRAME_FLAG_CSUM_ERROR = 16, /** LIN_FRAME_FLAG_PARITY_ERROR - ID parity error. */ LIN_FRAME_FLAG_PARITY_ERROR = 32, /** LIN_FRAME_FLAG_SYNCH_ERROR - A synch error. */ LIN_FRAME_FLAG_SYNCH_ERROR = 64, /** LIN_FRAME_FLAG_BIT_ERROR - Bit error when transmitting. */ LIN_FRAME_FLAG_BIT_ERROR = 128, UNRECOGNIZED = -1 } export declare function linFrameFlagFromJSON(object: any): LinFrameFlag; export declare function linFrameFlagToJSON(object: LinFrameFlag): string; /** * A message holding a combination of CanFrameFlag enums. * This is a work-around since it's not possible to use repeated fields as oneof fields. */ export interface CanFrameFlags { /** A list of CAN frame flags. */ flags: CanFrameFlag[]; } /** * A message holding a combination of LinFrameFlag enums. * This is a work-around since it's not possible to use repeated fields as oneof fields. */ export interface LinFrameFlags { /** A list of LIN frame flags. */ flags: LinFrameFlag[]; } /** A message that holds an extra frame property. */ export interface FramePropertyValue { /** String value. */ stringValue?: string | undefined; /** Double value. */ doubleValue?: number | undefined; } /** A message that holds a signal's value. */ export interface SignalValue { /** Name of the signal. */ name: string; /** Qualified name of the signal. */ qualifiedName: string; /** Unit of the signal. */ unit: string; /** Text representation of the signal value if this is an enumeration signal. */ stringValue?: string | undefined; /** Numeric representation of the signal value. */ doubleValue: number; } /** A message describing a frame. */ export interface Frame { /** Identifier of the source node */ sourceId: string; /** Name of the source node */ sourceName: string; /** Identifier of the stream node */ streamId: string; /** Frame identifier */ id: number; /** Frame identifier */ messageName: string; /** * Frame data. Uses repeated uint32 rather than bytes because the proto bytes type * does not support individual byte access efficiently in the ts-proto generated TypeScript * bindings; repeated uint32 provides direct indexed access to each data byte. */ data: number[]; /** Flag indicating if this message was transmitted or received */ tx: boolean; /** Frame DLC */ dlc: number; /** Frame hash code, a unique key that identifies the frame */ hashCode: number; /** Extra properties */ properties: { [key: string]: FramePropertyValue; }; /** Signal values */ signalValues: SignalValue[]; /** Special CAN flags */ canFrameFlags?: CanFrameFlags | undefined; /** Special LIN flags */ linFrameFlags?: LinFrameFlags | undefined; /** Timestamp in microseconds when the frame was received or transmitted */ timeUs: Long; /** Delta time in microseconds since the previous frame with the same fixed pos identifier */ deltaTimeUs?: Long | undefined; /** Fixed position frame identifier */ fixedPosIdentifier?: string | undefined; /** Protocol used for this frame */ protocol?: string | undefined; /** Multiplexing value of the frame, used in multiplexed CAN frames */ muxValue?: number | undefined; } export interface Frame_PropertiesEntry { key: string; value: FramePropertyValue | undefined; } /** A collection of frames. */ export interface Frames { /** A list of frames. */ items: Frame[]; } /** A message describing a frame that will be used for writing message to a bus. */ export interface WriteFrame { /** Frame identifier */ id: number; /** * Frame data. Uses repeated uint32 rather than bytes because the proto bytes type * does not support individual byte access efficiently in the ts-proto generated TypeScript * bindings; repeated uint32 provides direct indexed access to each data byte. */ data: number[]; /** Special CAN flags */ canFrameFlags?: CanFrameFlags | undefined; /** Special LIN flags */ linFrameFlags?: LinFrameFlags | undefined; } /** A message describing a frame definition. */ export interface FrameDefinition { /** Frame identifier */ id: number; /** Message name */ messageName: string; /** Message qualified name */ messageQualifiedName: string; /** The frame data length */ dataLength: number; /** Signal definitions */ signals: SignalDefinition[]; /** Special CAN flags */ canFrameFlags?: CanFrameFlags | undefined; /** Identifiers of all possible source nodes */ sourceIdentifiers: string[]; } /** A collection of frame definitions. */ export interface FrameDefinitions { /** A list of frame definitions. */ items: FrameDefinition[]; } /** * A message describing database files for both database nodes and LIN channels. * @internal */ export interface DatabaseFiles { /** Database files for CAN channels */ dbcFiles: string[]; /** Database files for LIN channels */ ldfFiles: string[]; } /** * A message describing an entry in a schedule table. * @internal */ export interface ScheduleTableEntry { /** Message qualified name */ messageQualifiedName: string; /** Delay in milliseconds */ delay: number; } /** * A message describing a schedule table. * @internal */ export interface ScheduleTable { /** Name of the schedule table */ name: string; /** Qualified name of the schedule table */ qualifiedName: string; /** Schedule table entries */ entries: ScheduleTableEntry[]; } /** A message describing a fixed position frame identifier. */ export interface FixedPosFrameIdentifier { /** Frame identifier */ id: number; /** True if the frame is transmitted, false if received, undefined if both */ tx?: boolean | undefined; /** Multiplexing value of the frame, used in multiplexed CAN frames */ mux?: number | undefined; /** Identifier of the source node, accepts any source if not set */ sourceId?: string | undefined; /** Special CAN flags */ canFrameFlags?: CanFrameFlags | undefined; /** Special LIN flags */ linFrameFlags?: LinFrameFlags | undefined; } export declare const CanFrameFlags: MessageFns<CanFrameFlags>; export declare const LinFrameFlags: MessageFns<LinFrameFlags>; export declare const FramePropertyValue: MessageFns<FramePropertyValue>; export declare const SignalValue: MessageFns<SignalValue>; export declare const Frame: MessageFns<Frame>; export declare const Frame_PropertiesEntry: MessageFns<Frame_PropertiesEntry>; export declare const Frames: MessageFns<Frames>; export declare const WriteFrame: MessageFns<WriteFrame>; export declare const FrameDefinition: MessageFns<FrameDefinition>; export declare const FrameDefinitions: MessageFns<FrameDefinitions>; export declare const DatabaseFiles: MessageFns<DatabaseFiles>; export declare const ScheduleTableEntry: MessageFns<ScheduleTableEntry>; export declare const ScheduleTable: MessageFns<ScheduleTable>; export declare const FixedPosFrameIdentifier: MessageFns<FixedPosFrameIdentifier>; 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 {};