Skip to content

CL API

Overview

The CL API is used to communicate with and configure Kvaser's Automotive Ethernet products.

It is a C based interface library and comes both in a static and shared variant. There is a companion terminal application that can be used to configure a Automotive Ethernet device without having to build your own application. There is also a GUI application, Kvaser CL Configuration Tool, available for download on kvaser.com.

Supported platforms

We currently provide binaries for the following platforms:

  • Linux x86_64
  • Windows x86 (32Bit)
  • Windows x86_64 (64Bit)

Usage example

The API reference can be found here here. A small sample application is distributed with each release under the samples folder and might be suitable as a starting point when building your own application. They can be built on either Windows or Linux.

A minimal example is given below that initializes the library, scans for devices and prints the serial number of each device.

minimal.c
#include <cl/cl_api.h>
#include <stdio.h>

int main(int argc, const char** argv)
{
    // Unused
    (void) argc;
    (void) argv;

    // error handling has been omitted for brevity

    cl_client_t* client = cl_client_create();
    cl_device_list_t* device_list;
    cl_client_scan_for_devices_with_timeout(client, &device_list, 500);

    cl_device_iterator_t* iter = cl_device_iterator_create(device_list);
    cl_device_t* device = cl_device_iterator_next(iter);
    while(device){
        uint64_t serial;
        cl_device_get_serial_number(device, &serial);
        printf("Device serial: %06lu\n", serial);
        device = cl_device_iterator_next(iter);
    }

    cl_device_iterator_destroy(iter);
    cl_device_list_destroy(device_list);
    cl_client_destroy(client);

    return 0;
}

Supported language bindings

The API is a C based library and bindings can be created for most other languages. Python bindings are provided as a separate package.

You are welcome to contact [email protected] to suggest additional language bindings.

Python bindings

The official Python wrapper can be installed directly from the Python Package Index(PyPI) by running:

pip install kvaser-cl-api