Status Codes

Return codes from the CANlib functions. More...

Enumerations

enum  canStatus {
  canOK = 0,
  canERR_PARAM = -1,
  canERR_NOMSG = -2,
  canERR_NOTFOUND = -3,
  canERR_NOMEM = -4,
  canERR_NOCHANNELS = -5,
  canERR_INTERRUPTED = -6,
  canERR_TIMEOUT = -7,
  canERR_NOTINITIALIZED = -8,
  canERR_NOHANDLES = -9,
  canERR_INVHANDLE = -10,
  canERR_INIFILE = -11,
  canERR_DRIVER = -12,
  canERR_TXBUFOFL = -13,
  canERR_RESERVED_1 = -14,
  canERR_HARDWARE = -15,
  canERR_DYNALOAD = -16,
  canERR_DYNALIB = -17,
  canERR_DYNAINIT = -18,
  canERR_NOT_SUPPORTED = -19,
  canERR_RESERVED_5 = -20,
  canERR_RESERVED_6 = -21,
  canERR_RESERVED_2 = -22,
  canERR_DRIVERLOAD = -23,
  canERR_DRIVERFAILED = -24,
  canERR_NOCONFIGMGR = -25,
  canERR_NOCARD = -26,
  canERR_RESERVED_7 = -27,
  canERR_REGISTRY = -28,
  canERR_LICENSE = -29,
  canERR_INTERNAL = -30,
  canERR_NO_ACCESS = -31,
  canERR_NOT_IMPLEMENTED = -32,
  canERR_DEVICE_FILE = -33,
  canERR_HOST_FILE = -34,
  canERR_DISK = -35,
  canERR_CRC = -36,
  canERR_CONFIG = -37,
  canERR_MEMO_FAIL = -38,
  canERR_SCRIPT_FAIL = -39,
  canERR_SCRIPT_WRONG_VERSION = -40,
  canERR_SCRIPT_TXE_CONTAINER_VERSION = -41,
  canERR_SCRIPT_TXE_CONTAINER_FORMAT = -42,
  canERR_BUFFER_TOO_SMALL = -43,
  canERR_IO_WRONG_PIN_TYPE = -44,
  canERR_IO_NOT_CONFIRMED = -45,
  canERR_IO_CONFIG_CHANGED = -46,
  canERR_IO_PENDING = -47,
  canERR_IO_NO_VALID_CONFIG = -48,
  canERR__RESERVED = -49
}
 

Detailed Description

Return codes from the CANlib functions.

Generally, a return code greater than or equal to zero means success.
A value less than zero means failure.

You should avoid testing for a specific error code unless it is explicitly
stated in the documentation for the API in question that this specific error
code is returned. Instead, check if the error code is less than zero.
Use canGetErrorText() to obtain an error message suitable for a message to the
user, or for a line in an error log file.

Enumeration Type Documentation

◆ canStatus

enum canStatus
Enumerator
canOK 

Normal successful completion; The driver is just fine, and really believes it carried out your command to everyone's satisfaction.

canERR_PARAM 

Error in one or more parameters; a parameter specified in the call was invalid, out of range, or so. This status code will also be returned when the call is not implemented.

canERR_NOMSG 

There were no messages to read; A function tried to read a message, but there was no message to read.

canERR_NOTFOUND 

Specified device or channel not found. There is no hardware available that matches the given search criteria. For example, you may have specified canOPEN_REQUIRE_EXTENDED but there's no controller capable of extended CAN. You may have specified a channel number that is out of the range for the hardware in question. You may have requested exclusive access to a channel, but the channel is already occupied.

canERR_NOMEM 

Out of memory; A memory allocation failed.

canERR_NOCHANNELS 

No channels available; There is indeed hardware matching the criteria you specified, but there are no channels available, or the channel you specified is already occupied.

canERR_INTERRUPTED 

Interrupted by signals.

canERR_TIMEOUT 

Timeout occurred; A function waited for something to happen (for example, the arrival of a message), but that something didn't happen.

canERR_NOTINITIALIZED 

The library is not initialized; The driver is not initialized. canInitializeLibrary() was probably not called?

canERR_NOHANDLES 

