Powershell - Read SMS messages
hi,
i´m try read messages inside chip 3g using powershell.
i have sucess sending messages:
$serialport = new-object system.io.ports.serialport $serialport.portname = "com9" $serialport.baudrate = 19200 $serialport.writetimeout = 500 $serialport.readtimeout = 3000 $serialport.dtrenable = "true" $serialport.open() $phonenumber = "+551199999999" #phone number $textmessage = "this test message!" try { $serialport.open() } catch { start-sleep -seconds 5 $serialport.open() } if ($serialport.isopen -eq $true) { $serialport.write("at+cmgf=1`r`n") $serialport.write("at+cmgs=`"$phonenumber`"`r`n") start-sleep -seconds 1 $serialport.write("$textmessage`r`n") $serialport.write($([char] 26)) start-sleep -seconds 1 } $serialport.close() if ($serialport.isopen -eq $false) { echo "port closed!" }
but, can´t understand how read message, try:
$serialport = new-object system.io.ports.serialport $serialport.portname = "com9" $serialport.baudrate = 19200 $serialport.writetimeout = 500 $serialport.readtimeout = 3000 $serialport.dtrenable = "true" $serialport.receivedbytesthreshold = 256 $serialport.open() $serialport.write("at+cmgf=`"all`" ") $serialport.read("at+cmgf=`"all`" ",1,1) $serialport.close()
but receive time out.
any 1 have idea ?
tnks.
-- ricardo leka - http://leka.com.br
looking code saw these 2 websites?
http://developer.nokia.com/community/wiki/using_at_commands_to_send_and_read_sms
Windows Server > Windows PowerShell
Comments
Post a Comment