[squeak-dev] How to talk to a modem via a com port

Mateusz Grotek unoduetre at poczta.onet.pl
Fri Jan 30 10:08:31 UTC 2015


Dnia 29.01.2015 19:28:40, Louis LaBrunda napisał(a):
> Hi All,
> 
> Does anyone have some sample code to talk to a telephone modem  
> through a
> com port?  It is a USB modem that shows up on COM3.  I want to play  
> with
> getting the caller Id info.  Any help is appreciated, so thanks in  
> advance.
> 
> Lou
> -----------------------------------------------------------
> Louis LaBrunda
> Keystone Software Corp.
> SkypeMe callto://PhotonDemon
> mailto:Lou at Keystone-Software.com http://www.Keystone-Software.com
> 
> 
> 

Hi,

There is a class called SerialPort.
You use it like that:
|port input output|
port := SerialPort new.
"Here you can set up the port, check the settings protocol of the  
SerialPort class."		
port openPort: 0. "Here you can put a number, or a string like  
'/dev/ttyS0' in Linux"
output := port nextPutAll: 'ATI0',Character cr.
Transcript showln: port readString.

ATI0 is an example of the Hayes AT commands used to control modems  
(they are use for most modems, not only Hayes), see here:
http://en.wikipedia.org/wiki/Hayes_command_set

BTW. if you have problems with the SerialPort class on Windows or OSX,  
try Linux instead.

Mateusz


More information about the Squeak-dev mailing list