Click here to Skip to main content
15,883,883 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have an issue for sending sms using huawei e160 usb modem .. problem is that after a couple of hours, the modem would become unresponsive, and my sms application would be unable to communicate with the modem. When I unplug this modem and plug it again its start working again..i have an other company teltonika gsm modem..if i m using teltonika gsm modem my application working perfactly.. here is my code

VB
Dim SMSEngine As New SMSCOMMS("COM4")
'the port needs to be initialised
SMSPort = New SerialPort
    With SMSPort
        .PortName = COMMPORT
        .BaudRate = 19200
        .Parity = Parity.None
        .DataBits = 8
        .StopBits = StopBits.One
        .Handshake = Handshake.RequestToSend
        .DtrEnable = True
        .RtsEnable = True
        .NewLine = vbCrLf
    End With 

    'this is  the set of AT commands to be written on serial port
        SMSPort.WriteLine("AT")
        'set command message format to text mode(1)
        SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 
        'set service center address (which varies for service providers (idea, airtel))
        SMSPort.WriteLine("AT+CSCA=""+919822078000""" & vbCrLf)             
        ' enter the mobile number whom you want to send the SMS
        SMSPort.WriteLine("AT+CMGS=  + TextBox1.text + " & vbCrLf) 
        _ContSMS = False
        SMSPort.WriteLine("+ TextBox1.text +" & vbCrLf & Chr(26)) 'SMS sending
Dim i As Integer

Private Sub Button1_Click(ByVal sender As System.Object,
   ByVal e As System.EventArgs) Handles Button1.Click
    SMSEngine.Open() 'open the port
    SMSEngine.SendSMS() 'send the SMS
End Sub
Posted
Updated 7-May-18 3:03am
v2

Soooo where are you closing the port once the message is sent?? That could be your problem.

As it's extremely unlikely any of the regulars around here have the same modem, it's pretty much impossible for anyone to test your code and tell you what's wrong. Be prepared to receive nothing but guesses as to what the problem may be.
 
Share this answer
 
Comments
jnai_yarm 16-Jun-12 1:20am    
no only problem is huawei modem hang after some time or after couple of hour
Dave Kreskowiak 16-Jun-12 9:24am    
This doesn't change my answer at all. Your chances of finding someone with the same modem here, writing the same kind of application are very close to 0.

Still, you don't close the port when you're done sending the message. When you want to send a message you should be creating the SerialPort object, writing your message, then closing the SerialPort object.

You don't create these objects for the lifetime of your application. You create the objects, initialize the modem, send your message, the close and destroy the objects when your done sending the message...for every message you send!
Hello..,

I guess, this Modem is going to sleep mode after sometime. I have worked on this couple of years back. But I can suggest here something, may be you can try that.

Please check the modem documentation wherein any command available for the wakeup the modem, or any command available to set the modem to not going to sleep mode.
If not, I suggest you to send "AT" command in the intervals, if your application is not sending SMS(s) for longer time.

--RA
 
Share this answer
 
Comments
Richard MacCutchan 7-May-18 11:30am    
SIX years on, do you think OP is still waiting?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900