libserialport  0.1.0
cross-platform library for accessing serial ports
 All Data Structures Files Functions Variables Enumerations Enumerator Groups Pages
libserialport API

Introduction

libserialport is a minimal library written in C that is intended to take care of the OS-specific details when writing software that uses serial ports.

By writing your serial code to use libserialport, you enable it to work transparently on any platform supported by the library.

The operations that are supported are:

libserialport is an open source project released under the LGPL3+ license.

API principles

The API is simple, and designed to be a minimal wrapper around the serial port support in each OS.

Most functions take a pointer to a struct sp_port, which represents a serial port. These structures are always allocated and freed by the library, using the functions in the Enumeration section.

Most functions have return type sp_return and can return only four possible error values:

All of these error values are negative.

Calls that succeed return SP_OK, which is equal to zero. Some functions declared sp_return can also return a positive value for a successful numeric result, e.g. sp_blocking_read() or sp_blocking_write().