// PCANBasic.pas // // ~~~~~~~~~~~~ // // PCAN-Basic API // // ~~~~~~~~~~~~ // // ------------------------------------------------------------------ // Author : Keneth Wagner // Last change: 08.11.2011 Wagner // // Language: Pascal OO // ------------------------------------------------------------------ // // Copyright (C) 1999-2012 PEAK-System Technik GmbH, Darmstadt // more Info at http://www.peak-system.com // unit PCANBasic; interface type TPCANHandle = Byte; {$Z4} /// /// Represents a PCAN status/error code /// TPCANStatus = ( /// /// No error /// PCAN_ERROR_OK = $00000, /// /// Transmit buffer in CAN controller is full /// PCAN_ERROR_XMTFULL = $00001, /// /// CAN controller was read too late /// PCAN_ERROR_OVERRUN = $00002, /// /// Bus error: an error counter reached the 'light' limit /// PCAN_ERROR_BUSLIGHT = $00004, /// /// Bus error: an error counter reached the 'heavy' limit /// PCAN_ERROR_BUSHEAVY = $00008, /// /// Bus error: the CAN controller is in bus-off state /// PCAN_ERROR_BUSOFF = $00010, /// /// Mask for all bus errors /// PCAN_ERROR_ANYBUSERR = Byte(PCAN_ERROR_BUSLIGHT) Or Byte(PCAN_ERROR_BUSHEAVY) Or Byte(PCAN_ERROR_BUSOFF), /// /// Receive queue is empty /// PCAN_ERROR_QRCVEMPTY = $00020, /// /// Receive queue was read too late /// PCAN_ERROR_QOVERRUN = $00040, /// /// Transmit queue is full /// PCAN_ERROR_QXMTFULL = $00080, /// /// Test of the CAN controller hardware registers failed (no hardware found) /// PCAN_ERROR_REGTEST = $00100, /// /// Driver not loaded /// PCAN_ERROR_NODRIVER = $00200, /// /// Hardware already in use by a Net /// PCAN_ERROR_HWINUSE = $00400, /// /// A Client is already connected to the Net /// PCAN_ERROR_NETINUSE = $00800, /// /// Hardware handle is invalid /// PCAN_ERROR_ILLHW = $01400, /// /// Net handle is invalid /// PCAN_ERROR_ILLNET = $01800, /// /// Client handle is invalid /// PCAN_ERROR_ILLCLIENT = $01C00, /// /// Mask for all handle errors /// PCAN_ERROR_ILLHANDLE = Byte(PCAN_ERROR_ILLHW) Or Byte(PCAN_ERROR_ILLNET) Or Byte(PCAN_ERROR_ILLCLIENT), /// /// Resource (FIFO, Client, timeout) cannot be created /// PCAN_ERROR_RESOURCE = $02000, /// /// Invalid parameter /// PCAN_ERROR_ILLPARAMTYPE = $04000, /// /// Invalid parameter value /// PCAN_ERROR_ILLPARAMVAL = $08000, /// /// Unknow error /// PCAN_ERROR_UNKNOWN = $10000, /// /// Invalid data, function, or action /// PCAN_ERROR_ILLDATA = $20000, /// /// Channel is not initialized /// PCAN_ERROR_INITIALIZE = $40000 ); {$Z1} /// /// Represents a PCAN device /// TPCANDevice = ( /// /// Undefined, unknown or not selected PCAN device value /// PCAN_NONE = 0, /// /// PCAN Non-Plug&Play devices. NOT USED WITHIN PCAN-Basic API /// PCAN_PEAKCAN = 1, /// /// PCAN-ISA, PCAN-PC/104, and PCAN-PC/104-Plus /// PCAN_ISA = 2, /// /// PCAN-Dongle /// PCAN_DNG = 3, /// /// PCAN-PCI, PCAN-cPCI, PCAN-miniPCI, and PCAN-PCI Express /// PCAN_PCI = 4, /// /// PCAN-USB and PCAN-USB Pro /// PCAN_USB = 5, /// /// PCAN-PC Card /// PCAN_PCC = 6 ); /// /// Represents a PCAN parameter to be read or set /// TPCANParameter = ( /// /// PCAN-USB device number parameter /// PCAN_DEVICE_NUMBER = 1, /// /// PCAN-PC Card 5-Volt power parameter /// PCAN_5VOLTS_POWER = 2, /// /// PCAN receive event handler parameter /// PCAN_RECEIVE_EVENT = 3, /// /// PCAN message filter parameter /// PCAN_MESSAGE_FILTER = 4, /// /// PCAN-Basic API version parameter /// PCAN_API_VERSION = 5, /// /// PCAN device channel version parameter /// PCAN_CHANNEL_VERSION = 6, /// /// PCAN Reset-On-Busoff parameter /// PCAN_BUSOFF_AUTORESET = 7, /// /// PCAN Listen-Only parameter /// PCAN_LISTEN_ONLY = 8, /// /// Directory path for trace files /// PCAN_LOG_LOCATION = 9, /// /// Debug-Trace activation status /// PCAN_LOG_STATUS = 10, /// /// Configuration of the debugged information (LOG_FUNCTION_***) /// PCAN_LOG_CONFIGURE = 11, /// /// Custom insertion of text into the log file /// PCAN_LOG_TEXT = 12, /// /// Availability status of a PCAN-Channel /// PCAN_CHANNEL_CONDITION = 13, /// /// PCAN hardware name parameter /// PCAN_HARDWARE_NAME = 14, /// /// Message reception status of a PCAN-Channel /// PCAN_RECEIVE_STATUS = 15, /// /// CAN-Controller number of a PCAN-Channel /// PCAN_CONTROLLER_NUMBER = 16 ); /// /// Represents the type of a PCAN message /// TPCANMessageType = ( /// /// The PCAN message is a CAN Standard Frame (11-bit identifier) /// PCAN_MESSAGE_STANDARD = $00, /// /// The PCAN message is a CAN Remote-Transfer-Request Frame /// PCAN_MESSAGE_RTR = $01, /// /// The PCAN message is a CAN Extended Frame (29-bit identifier) /// PCAN_MESSAGE_EXTENDED = $02, /// /// The PCAN message represents a PCAN status message /// PCAN_MESSAGE_STATUS = $80 ); /// /// Represents a PCAN filter mode /// TPCANMode = ( /// /// Mode is Standard (11-bit identifier) /// PCAN_MODE_STANDARD = Byte(PCAN_MESSAGE_STANDARD), /// /// Mode is Extended (29-bit identifier) /// PCAN_MODE_EXTENDED = Byte(PCAN_MESSAGE_EXTENDED) ); {$Z2} /// /// Represents a PCAN Baud rate register value /// TPCANBaudrate = ( /// /// 1 MBit/s /// PCAN_BAUD_1M = $0014, /// /// 800 kBit/s /// PCAN_BAUD_800K = $0016, /// /// 500 kBit/s /// PCAN_BAUD_500K = $001C, /// /// 250 kBit/s /// PCAN_BAUD_250K = $011C, /// /// 125 kBit/s /// PCAN_BAUD_125K = $031C, /// /// 100 kBit/s /// PCAN_BAUD_100K = $432F, /// /// 95,238 kBit/s /// PCAN_BAUD_95K = $C34E, /// /// 83,333 kBit/s /// PCAN_BAUD_83K = $4B14, /// /// 50 kBit/s /// PCAN_BAUD_50K = $472F, /// /// 47,619 kBit/s /// PCAN_BAUD_47K = $1414, /// /// 33,333 kBit/s /// PCAN_BAUD_33K = $1D14, /// /// 20 kBit/s /// PCAN_BAUD_20K = $532F, /// /// 10 kBit/s /// PCAN_BAUD_10K = $672F, /// /// 5 kBit/s /// PCAN_BAUD_5K = $7F7F ); {$Z1} /// /// Represents the type of PCAN (non plug&play) hardware to be initialized /// TPCANType = ( /// /// PCAN-ISA 82C200 /// PCAN_TYPE_ISA = $01, /// /// PCAN-ISA SJA1000 /// PCAN_TYPE_ISA_SJA = $09, /// /// PHYTEC ISA /// PCAN_TYPE_ISA_PHYTEC = $04, /// /// PCAN-Dongle 82C200 /// PCAN_TYPE_DNG = $02, /// /// PCAN-Dongle EPP 82C200 /// PCAN_TYPE_DNG_EPP = $03, /// /// PCAN-Dongle SJA1000 /// PCAN_TYPE_DNG_SJA = $05, /// /// PCAN-Dongle EPP SJA1000 /// PCAN_TYPE_DNG_SJA_EPP = $06 ); /// /// Represents a PCAN message /// TPCANMsg = record /// /// 11/29-bit message identifier /// ID: Longword; /// /// Type of the message /// MSGTYPE: TPCANMessageType; /// /// Data Length Code of the message (0..8) /// LEN: Byte; /// /// Data of the message (DATA[0]..DATA[7]) /// DATA: array[0..7] of Byte; end; /// /// Represents a timestamp of a received PCAN message. /// Total Microseconds = micros + 1000 * millis + 0xFFFFFFFF * 1000 * millis_overflow /// TPCANTimestamp = record /// /// Base-value: milliseconds: 0.. 2^32-1 /// millis: Longword; /// /// Roll-arounds of millis /// millis_overflow: Word; /// /// Microseconds: 0..999 /// micros: Word; end; PTPCANTimestamp = ^TPCANTimestamp; /// /// PCAN-Basic API class implementation /// TPCANBasic = class public class var /// /// Undefined/default value for a PCAN bus /// const PCAN_NONEBUS: TPCANHandle = $00; /// /// PCAN-ISA interface, channel 1 /// const PCAN_ISABUS1: TPCANHandle = $21; /// /// PCAN-ISA interface, channel 2 /// const PCAN_ISABUS2: TPCANHandle = $22; /// /// PCAN-ISA interface, channel 3 /// const PCAN_ISABUS3: TPCANHandle = $23; /// /// PCAN-ISA interface, channel 4 /// const PCAN_ISABUS4: TPCANHandle = $24; /// /// PCAN-ISA interface, channel 5 /// const PCAN_ISABUS5: TPCANHandle = $25; /// /// PCAN-ISA interface, channel 6 /// const PCAN_ISABUS6: TPCANHandle = $26; /// /// PCAN-ISA interface, channel 7 /// const PCAN_ISABUS7: TPCANHandle = $27; /// /// PCAN-ISA interface, channel 8 /// const PCAN_ISABUS8: TPCANHandle = $28; /// /// PPCAN-Dongle/LPT interface, channel 1 /// const PCAN_DNGBUS1: TPCANHandle = $31; /// /// PCAN-PCI interface, channel 1 /// const PCAN_PCIBUS1: TPCANHandle = $41; /// /// PCAN-PCI interface, channel 2 /// const PCAN_PCIBUS2: TPCANHandle = $42; /// /// PCAN-PCI interface, channel 3 /// const PCAN_PCIBUS3: TPCANHandle = $43; /// /// PCAN-PCI interface, channel 4 /// const PCAN_PCIBUS4: TPCANHandle = $44; /// /// PCAN-PCI interface, channel 5 /// const PCAN_PCIBUS5: TPCANHandle = $45; /// /// PCAN-PCI interface, channel 6 /// const PCAN_PCIBUS6: TPCANHandle = $46; /// /// PCAN-PCI interface, channel 7 /// const PCAN_PCIBUS7: TPCANHandle = $47; /// /// PCAN-PCI interface, channel 8 /// const PCAN_PCIBUS8: TPCANHandle = $48; /// /// PCAN-USB interface, channel 1 /// const PCAN_USBBUS1: TPCANHandle = $51; /// /// PCAN-USB interface, channel 2 /// const PCAN_USBBUS2: TPCANHandle = $52; /// /// PCAN-USB interface, channel 3 /// const PCAN_USBBUS3: TPCANHandle = $53; /// /// PCAN-USB interface, channel 4 /// const PCAN_USBBUS4: TPCANHandle = $54; /// /// PCAN-USB interface, channel 5 /// const PCAN_USBBUS5: TPCANHandle = $55; /// /// PCAN-USB interface, channel 6 /// const PCAN_USBBUS6: TPCANHandle = $56; /// /// PCAN-USB interface, channel 7 /// const PCAN_USBBUS7: TPCANHandle = $57; /// /// PCAN-USB interface, channel 8 /// const PCAN_USBBUS8: TPCANHandle = $58; /// /// PCAN-PC Card interface, channel 1 /// const PCAN_PCCBUS1: TPCANHandle = $61; /// /// PCAN-PC Card interface, channel 2 /// const PCAN_PCCBUS2: TPCANHandle = $62; /// /// The PCAN parameter is not set (inactive) /// const PCAN_PARAMETER_OFF: Integer = 0; /// /// The PCAN parameter is set (active) /// const PCAN_PARAMETER_ON: Integer = 1; /// /// The PCAN filter is closed. No messages will be received /// const PCAN_FILTER_CLOSE: Integer = 0; /// /// The PCAN filter is fully opened. All messages will be received /// const PCAN_FILTER_OPEN: Integer = 1; /// /// The PCAN filter is custom configured. Only registered /// messages will be received /// const PCAN_FILTER_CUSTOM: Integer = 2; /// /// The PCAN-Channel handle is illegal, or its associated hadware is not available /// const PCAN_CHANNEL_UNAVAILABLE: Integer = 0; /// /// The PCAN-Channel handle is available to be connected (Plug&Play Hardware: it means futhermore that the hardware is plugged-in) /// const PCAN_CHANNEL_AVAILABLE: Integer = 1; /// /// The PCAN-Channel handle is valid, and is already being used /// const PCAN_CHANNEL_OCCUPIED: Integer = 2; /// /// Logs system exceptions / errors /// const LOG_FUNCTION_DEFAULT: Integer = $00; /// /// Logs the entries to the PCAN-Basic API functions /// const LOG_FUNCTION_ENTRY: Integer = $01; /// /// Logs the parameters passed to the PCAN-Basic API functions /// const LOG_FUNCTION_PARAMETERS: Integer = $02; /// /// Logs the exits from the PCAN-Basic API functions /// const LOG_FUNCTION_LEAVE: Integer = $04; /// /// Logs the CAN messages passed to the CAN_Write function /// const LOG_FUNCTION_WRITE: Integer = $08; /// /// Logs the CAN messages received within the CAN_Read function /// const LOG_FUNCTION_READ: Integer = $10; /// /// Logs all possible information within the PCAN-Basic API functions /// const LOG_FUNCTION_ALL: Integer = $FFFF; /// /// Initializes a PCAN Channel /// /// The handle of a PCAN Channel /// The speed for the communication (BTR0BTR1 code) /// NON PLUG&PLAY: The type of hardware and operation mode /// NON PLUG&PLAY: The I/O address for the parallel port /// NON PLUG&PLAY: Interrupt number of the parallel port /// A TPCANStatus error code class function Initialize( Channel: TPCANHandle; Btr0Btr1: TPCANBaudrate; HwType: TPCANType; IOPort: LongWord; Interrupt: Word ): TPCANStatus; overload; /// /// Initializes a PCAN Channel /// /// The handle of a PCAN Channel /// The speed for the communication (BTR0BTR1 code) /// A TPCANStatus error code class function Initialize( Channel: TPCANHandle; Btr0Btr1: TPCANBaudrate ): TPCANStatus; overload; /// /// Uninitializes one or all PCAN Channels initialized by CAN_Initialize /// /// Giving the TPCANHandle value "PCAN_NONEBUS", /// uninitialize all initialized channels /// The handle of a PCAN Channel /// A TPCANStatus error code class function Uninitialize( Channel: TPCANHandle ): TPCANStatus; /// /// Resets the receive and transmit queues of the PCAN Channel /// /// A reset of the CAN controller is not performed /// The handle of a PCAN Channel /// A TPCANStatus error code class function Reset( Channel: TPCANHandle ): TPCANStatus; /// /// Gets the current status of a PCAN Channel /// /// The handle of a PCAN Channel /// A TPCANStatus error code class function GetStatus( Channel: TPCANHandle ): TPCANStatus; /// /// Reads a CAN message from the receive queue of a PCAN Channel /// /// The handle of a PCAN Channel /// A TPCANMsg structure buffer to store the CAN message /// A TPCANTimestamp structure buffer to get /// the reception time of the message /// A TPCANStatus error code class function Read( Channel: TPCANHandle; var MessageBuffer: TPCANMsg; var TimestampBuffer: TPCANTimestamp ):TPCANStatus; overload; /// /// Reads a CAN message from the receive queue of a PCAN Channel /// /// The handle of a PCAN Channel /// A TPCANMsg structure buffer to store the CAN message /// A TPCANStatus error code class function Read( Channel: TPCANHandle; var MessageBuffer: TPCANMsg ): TPCANStatus; overload; /// /// Transmits a CAN message /// /// The handle of a PCAN Channel /// A TPCANMsg buffer with the message to be sent /// A TPCANStatus error code class function Write( Channel: TPCANHandle; var MessageBuffer: TPCANMsg ): TPCANStatus; /// /// Configures the reception filter /// /// The message filter will be expanded with every call to /// this function. If it is desired to reset the filter, please use /// the 'SetValue' function /// The handle of a PCAN Channel /// The lowest CAN ID to be received /// The highest CAN ID to be received /// Message type, Standard (11-bit identifier) or /// Extended (29-bit identifier) /// A TPCANStatus error code class function FilterMessages( Channel: TPCANHandle; FromID: LongWord; ToID: LongWord; Mode: TPCANMode ): TPCANStatus; /// /// Retrieves a PCAN Channel value /// /// Parameters can be present or not according with the kind /// of Hardware (PCAN Channel) being used. If a parameter is not available, /// a PCAN_ERROR_ILLPARAMTYPE error will be returned /// The handle of a PCAN Channel /// The TPCANParameter parameter to get /// Buffer for the parameter value /// Size in bytes of the buffer /// A TPCANStatus error code class function GetValue( Channel: TPCANHandle; Parameter: TPCANParameter; NumericBuffer: PLongWord; BufferLength: LongWord ): TPCANStatus; overload; /// /// Retrieves a PCAN Channel value /// /// Parameters can be present or not according with the kind /// of Hardware (PCAN Channel) being used. If a parameter is not available, /// a PCAN_ERROR_ILLPARAMTYPE error will be returned /// The handle of a PCAN Channel /// The TPCANParameter parameter to get /// Buffer for the parameter value /// Size in bytes of the buffer /// A TPCANStatus error code class function GetValue( Channel: TPCANHandle; Parameter: TPCANParameter; StringBuffer: PAnsiChar; BufferLength: LongWord ): TPCANStatus; overload; /// /// Configures or sets a PCAN Channel value /// /// Parameters can be present or not according with the kind /// of Hardware (PCAN Channel) being used. If a parameter is not available, /// a PCAN_ERROR_ILLPARAMTYPE error will be returned /// The handle of a PCAN Channel /// The TPCANParameter parameter to set /// Buffer with the value to be set /// Size in bytes of the buffer /// A TPCANStatus error code class function SetValue( Channel: TPCANHandle; Parameter: TPCANParameter; NumericBuffer: PLongWord; BufferLength: LongWord ): TPCANStatus; overload; /// /// Configures or sets a PCAN Channel value /// /// Parameters can be present or not according with the kind /// of Hardware (PCAN Channel) being used. If a parameter is not available, /// a PCAN_ERROR_ILLPARAMTYPE error will be returned /// The handle of a PCAN Channel /// The TPCANParameter parameter to set /// Buffer with the value to be set /// Size in bytes of the buffer /// A TPCANStatus error code class function SetValue( Channel: TPCANHandle; Parameter: TPCANParameter; StringBuffer: PAnsiChar; BufferLength: LongWord ): TPCANStatus; overload; /// /// Returns a descriptive text of a given TPCANStatus error /// code, in any desired language /// /// The current languages available for translation are: /// Neutral (0x00), German (0x07), English (0x09), Spanish (0x0A), /// Italian (0x10) and French (0x0C) /// A TPCANStatus error code /// Indicates a 'Primary language ID' /// Buffer for the text (must be at least 256 in length) /// A TPCANStatus error code class function GetErrorText( Error: TPCANStatus; Language: Word; StringBuffer: PAnsiChar ): TPCANStatus; end; implementation uses SysUtils; const DLL_Name = 'PCANBASIC.DLL'; function CAN_Initialize(Channel: TPCANHandle; Btr0Btr1: TPCANBaudrate; HwType: TPCANType; IOPort: LongWord; Interrupt: Word): TPCANStatus; stdcall; external DLL_Name; function CAN_Uninitialize(Channel: TPCANHandle): TPCANStatus; stdcall; external DLL_Name; function CAN_Reset(Channel: TPCANHandle): TPCANStatus; stdcall; external DLL_Name; function CAN_GetStatus(Channel: TPCANHandle): TPCANStatus; stdcall; external DLL_Name; function CAN_Read(Channel: TPCANHandle; var MessageBuffer: TPCANMsg; TimestampBuffer: PTPCANTimestamp):TPCANStatus; overload; stdcall; external DLL_Name; function CAN_Write(Channel: TPCANHandle; var MessageBuffer: TPCANMsg): TPCANStatus; stdcall; external DLL_Name; function CAN_FilterMessages(Channel: TPCANHandle; FromID: LongWord; ToID: LongWord; Mode: TPCANMode): TPCANStatus; stdcall; external DLL_Name; function CAN_GetValue(Channel: TPCANHandle; Parameter: TPCANParameter; Buffer: Pointer; BufferLength: LongWord): TPCANStatus; stdcall; external DLL_Name; function CAN_SetValue(Channel: TPCANHandle; Parameter: TPCANParameter; Buffer: Pointer; BufferLength: LongWord): TPCANStatus; stdcall; external DLL_Name; function CAN_GetErrorText(Error: TPCANStatus; Language: Word; StringBuffer: PAnsiChar): TPCANStatus; stdcall; external DLL_Name; class function TPCANBasic.Initialize(Channel: TPCANHandle; Btr0Btr1: TPCANBaudrate; HwType: TPCANType; IOPort: LongWord; Interrupt: Word): TPCANStatus; begin Result:= CAN_Initialize(Channel,Btr0Btr1,HwType,IOPort,Interrupt); end; class function TPCANBasic.Initialize(Channel: TPCANHandle; Btr0Btr1: TPCANBaudrate): TPCANStatus; begin Result:= CAN_Initialize(Channel,Btr0Btr1,TPCANType(0), 0,0); end; class function TPCANBasic.Uninitialize(Channel: TPCANHandle): TPCANStatus; begin Result:= CAN_Uninitialize(Channel); end; class function TPCANBasic.Reset(Channel: TPCANHandle): TPCANStatus; begin Result:= CAN_Reset(Channel); end; class function TPCANBasic.GetStatus(Channel: TPCANHandle): TPCANStatus; begin Result:= CAN_GetStatus(Channel); end; class function TPCANBasic.Read(Channel: TPCANHandle; var MessageBuffer: TPCANMsg; var TimestampBuffer: TPCANTimestamp):TPCANStatus; begin Result:= CAN_Read(Channel, MessageBuffer, @TimestampBuffer); end; class function TPCANBasic.Read(Channel: TPCANHandle; var MessageBuffer: TPCANMsg):TPCANStatus; begin Result:= CAN_Read(Channel, MessageBuffer, nil); end; class function TPCANBasic.Write(Channel: TPCANHandle; var MessageBuffer: TPCANMsg): TPCANStatus; begin Result:= CAN_Write(Channel, MessageBuffer); end; class function TPCANBasic.FilterMessages(Channel: TPCANHandle; FromID: LongWord; ToID: LongWord; Mode: TPCANMode): TPCANStatus; begin Result:= CAN_FilterMessages(Channel, FromID,ToID,Mode); end; class function TPCANBasic.GetValue(Channel: TPCANHandle; Parameter: TPCANParameter; NumericBuffer: PLongWord; BufferLength: LongWord): TPCANStatus; begin Result:= CAN_GetValue(Channel, Parameter, NumericBuffer, BufferLength); end; class function TPCANBasic.GetValue(Channel: TPCANHandle; Parameter: TPCANParameter; StringBuffer: PAnsiChar; BufferLength: LongWord): TPCANStatus; begin Result:= CAN_GetValue(Channel, Parameter, StringBuffer, BufferLength); end; class function TPCANBasic.SetValue(Channel: TPCANHandle; Parameter: TPCANParameter; NumericBuffer: PLongWord; BufferLength: LongWord): TPCANStatus; begin Result:= CAN_SetValue(Channel, Parameter, NumericBuffer, BufferLength); end; class function TPCANBasic.SetValue(Channel: TPCANHandle; Parameter: TPCANParameter; StringBuffer: PAnsiChar; BufferLength: LongWord): TPCANStatus; begin Result:= CAN_SetValue(Channel, Parameter, StringBuffer, BufferLength); end; class function TPCANBasic.GetErrorText(Error: TPCANStatus; Language: Word; StringBuffer: PAnsiChar): TPCANStatus; begin Result:= CAN_GetErrorText(Error, Language, StringBuffer); end; end.