developing software for huavei e220 usb modem

jasonwucinski

Member
Joined
Jul 19, 2008
Messages
12
Reaction score
0
hi everyone. if anyone can help me, id appreciate it. im trying to develop software for the above mentioned modem to send and recieve sms's. i can easily send the sms's but am having a very difficult time accessin the sim card to look in the inbox (using AT commands). anyone know whats going on? im programing in vb.net.

also, is there an sdk available for the modem?
 
Hi. I'm assuming your using a Vodacom SIMM as I had similar problems. You need to set the address book lookup at position 0 and not 1 as by default - this problem caused me months of issues when writing my own app.

Personally, its better to use an existing gateway SMS lib than to try and rewrite-the-wheel.

Here is a great ref that should help you:

http://www.developershome.com/sms/smsIntro.asp
http://www.cellular.co.za/at_etsi.htm
http://www.dreamfabric.com/sms/cms_error.html


PS: I using smstools in Linux as a gateway. You can also look at kannel.

If you want Delivery Receipts, then rather use a 3rd party to send/recieved your traffic. Its more reliable and cheaper as your not paying a double charge - most SMS packages charge you for your DLR.
 
hi, thanks for the help

why would i set the address book, if its the inbox im trying to get to? im actaully using mascom but theres no help forums i can find for that, so here i am. im using gsmcomm library to do most of this program but its not helping with the inbox either. do i set the address book on the hardware or programatically?
 
Hi sorry on the typo, its not address book, but its the address location of the MO. Its the address of the MO on the SIMM or modem. You should set the modem to store to the SIMM instead.

AT+CPMS="SM"

ref: http://smstools.meinemullemaus.de/faq.html

I already posted the link but: http://www.developershome.com/sms/
was the best resource I found.

And ( http://www.pharscape.org/index.php?option=content&task=view&id=29 )
...

3.3.2 Receiving an SMS

For SMS receiving, you normally wait for the unsolicited response

+CMTI: "SM", n

This indicates a new SMS has been placed in the SM storage as message ‘n’.

You can read the message by issuing:

AT+CPMS=”SM”

to select the SM storage location and then to read the message:

AT+CMGR=n

Which displays:

+CMGR: "","",,""

can be "REC UNREAD", "REC READ", "STO UNSENT", "STO SENT", where REC means received (= incoming), STO means stored (= outgoing).

On the next line, you will see the text of the message. Since the CMGR command (just like the others ) finishes with “OK", you have to be careful processing a message that has this character sequence in it. This is one of the limitations of the Text Mode.

After getting the SMS, you need to delete it from the SIM in order not to fill the limited storage space. You can delete any message by issuing

AT+CMGD=n

where "n" is the store number .

3.3.3 Listing the Messages

Select the correct message store:

AT+CPMS=”SM

List all unread messages:

AT+CMGL="REC UNREAD”

List all unsent messages:

AT+CMGL=" STO UNSENT”
 
follow up

first, thanks so much for your help. this is the most assistance ive gotten since i started this projects months ago lol. im still having problems, though. (and im still new at this, so go slowly lol). so, if i understand what your saying, the at command AT+CPMS="SM","SM","SM" will move all messages from the modem to the SIMM card, then i can list all messages with "AT+CMGL="ALL" ?

let me show you what i have so far and see if you can explain to me where im screwing up. im doing this in vb.net but ill explain what im trying after each line:

Code:
 Private Sub viewInBox_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

        Dim comSerial As New System.IO.Ports.SerialPort
' declares a new serial port object to be used

        Try

            With comSerial
                .PortName = "COM5" 'sets com name, etc,etc,etc
                .BaudRate = "9600"
                .StopBits = IO.Ports.StopBits.One
                .DataBits = 8
                .Parity = IO.Ports.Parity.None
                .ReadBufferSize = 10000
                .ReadTimeout = 1000
                .WriteBufferSize = 10000
                .WriteTimeout = 10000
                .RtsEnable = True

                Dim test As String = "AT+CPMS=" & """" & "MT" & """," & """" & "MT" & """," & """" & "MT" & """"
                ' this will make the line (AT+CPMS="MT","MT","MT" )
                .Open()
                .DiscardOutBuffer()
                'for reading sms
                .DtrEnable = True


                 
                .Write(test + vbCr)
 'execute command on port, vbcr is a line break
                .Write("AT+CMGL=" & """" & "ALL" & """" + vbCr)
 ' writes out (AT+CMGL="ALL" + a cariage return)

                Dim Incoming As String = .ReadExisting() 
' read everything coming of the port

                MsgBox(Incoming) ' show it in a message box
'here i get a message box saying :
'+CMPS:0,40,0,40,0,40

'OK

'Error
                .Close()

            End With

        Catch ex As Exception
            MsgBox(ex.Message)
        End Try

    End Sub

thanks again
jason
 
Hi

Your code looks like its going in the right direction. I will be working on my modem this weekend and then I can paste the exact commands "smstools" uses to retrieve the messages from the modem.

What I did find that helped me in the beginning was to execute the commands in a terminal - For windows you will use HyperTerminal http://www.developershome.com/sms/howToUseHyperTerminal.asp

Keep well

Christopher
 
hyper terminal

hi, thanks for your reply. sorry, i was out of town for a few days. now back to the grind lol
ive been having problems with hyperterminal as well. when i connect hyperterminal to the port, it says its connected but it wont allow me to type. would you know what the problem would be? bellow are the steps i take.

1. plug modem into usb port
2. when on board software pops up asking me if i want to connect to internet, i click cancle and close the program
3. i start "Hyperterminal Private Edition" (im using vista so i had to download a copy)
4. i create a new connection, connecting to the comport that the modem is plugged into (i know which comport its plugged into by checking control panel)
5. bits per second:9600,data bits:8,parity:none,stop bits:1,flow contorl:hardware
6. when i click ok, its says its connected but i am unable to type in the window

oh, and i look forward to getting the commands you use to connect to the cellphone inbox
 
nevermind, i got hyperterminal working. even with hyperterminal, though, i cant get to the inbox. i use the following commands:

send: AT
return: OK
send: AT+CPMS="MT" //(to set memory to both simm and onboard memory)
return: +CPMS: 0,255,0,40,0,40

OK
send: AT+CMGR=1 //(to select the first message in memory)
return: OK

thats all it returns. shouldnt it return the message, or at least an error if the message doesnt exist?
 
Hi, here are the commands I pulled from my log lines. I tested them to make sure they work:

Lines:


Code:
 // Pre-initializing modem

 ATE0+CMEE=1

 //   Command is sent, waiting for the answer

 OK


Code:
 //Checking if Modem is registered to the network

 AT+CREG?

 //  Command is sent, waiting for the answer

 +CREG: 0,1


Code:
 // Selecting PDU (0) OR TEXT (1) mode
 
AT+CMGF=1

 //Command is sent, waiting for the answer

 OK

Code:
 // Changing SMSC

 AT+CSCA="+27829119"

 // Command is sent, waiting for the answer

  OK


Code:
// Querying IMSI ??? Modem serial, not required but more used when you have more than one
 AT+CIMI

 //   Command is sent, waiting for the answer

 655016000553228
 OK


Code:
// Checking memory size

 AT+CPMS?

 //   Command is sent, waiting for the answer

 +CPMS: "SM",14,50,"SM",14,50,"SM",14,50
 OK


Code:
// Used memory is 14 of 50
 //  Trying to get stored message 0

 AT+CMGR=0

 // Command is sent, waiting for the answer

  +CMGR: "REC READ","+27716749878",,"08/08/18,21:22:31+08"
  Hello there world. This is a test. :-) www.vodacom.co.za

Code:
// Now delete this message
 // Now deleting message 0

 AT+CMGD=0

 OK

 // Ok loop till the end
 //

 AT+CMGR=$x   // get msg $x
 AT+CMGD=$x   // delete msg $x
*******************************
You need to remember to delete after you read, else your simm will fill up. Some

applications will walk through all the simm storage places (ie 50) in this case.

I would just read how many are store: +CPMS: "SM",14,50

And then walk through the list till I get all 14 in this case.

Code:
   max_count = 14
   count     = 0
   position  = 0
   while (count < max_count){

       msg = ... AT+CMGR=$COUNT

       if (msg) {
           count++
           // delete
           AT+CMGD=$COUNT
       }

       position++
   }

This will do it. When retrieving a msg, PDU is better but I've never gotten around to reading the documentation on converting it back to text.

Keep well and all the best
Christopher
 
thanks

thanks for all your help, but i think it was for naught lol. when i send the command: AT+cpms="MT","MT","MT" i get the response :
+CPMS:0,255,0,255,0255
which, i guess, means the modem inboard memory and simm memory are empty. when i look at the software that ships with the modem (which can send sms as well as connect to the internet) it is able to read the sms. so, i went digging into the programs files and found a file called: SMS.DTC which has all the messages. i guess whats happening is that the onboard software pics up the new message, copies it to this file and deletes it from the phone/simm. so, if i want to get to the saved messages, i have to read this file. which, its seems, will be a pain as it appears the file is formated in some weird way. when i open it up in notepad or word, the messages and the phone numbers that sent them are vissible but with a lot of extra junk. im at a loss as to what to do
 
Good morning. Don't stress cause your answer to your problem is rather easy:

Configure VMC (Vodafone Mobile Connect) to keep the SMS on the SIMM :-)

