Developing an API to send SMS through the PC

dear all
i have started a project where i have to develop and API to send and receive SMS through a pc. i will be using a NOKIA 3310 mobile phone and will be connecting it through the COMM port. But still i have a very little idea in starting the project. i know that the phones communicate using the AT commands. can any one give guide me ? please let me know where i can find the nessasary information.
thank you,
best regards,
Who is Participating?

Improve company productivity with a Business Account.Sign Up

anupvijayConnect With a Mentor Commented:
Hi Hasitha,
Meff has given some very good links.
One thing that you might like to find out before starting out with AT commands on any phone is that whether the phones
support the AT commands needed by you.
Although ETSI standards lays out the standard AT commands that should be present I have seen mobile which do not
have all the AT commands incorporated.
It simply means that an AT command   which works with one phone should not necessarily work with others.
So be careful if you want your APIs to be generic for different phones.

Coming to your project.....I can give you pointers.
Use a hyperterminal to connect to your COM port and fire AT commands to check everything is working fine.

Now for your APIs......(assuming you are on windows). You need to use the win32 APIs to open/write/read/close COM ports
What you will be writing would be mostly your AT commands. And what you will be reading would be responses to the  AT

I think a good starting point would be to get your api to communicate with a COM port initially and then advance step by step
towards your ultimate goal.
A link that could help you.

Keep posting about your progress and we here will try to help you out.

3310 , 3350 doesn't support AT command and ALSO offically Nokia  haven't lauched the Serrial cable too for it.
8210 , 8250 are the cheepest model which Supports AT commands But they DO NOT the Communicate Via  Serial Port , U can use IRDA port to communicate and run ur AT commands on them.
Minimum Nokia Model to use Serial port and AT commands is Nokia 3100 , better ask Nokia Service Center.
Building an Effective Phishing Protection Program

Join Director of Product Management Todd OBoyle on April 26th as he covers the key elements of a phishing protection program. Whether you’re an old hat at phishing education or considering starting a program -- we'll discuss critical components that should be in any program.

What language are you developing in? I wrote this VB6 module once to take care of sending/receiving SMS's from my VB6 projects using a GSM modem connected to the serial port. I use the MSComm control for the actual comms. Note that the functions require a reference to an MSComm control as the first argument.

Option Explicit

Public Function RemoveInternationalDiallingCode(ByVal tTelNumber As String) As String
    RemoveInternationalDiallingCode = "0" & Mid(tTelNumber, 4)
End Function

Public Function GetSMSNum(ByVal tSMSNotification As String) As String
    Dim lCRPos As Long
    lCRPos = InStrRev(tSMSNotification, vbCr)
    If lCRPos > 0 Then GetSMSNum = Mid(tSMSNotification, lCRPos - 2, 2)
    If Left(GetSMSNum, 1) = "," Then GetSMSNum = Right(GetSMSNum, 1)
End Function

