package serialport

  1. Overview
  2. Docs
Serial communication library

Install

dune-project
 Dependency

Authors

Maintainers

Sources

0.1.tar.gz
md5=b560d273759979f59b129fe5bee51dc3
sha512=409badc4e2f5a6391c9e9451b010b0f003103d6ae29911a9e7d8c368dfd9c970d047eb091bdb598424f430436646ec7dc17842457e2eb97f7ab5225cba2c9fb3

doc/serialport.unix/Serialport_unix/index.html

Module Serialport_unixSource

The module provides a simple synchronization interface for non-concurrent programs, as well as a low-level native abstraction for setting up serial ports and configuring them.

Sourcetype t

Interface for a opened serial port.

Sourceval open_communication : ?exclusive:bool -> opts:Port_options.t -> string -> t

open_communication ~opts port_name open the serial port using the specified opts configuration.

  • raises Unix.Unix_error
Sourceval with_open_communication : ?exclusive:bool -> opts:Port_options.t -> string -> (t -> 'a) -> 'a

with_open_communication ~opts port_name callback similar to open_communication but with an auto-closing mechanism.

  • raises Unix.Unix_error
Sourceval close_communication : t -> unit

close ser_port close the serial port.

I/O

Channels

Sourceval to_channels : ?buffered:bool -> t -> in_channel * out_channel

to_channels ?buffered ser_port

  • parameter buffered

    Enable output buffering (by default is disable).

  • returns

    Channel abstraction pair for input/output tasks.

Unix interface

Sourceval write : t -> bytes -> int -> int -> int

write ser_port buf off len the buf bytes to serial port.

Alias for Unix.write.

Sourceval read : t -> bytes -> int -> int -> int

read ser_port buf off len the serial port to buf bytes.

Alias for Unix.read.

Sourceval unsafe_unix_fd : t -> Unix.file_descr

Modem

Sourcemodule Modem : sig ... end

Modem controls.

Exclusive

Sourceval set_exclusive : t -> bool -> unit

set_exclusive ser_port enable

Exceptions

Sourceexception Not_found_port of string

raise if the port name does not exist.

Pretty print

Sourceval pp : Format.formatter -> t -> unit