2

I want to create something similar to Kannel, for my wavecom GSM modem using Erlang.

I found a erlang-serial project in Github, but it seems there isn't any easy tutorial for a newbee like me.

I really need an Erlang lib that can send data to a serial port and sending AT command to my GSM modem.

Please help.

Bromo Programmer
  • 670
  • 2
  • 13
  • 37
  • In this related question http://stackoverflow.com/questions/6976117/erlang-serial-io The consensus seems to be that you have to use python – TJD Oct 27 '12 at 14:20
  • Look at this topic, maybe it would help you: http://stackoverflow.com/questions/4517393/opening-a-device-file-using-erlang – stemm Oct 28 '12 at 07:34
  • Yes, I read that too ... only one problem, I don't code Python ... I code in both Erlang & Java, Well I could use Erlang Jinterface to communicate with java-to-com-port library (http://rxtx.qbang.org) ... but to build a solution based on 2 virtual machines (JVM & Erlang runtime) would make my solution too difficult to deploy, same goes if I use Python. I prefer using windows or linux shared library (*.dll or *.so), because those are natively delivered as part of the OS where I would like my solution to be deployed. – Bromo Programmer Oct 28 '12 at 11:07

1 Answers1

2

erlang-serial has pretty easy example in terminal.erl, basically you start the connection:

SerialPort = serial:start([{speed,Speed},{open,?DEVICE}]),
serial_listener()

Where ?DEVICE is path to linux device in /dev and serial_listener is a receive-loop like this:

serial_listner() ->
receive
{data, Bytes} ->
    %% Do something with bytes
    serial_listner()
end.

And to send data you just send message to that process:

SerialPort ! {send, Bytes}

That's it!

Ivan Blinkov
  • 2,466
  • 15
  • 17