@kvaser/canking-api
Version:
CanKing API to communicate with the CanKing service using Node.js.
200 lines (199 loc) • 7.27 kB
TypeScript
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 = 0,
CAN_FRAME_FLAG_RTR = 1,
CAN_FRAME_FLAG_STD = 2,
CAN_FRAME_FLAG_EXT = 4,
CAN_FRAME_FLAG_WAKEUP = 8,
CAN_FRAME_FLAG_NERR = 16,
CAN_FRAME_FLAG_ERROR_FRAME = 32,
CAN_FRAME_FLAG_TXACK = 64,
CAN_FRAME_FLAG_TXRQ = 128,
CAN_FRAME_FLAG_DELAY_MSG = 256,
CAN_FRAME_FLAG_LOCAL_TXACK = 268435456,
CAN_FRAME_FLAG_SINGLE_SHOT = 16777216,
CAN_FRAME_FLAG_TXNACK = 33554432,
CAN_FRAME_FLAG_ABL = 67108864,
CAN_FRAME_FLAG_FD_FDF = 65536,
CAN_FRAME_FLAG_FD_BRS = 131072,
CAN_FRAME_FLAG_FD_ESI = 262144,
CAN_FRAME_FLAG_ERR_HW_OVERRUN = 512,
CAN_FRAME_FLAG_ERR_SW_OVERRUN = 1024,
CAN_FRAME_FLAG_ERR_STUFF = 2048,
CAN_FRAME_FLAG_ERR_FORM = 4096,
CAN_FRAME_FLAG_ERR_CRC = 8192,
CAN_FRAME_FLAG_ERR_BIT0 = 16384,
CAN_FRAME_FLAG_ERR_BIT1 = 32768,
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 = 0,
LIN_FRAME_FLAG_TX = 1,
LIN_FRAME_FLAG_RX = 2,
LIN_FRAME_FLAG_WAKEUP_FRAME = 4,
LIN_FRAME_FLAG_NODATA = 8,
LIN_FRAME_FLAG_CSUM_ERROR = 16,
LIN_FRAME_FLAG_PARITY_ERROR = 32,
LIN_FRAME_FLAG_SYNCH_ERROR = 64,
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 {
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 {
flags: LinFrameFlag[];
}
/** A message that holds an extra frame property. */
export interface FramePropertyValue {
stringValue?: string | undefined;
doubleValue?: number | undefined;
}
/** A message that holds a signal's value. */
export interface SignalValue {
name: string;
qualifiedName: string;
unit: string;
stringValue?: string | undefined;
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 */
data: number[];
/** Timestamp in seconds when the frame was recieved or transmitted */
time: number;
/** Flag indicating if this message was transmitted or recieved */
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;
}
export interface Frame_PropertiesEntry {
key: string;
value: FramePropertyValue | undefined;
}
export interface 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, TODO: Why doesn't it work using bytes? */
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;
}
export interface FrameDefinitions {
items: FrameDefinition[];
}
/** A message describing database files for both database nodes and LIN channels. */
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. */
export interface ScheduleTableEntry {
/** Message qualified name */
messageQualifiedName: string;
/** Delay in milliseconds */
delay: number;
}
/** A message describing a schedule table. */
export interface ScheduleTable {
/** Name of the schedule table */
name: string;
/** Qualified name of the schedule table */
qualifiedName: string;
/** Schedule table entries */
entries: ScheduleTableEntry[];
}
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>;
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 {};