sersock

Elixir Serial Port to Socket exporter.

Installation and Usage

  1. Add sersock to your mix.exs dependency list:
  def deps do
    [{:sersock, "~> 0.1.2"}]
  end
  1. Manually start and stop individual instances.
  tty = case :os.type() do
      {:unix, :darwin} -> "cu.usbserial-FTYHQD9MA"
      {:unix, :linux} -> "ttyUSB0"
      {:win32, :nt} -> "COM12"
  end

  {:ok, pid} = Sersock.start_link([device: tty, port: 5000])
  {:ok, %{ip: {0,0,0,0}, port: 5000}} = Sersock.endpoint(pid)

  :ok = Sersock.stop(pid)
  1. Connect your serial port to some device and talk to it with netcat. Prepend with rlwrap for command history.
  #Talking to a KTA-223
  nc localhost 5000
  @00 IS 0
  #00 0
  1. Run the tests
  #Serial port names are hard coded in test_helper.exs
  #TCP ports are hard coded in sersock_test.exs
  #A couple of serial ports are required
  mix test

Development

Windows

Install Visual C++ 2015 Build Tools by one of the following methods:

From the Windows run command launch cmd /K c:\Users\samuel\Documents\github\sersock\setenv.bat adjusting your code location accordingly.

Ubuntu

Give yourself access to serial ports with sudo gpasswd -s samuel dialout. Follow the official Elixir installation instructions and install build-essential erlang-dev as well.

Roadmap

Future

0.5.4

0.1.1

0.1.0