D
Doru-Catalin Togea
Hi!
I asked previously how to address the COM port from Python and I was
directed to pyserial. It is very elegant and I guess it works very well.
However, it seems that what I try to do is more complicated than I first
thought. I want to make my modem place a call using the number '1234'. The
modem is connected to COM3 on my computer. So I tried the following:
-------------------------------
import serial
ser = serial.Serial(2) # COM3
ser.timeout = 2 # otherwise the read(2) which follows blocks for ever
ser.write("atdt1234")
reply = ser.read(2)
print reply
ser.close()
print "ok"
-------------------------------
In the HyperTerminal which comes with Win XP Pro, I can set up a
connection to COM3 and there type the 'atdt1234' command. It works (I get
a call since I have the modem connected to a device with a phone on it).
My question is actually: will an at-command like 'atdt1234' translate to
ser.write('atdt1234')?
Secondly, a modem question: I have found a lot of web pages about
at-commands listing the hayes command set. Still many of them do not seem
to work on two different modems I have tried. Like '&$' should display an
overview of the commands supported by the modem. Ii tried this in the
HyperTerminal where I can place the above mentioned call, and I get
'ERROR'. I also get 'ERROR' for most other commands I try.
Any ideas?
Thanks,
Catalin
--
<<<< ================================== >>>>
<< We are what we repeatedly do. >>
<< Excellence, therefore, is not an act >>
<< but a habit. >>
<<<< ================================== >>>>
I asked previously how to address the COM port from Python and I was
directed to pyserial. It is very elegant and I guess it works very well.
However, it seems that what I try to do is more complicated than I first
thought. I want to make my modem place a call using the number '1234'. The
modem is connected to COM3 on my computer. So I tried the following:
-------------------------------
import serial
ser = serial.Serial(2) # COM3
ser.timeout = 2 # otherwise the read(2) which follows blocks for ever
ser.write("atdt1234")
reply = ser.read(2)
print reply
ser.close()
print "ok"
-------------------------------
In the HyperTerminal which comes with Win XP Pro, I can set up a
connection to COM3 and there type the 'atdt1234' command. It works (I get
a call since I have the modem connected to a device with a phone on it).
My question is actually: will an at-command like 'atdt1234' translate to
ser.write('atdt1234')?
Secondly, a modem question: I have found a lot of web pages about
at-commands listing the hayes command set. Still many of them do not seem
to work on two different modems I have tried. Like '&$' should display an
overview of the commands supported by the modem. Ii tried this in the
HyperTerminal where I can place the above mentioned call, and I get
'ERROR'. I also get 'ERROR' for most other commands I try.
Any ideas?
Thanks,
Catalin
--
<<<< ================================== >>>>
<< We are what we repeatedly do. >>
<< Excellence, therefore, is not an act >>
<< but a habit. >>
<<<< ================================== >>>>