Out of handles; No handles are available inside canlib32. The application has too many handles open (i.e. has called canOpenChannel() too many times, or there's a memory leak somewhere.)

Note
We are not talking about Windows handles here, it's CANLIB's own internal handles.
canERR_INVHANDLE 

Handle is invalid; The CANLIB handle you specified (if the API call includes a handle) is not valid. Ensure you are passing the handle and not, for example, a channel number.

canERR_INIFILE 

Error in the ini-file (16-bit only)

canERR_DRIVER 

Driver type not supported; CAN driver mode is not supported by the present hardware.

canERR_TXBUFOFL 

Transmit buffer overflow; The transmit queue was full, so the message was dropped.

canERR_RESERVED_1 

Reserved.

canERR_HARDWARE 

A hardware error has occurred; Something probably related to the hardware happened. This could mean that the device does not respond (IRQ or address conflict?), or that the response was invalid or unexpected (faulty card?).

canERR_DYNALOAD 

A driver DLL can't be found or loaded; (One of) the DLL(s) specified in the registry failed to load. This could be a driver installation problem.

canERR_DYNALIB 

A DLL seems to have wrong version; DLL version mismatch. (One of) the DLL(s) specified in the registry is - probably - too old, or - less likely - too new.

canERR_DYNAINIT 

Error when initializing a DLL; Something failed when a device driver was being initialized. In other words, we can open the driver but it makes a lot of fuss about something we don't understand.

canERR_NOT_SUPPORTED 

Operation not supported by hardware or firmware.

canERR_RESERVED_5 

Reserved.

canERR_RESERVED_6 

Reserved.

canERR_RESERVED_2 

Reserved.

canERR_DRIVERLOAD 

Can't find or load kernel driver; A device driver (kernel mode driver for NT, VxD for W95/98) failed to load; or the DLL could not open the device. Privileges? Driver file missing?

canERR_DRIVERFAILED 

DeviceIOControl failed; Use Win32 GetLastError() to learn what really happened.

canERR_NOCONFIGMGR 

Can't find req'd config s/w (e.g. CS/SS)

canERR_NOCARD 

The card was removed or not inserted.

canERR_RESERVED_7 

Reserved.

canERR_REGISTRY 

Error (missing data) in the Registry; A registry key is missing, invalid, malformed, has gone for lunch or what not. can_verify.exe might provide some insight.

canERR_LICENSE 

The license is not valid.

canERR_INTERNAL 

Internal error in the driver; Indicates an error condition in the driver or DLL, which couldn't be properly handled. Please contact the friendly support at suppo.nosp@m.rt@k.nosp@m.vaser.nosp@m..com.

canERR_NO_ACCESS 

Access denied; This means that you tried to set the bit rate on a handle to which you haven't got init access or you tried to open a channel that already is open with init access. See canOpenChannel() for more information about init access.

canERR_NOT_IMPLEMENTED 

Not implemented; The requested feature or function is not implemented in the device you are trying to use it on.

canERR_DEVICE_FILE 

Device File error; An error has occured when trying to access a file on the device.

canERR_HOST_FILE 

Host File error; An error has occured when trying to access a file on the host.

canERR_DISK 

Disk error; A disk error has occurred. Verify that the disk is initialized.

canERR_CRC 

CRC error; The CRC calculation did not match the expected result.

canERR_CONFIG 

Configuration Error; The configuration is corrupt.

canERR_MEMO_FAIL 

Memo Error; Other configuration error.

canERR_SCRIPT_FAIL 

Script Fail; A script has failed.

Note
This code represents several different failures, for example:
  • Trying to load a corrupt file or not a .txe file
  • Trying to start a t script that has not been loaded
  • Trying to load a t script compiled with the wrong version of the t compiler
  • Trying to unload a t script that has not been stopped
  • Trying to use an envvar that does not exist
canERR_SCRIPT_WRONG_VERSION 

The t script version dosen't match the version(s) that the device firmware supports.;

canERR_SCRIPT_TXE_CONTAINER_VERSION 

The compiled t script container file format is of a version which is not supported by this version of canlib.;

canERR_SCRIPT_TXE_CONTAINER_FORMAT 

An error occured while trying to parse the compiled t script file.;

canERR_BUFFER_TOO_SMALL 

The buffer provided was not large enough to contain the requested data.;

canERR_IO_WRONG_PIN_TYPE 

The I/O pin doesn't exist or the I/O pin type doesn't match the called function, e.g. trying to use input pins as outputs or use digital pins as analog pins. ;

canERR_IO_NOT_CONFIRMED 

The I/O pin configuration is not confirmed. Use kvIoConfirmConfig() to confirm the configuration.;

canERR_IO_CONFIG_CHANGED 

The I/O pin configuration has changed after last call to kvIoConfirmConfig. Use kvIoConfirmConfig() to confirm the new configuration. ;

canERR_IO_PENDING 

The previous I/O pin value has not yet changed the output and is still pending. This happens when e.g. kvIoPinSetAnalog() is called twice on the same pin within a short time. ;

canERR_IO_NO_VALID_CONFIG 

There is no valid I/O pin configuration.

canERR__RESERVED 

Reserved.