@yinyinfurong_zmr/dbc-can
Version:
A general purpose CAN (Controller Area Network) toolbox with support for .dbc file parsing, CAN message decoding, and more
67 lines (66 loc) • 2.75 kB
TypeScript
import { Attribute, DbcData, EnvironmentVariable, Message, NetworkBridges, Signal, ValueTable } from './DbcTypes';
declare class Writer {
dbcString: string;
constructor();
/**
* Main constructor class that will organize and write all
* attributes of DbcData structure
* @param data dbc data loaded or created using main DBC class
*/
constructFile(data: DbcData): string;
/**
*
* @param version Version of the dbc file
*/
writeVersion(version: string): void;
writeMessageTransmitters(transmitters: NetworkBridges): void;
writeNamespace(ns?: string[] | null): void;
/**
* Speed of the CAN bus, typically expressed as 250, 500, etc
* @param busConfiguration Speed of the CAN bus
*/
writeBusSpeed(busConfiguration: number | null): void;
/**
* Generic list of nodes that exist for the CAN architecture
* @param nodes List of nodes that are attached to messages and signals
*/
writeNodes(nodes: string[]): void;
/**
* Generic the signal groups as provided from the model
* @param groups Map of available signal groups to write
*/
writeSignalGroups(messages: Map<string, Message>): void;
/**
*
* @param message Individual message to be written to the file
*/
writeMessagesAndSignals(messages: Map<string, Message>): void;
/**
*
* @param signal Signal to be writen to dbc file
*/
writeSignal(signal: Signal): void;
writeBaseComment(comment: string): void;
writeMessageAndSignalComments(messages: Map<string, Message>): void;
generateEnumTable(tableMembers: ValueTable): string;
writeValTable(valueTable: Map<string, ValueTable>): void;
writeSignalTables(messages: Map<string, Message>): void;
writeEnvVarTables(environmentVariables: Map<string, EnvironmentVariable>): void;
private enumListToString;
private createAttributeDefinitionStr;
writeAttributeDefinitions(data: DbcData): void;
createAttributeDefaultString(value: Attribute): string;
writeAttributeDefaults(data: DbcData): void;
createAttributeValueString(value: Attribute, type: 'BU_' | 'BO_' | 'SG_' | null, id: number | null, node: string | null, signal: string | null): string;
writeAttributeValues(data: DbcData): void;
writeSignalDataType(messages: Map<string, Message>): void;
/**
* Main writer function for class. New line character will be added automatically
* to each line, so subsquent calls to this function
* will automatically start on the next line.
*
* @param line Line content to write to file
*/
private writeLine;
}
export default Writer;