You can refer to the documentation: IT MANAGERS GUIDE

http://www.business.vodafone.com/si...ing_vmc/support/05_itmanagers/p_itmanager.jsp

Page 55 explains the XML file config to instruct it to store on your device. Page 33 is where the file is stored.

To prevent a high level race condition of the VMC and your app trying to read and delete. Set your code to read the SMS (mark its position) and then sleep for say 60s before you delete it. Unless your application will receive a constant rate of 50 SMS per minute, this will be fine.


Keep well
Christopher
 
good morning

well, it was worth a try. im using macom, though, and it appears that their install is different. i cant find the files refered to in the vodafone white papers. i tried calling mascom to ask them for an sdk or white papers and they just looked at me like i was nuts.
 
that might work

but im designing the software for others. would that mean they would also have to have that installed?
 
Hi, yes. Do you need to design it for an e220? You can get alternate modems for about R1600 that are better suited for this - also not network locked.

http://www.3g.co.za/content/view/35/31/

I spent Tuesday setting up an open source gateway, KANNEL, to use this modem in Ubuntu and it worked like a breeze. Works in Windows too.

But if your stuck with the e220, then just distribute it with the Vodafone Connect. I'm not so sure how legal it is and the risk you are prepared to take.
 
thanks

hey, sorry. i was on vacation for a week. i think i figured out what to do. as long as the dashboard software isnt running at the same time as my program it wont erase the message. ill just have to tell them not to run both at the same time to recieve
 
thanks

hi, thanks for all your help. sorry, i was away on vacation (which i needed lol). i think i figured out how to fix this. if the dashboard program is shut down when a message is recieved, it wont delete it. now i can just run all the at commands to pick it out of the sm. finally.

yeah, the program ive written is for the e220 but i cant change the install that it came with. its a data base program to send out multiple sms's and store them all in a db. im also adding a "redirect" feature. this means when an sms is recieved with a key word (ie "help") it will send an automated response to the sender or third party.
 
Top
Sign up to the MyBroadband newsletter
X