sersock v0.1.1 Sersock

Server module to export individual serial ports thru a socket.

A single remote socket connection is supported. Each new socket connection closes and replaces the previous one. Native port is open until a connection is made and will be closed when the connection closes. Serial ports should be free while there is no connection.

Link to this section Summary

Link to this section Functions

Link to this function start_child(socket, serial)
Link to this function start_link(params, opts \\ [])

Starts the Server.

params is a keyword list to be merged with the following defaults:

%{
  port: 0,
  remote: true,
  device: "TTY",
  speed: "9600",
  config: "8N1",
}

remote is a boolean flag indicating whether to listen on any interface or on local loop interface.

port is the tcp port number where the serial port will be served.

device is the name of the serial port to be exported.

speed can be any of 1200, 2400, 4800, 9600, 19200, 38400, 57600, 115200.

config can be any of 8N1, 7E1, 7O1.

opts is optional and is passed verbatim to GenServer.

Returns {:ok, pid}.

Example

  Sersock.start_link([device: "ttyUSB0", port: 5000], [name: Sersock])