At Command

venerdì 15 agosto 2008 - 17.59

pinti Profilo | Newbie

Vorrei sottporre un nuovo problema: Devo mandare sms attraverso la porta seriale com1 del computer al modem gsm (siemens t35i)sempre attraverso seriale. Questo lo faccio tramite At commands ed il codice è sotto riportato
Imports System.IO.Ports.SerialPort
Imports System
Imports Microsoft
Imports System.IO
Imports System.Threading.Thread

Public Class Form1

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click, Timer1.Tick

Dim comSerial As New System.IO.Ports.SerialPort
Dim atcCommand As String
Dim sphnPhoneNo As String
With comSerial
.PortName = "COM1"
.BaudRate = "9600"
.StopBits = IO.Ports.StopBits.One
.DataBits = 8
.Parity = IO.Ports.Parity.None
.ReadBufferSize = 10000
.ReadTimeout = 1000
.WriteBufferSize = 10000
.WriteTimeout = 10000
.RtsEnable = True


.Open()

.Write("AT+CMGF=1" + vbCrLf)
System.Threading.Thread.Sleep(2000)
sphnPhoneNo = "3385229171"
atcCommand = "AT+CMGS=" + Chr(34) + sphnPhoneNo + Chr(34) + Chr(13) + "Hello World" + Chr(26)
.Write(atcCommand + vbCrLf)
System.Threading.Thread.Sleep(2000)
TextBox1.Text = .ReadExisting()
.DiscardOutBuffer()
.Close()
End With
End Sub
Funziona il messaggio arriva ma è tagliato , ne arriva solo un pezzo oppure una o due lettere ; se allungo la stringa arriva ugualmente tagliata. Da che dipende?Non sono ancora riusito a capirlo?
Grazie
Partecipa anche tu! Registrati!
Hai bisogno di aiuto ?
Perchè non ti registri subito?

Dopo esserti registrato potrai chiedere
aiuto sul nostro Forum oppure aiutare gli altri

Consulta le Stanze disponibili.

Registrati ora !
Copyright © dotNetHell.it 2002-2025
Running on Windows Server 2008 R2 Standard, SQL Server 2012 & ASP.NET 3.5