Skip to content
The Jungle of Erlang code http://jungerl.sourceforge.net/
C Erlang
Pull request Compare This branch is 7 commits ahead, 22 commits behind gebi:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.
c_src
doc
ebin
include
priv
src
.gitignore
Makefile
README
rebar
rebar.config
rebar.cross_compile.config.sample
sl.pub

README

SL is a Unix (and Windows in the future?) interface for serial port devices.

API
---
start() -> Port

 Load the driver, if needed,  and open a port to the driver.

stop(Port) -> ok

 Terminate the port, and cleanup if neccessary.

options() -> [Opts]

  Return a list of the options names possible to configure:

     dev    - The device name i.e "/dev/ttyS0" "COM1"
     baud       - The baud rate         (9600...115200 .. os specific)
     csize      - Character size        (5,6,7,8)
     bufsz      - Receive buffer size   (integer())
     stopb      - Number of stop bits   (0,1,2)
     parity     - The Parity bits       (0,1)
     hwflow     - Hardware flow control (true/false)
     swflow     - Software flow control (true/false)
     xonchar    - Flow control char when swflow
     xoffchar   - Flow control char when swflow
     echo   - Echo mode

getopts(Port, [Opt]) ->
          [{Opt,Value}]

  For each option Opt return the pair {Opt,Value}

setopt(P, Opt, Arg) -> ok | {error,Reason}

  Set an option.

setopts(P, [{Opt,Arg}]) -> ok | {error,Reason}

open(Dev, Opts) -> {ok,P} | {error,Reason}

  A combined operation of start/setopts/open.

open(P) -> ok | {error,Reason}

  Open the device set by setopt(.., [{dev,Device}])

close(P) -> ok

  Closes the device opened by open/1.

connect(P) -> ok.

  Same as open.

disconnect(P) -> ok.

  Do a hangup then close.

revert(P) -> ok.

  Revert settings done by setopt.

update(P) -> ok.

  Update the parameters changed with setopt.

send(P, Data) -> ok.

  Transmit the iolist in Data to the device in P
Something went wrong with that request. Please try again.