Public Function ReadSMS(comms As MSComm, ByVal tSMSNum As String, tMessage As String, tSender As String, tDate As String, tTime As String, bRead As Boolean) As Boolean
    Dim tChar As String * 1
    Dim i As Long
    Dim tRead As String
    Dim lQuoteNum As Long
    Dim tDateTime As String
    Dim tData As String
    Const TIMEOUT = 10000
    On Error GoTo ErrHandler
    tData = "AT+CMGR=" & tSMSNum & vbCr
    comms.InBufferCount = 0
    comms.Output = tData
    tData = ""
    i = timeGetTime
    Do While timeGetTime - i <= TIMEOUT And InStr(tData, "OK" & vbCrLf) = 0 And InStr(tData, "ERROR" & vbCrLf) = 0
        If comms.InBufferCount > 0 Then
            tChar = comms.Input
            tData = tData & tChar
        End If
    If InStr(tData, "ERROR") = 0 And tData <> "" Then
        For i = 1 To Len(tData)
            tChar = Mid(tData, i, 1)
            If tChar = """" Then lQuoteNum = lQuoteNum + 1
            If lQuoteNum = 1 And tChar <> """" Then tRead = tRead & tChar
            If lQuoteNum = 3 And tChar <> """" Then tSender = tSender & tChar
            If lQuoteNum = 5 And tChar <> """" Then tDateTime = tDateTime & tChar
            If lQuoteNum = 6 And tChar <> """" Then tMessage = tMessage & tChar
        Next i
        bRead = (tRead = "REC READ")
        tDate = Left(tDateTime, 8)
        tTime = Mid(tDateTime, 10, 8)
        tMessage = Mid(tMessage, 3)
        tMessage = Mid(tMessage, 1, InStr(tMessage, vbCr) - 1)
        ReadSMS = True
    End If
    Exit Function
    ReadSMS = False
End Function

Public Function DeleteAllSMSes(comms As MSComm) As Boolean
    Dim i As Long
    For i = 1 To 15
        DeleteAllSMSes = InStr(TransmitAndReceiveData(comms, "AT+CMGD=" & i & vbCr), "OK")
    Next i
End Function

Public Function DeleteSMS(comms As MSComm, ByVal lSMSNum As Long) As Boolean
    DeleteSMS = InStr(TransmitAndReceiveData(comms, "AT+CMGD=" & lSMSNum & vbCr), "OK")
End Function

Public Function SendSMS(comms As MSComm, ByVal tSMSNum As String, ByVal tMessage As String) As Boolean
    SendSMS = InStr(TransmitAndReceiveData(comms, "AT+CMGS=" & """" & tSMSNum & """" & vbCr & tMessage & Chr(26)), "OK")
End Function

Public Function TestModem(comms As MSComm) As String
    TestModem = TransmitAndReceiveData(comms, "AT")
End Function

Public Function ManufacturerInfo(comms As MSComm) As String
    ManufacturerInfo = TransmitAndReceiveData(comms, "AT+CGMI")
End Function

Public Function ModelInfo(comms As MSComm) As String
    ModelInfo = TransmitAndReceiveData(comms, "AT+CGMM")
End Function

Public Function FirmwareInfo(comms As MSComm) As String
    FirmwareInfo = TransmitAndReceiveData(comms, "AT+CGMR")
End Function

Public Function IMEIInfo(comms As MSComm) As String
    IMEIInfo = TransmitAndReceiveData(comms, "AT+CGSN")
End Function

Public Function IMSIInfo(comms As MSComm) As String
    IMSIInfo = TransmitAndReceiveData(comms, "AT+CIMI")
End Function

Public Function EF_CCIDInfo(comms As MSComm) As String
    EF_CCIDInfo = TransmitAndReceiveData(comms, "AT+CCID")
End Function

Public Function NetworkRegStatus(comms As MSComm) As String
    NetworkRegStatus = TransmitAndReceiveData(comms, "AT+CREG?")
End Function

Public Function AvailablePLMNs(comms As MSComm) As String
    AvailablePLMNs = TransmitAndReceiveData(comms, "AT+COPS?")
End Function

Public Function NetworkFieldStrength(comms As MSComm) As String
    NetworkFieldStrength = TransmitAndReceiveData(comms, "AT+CSQ")
End Function

Public Function MainCellMainParams(comms As MSComm) As String
    MainCellMainParams = TransmitAndReceiveData(comms, "AT+CCED=0")
End Function

Public Function TransmitAndReceiveData(comms As MSComm, ByVal tData As String) As String
    Dim lTime As Long
    Const TIMEOUT = 10000
    tData = tData & vbCr
    With comms
        .InBufferCount = 0
        .Output = tData
        tData = ""
        lTime = timeGetTime
        tData = ""
        Do While timeGetTime - lTime <= TIMEOUT And InStr(tData, "OK") = 0 And InStr(tData, "ERROR" & vbCrLf) = 0
            If .InBufferCount > 0 Then tData = tData & .Input
    End With
    TransmitAndReceiveData = tData
End Function
If you manage to find a phone that supports the serial port interface, you could try the Whisperstream SerialComm GSM SDK, you can get it from

It has source code and examples.......I used it for a project I did a while ago and you can extend it if you's written in C# .NET though, dunno if that will work for you.
thanks for help.......
hasitha007Author Commented:

i tried to send an SMS through the Hyperterminal but i faild. i connected the NOKIA 3310 phone to the COM port by using a data cable . at the hyperterminal editor i could not type any thing .  so i could not type the AT commands. could u pls tell me the steps to send an SMS by using the hyperterminal.
thank you  
Please See my pervious comment....
3310 , 3350 doesn't support AT command and ALSO offically Nokia  haven't lauched the Serial cable for them. you can't communicate with thru hyperterminal with these mobiles....
hasitha007Author Commented:
hi virenderpratap
thanks for the info. then i think i need to buy a NOKIA 8250.
i will be using c/c++ language to develop my API . can anyone tell me how to start cording. at the morment i really have no idea in starting the project.
If you are palnning to buy 8250 then it will work on IRDA only,
So, to work with IRDA use IRCOMM to communicate with mobile phone..
IRCOMM is nothing but a virtual com port, so you just need to open IR com port simiral to actual com port , and write the AT commands on it,  f_rodriguez has already posted the code for you in VB, for VC++ just use CreateFile and WriteFile ReadFile Fucntions to Open , IR com(Generally COM4 in Win98) , write data and read data. See the Answered posts in this section you will found your anwser how to start as well as how to code it in C/C++

You may face problem in Other versions of Windwos (Like 2000, NT) becos they don't have direct support for IRComm. But if you buy phone which can have AT command AND Serial Cabel Support then your work will be more easy...

Call to nokia service center they will tell the cheepest model which support AT as well as Serial communication.

hasitha007Author Commented:
I tried with a  nokia 5110 and when i used the hyperterminal and typed  "AT" the charactor that was displayed was " } a " and it replied with " mk ". could u pls tell me whether i can use the Nokia 5110 phone or whether i  have to go for nokia 6110 for serial communication ? which phones supports serial communication and the AT commands ? i have a NOKIA 6120 . does it support serial communication ?
and why did i receive "mk" insted of the "ok". is it a problem with the operating system. i used windows 2000.
thank you,
You can try this tool called EasiSMS from

It supports command line so you don't need to use AT commands. It can support both serial cable, USB cable and even infrared.
You guys dont even read what the question was that hasitha007 asked. hasitha007 is trying to program a c app to send SMS's with not find one to send sms's with.
Well the whisperstream solution has source code with it, that might aid hasitha007 in the coding of the app.

Granted it's C#, but I'll often look at other languages to get an idea how to code something.  Do you not agree?
hasitha007Author Commented:
dear all,
now i am facing a big problem. that is which phone to select for AT commands serial communication.
now i have recognized that only some phones supports the AT commands ,serial communication. i tried with nokia 3310,5110,6120, but neither one supported the serial communication of AT commands.  
After that i tried to work with IRDA. Then I faced another problem. That is the IRDA adapter has only the USB ports and then i cannot communicate with the serial port.
So can any one tell me which are the cheapest phones that supports serial communication of the AT commands.

Thank you.
A Nokia 6210, will definately work (you'll need a dlr-3 serial cable, about 5GBP on ebay).....that's the one supported in the whisperstream sdk and it's what I use.  I'm pretty sure a nokia 6110 will also work.

Anyway hope that helps
hasitha007Author Commented:
dear  digitalconvict
thanks for the information. i will try to get one over the weekend and let u know.
Hello please help.
For my diploma thesis i have to write an apllication what send automatically after an error ocurs an sms over serial cable to my siemens tc35 and then to the mobilphone of the pc administrator.
On this homepage i found some code for sending one at command to the com port but doesn´t know how i can use it for sending an sms and an question is can i send sms in textformat or i have to change the sms text into pduformat? Can someone help my?
I using Windows 2000, a siemens tc25 gsm modem and visual studio 6.0 with the programmlanguage  c++. How i have to start? With Hyperterminal the creation and sending of an sms with the at commands works. In my apllication i want to use the at+cpin, at commands for sending an sms.

Thanks for help and an answer and sorry for my english.
hi man go to
download sdk 3.0 and start developing
sdk3.0 full of example for vb6 developer
have a nice day
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.