Sending SMS using AT Commands via GSM Modem/GSM Phone (receiving SMS-updated)

THE FULL SEND AND RECEIVED SMS SERVER with complete Source Codes for developers are available to purchase.
.NET version is also available
Feel free to contact me at the addresses and links below:
Demo:
This a sample how to send SMS using AT Commands like in Hyper Terminal via GSM Modem or compatible GSm phone attatched to the PC Comport or USB port..
For this sample i used Huawei E160 GSM/HSDPA/GPRS modem..
demonstrate how to use MSComm Control in VB6 in order to send data to the GSM Modem
TODO:
this code may not work with other modem so better check your modem's specs and manual
check your modem's settings (baud Rate,RtsHold,HandShake, etc .and comport number in order to run this project..
Good NEWS:
java and php version will out this month..
THE FULL SEND AND RECEIVED SMS SERVER with complete Source Codes for developers are available to purchase.
Feel free to contact me at the addresses and links below:
feel free to use and improved my sample code,
Goodluck
Questions and request?
Mobile
+639399393702
+639155338048
Blog Site
http://www.freeprogrammingtricks.com/
Facebook Fan Page
http://www.facebook.com/emondsoft/
Skype
Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. After downloading it, you will need a program like Winzip to decompress it.
Virus note: All files are scanned once-a-day by SourceCodester.com for viruses, but new viruses come out every day, so no prevention program can catch 100% of them.
FOR YOUR OWN SAFETY, PLEASE:
1. Re-scan downloaded files using your personal virus checker before using it.
2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.
Comments
i have source code using C#,
i have source code using C#, ill upload it very soon...
Plz help me!!!
i'm doing a final year project which is related to GSM/GPRS modem to send mms.If i using PIC 18f how should i write the program? Can you help me on this?
ahmmm.. i was just wondering
ahmmm.. i was just wondering sir if sending SMS from PC to Mobile is free? i mean kailangan pa po ba nito ng contract with certain SMS Networks like SMART and GLOBE etc... ?
as well, i would like to ask
as well, i would like to ask if the computer also receives SMS from mobile phones...(?)
ok, i'll try to draw it for better illustration...
SMS:
from - to possible?
-----------------------------------------------------
mobile > PC =
PC > mobile = ?
yes it is possible, so many
yes it is possible, so many modem have the feature of receiving and sending SMS,
but some models don't have receiving SMS feat..
so better check the compatibility of your modem or phones
if you're using Gsm/Gprs
if you're using Gsm/Gprs Modem with sim card inserted to it from SMART/SUN/Globe it is not free ,its just like using your mobile phones so charges may apply..
If your using gateway it is the same thing you may need to pay your contract or plans.
best regrds,
weird errors
How come my phone(expressmusic 5310) can't successfully send SMS when it's working using hyperterminal, but not when using VB6 with comm control? I find this really weird, the other day, my phone is working fine, able to send messages thru VB.net and now when I tried it again, it didn't work. And when I attempted to do it on VB6, I got the error 8020: error reading comm device.
I'm seriously in need of help. Please sir, enlighten me as to why this is happening. Thanks.
please send me a copy of your
please send me a copy of your VB.net program, ill figure it out,
i also provide a C# sample code in Receiving SMS, see at the middle of this thread.
tnx
Modem and program hang...
Thanks very much Sir Emond, I appreciate your quick reply. Uhm, well last night, I found another code which worked fine for my phone. It was able to send, problem is, I can't see the modem's responses. Anyway,I'll just send you a copy of my program in VB.net, the codes I also got from the internet. The problem with that is, once the program starts sending AT commands to the modem, it always hangs, no errors, no anything, just a hang. Wonder why.
I'll look forward for your reply. Thanks and God bless.
Thank
THnaks.,,.,.,. for all comment.,.,.
sir..need help
ahmm anu anung phone ung peding gamitin?
san poh mabibili ung Huwei E160 GSM/HSPDA/GPRS modem ?
thnx..
please email me for the list
please email me for the list of phones
dark_raditz0825@yahoo.com
how to receive SMS s through vb6.0 coding
Can any body help me how to receive message through (give source) Gsm Modem 81GC plz help me
reporting error:8020
Hello buddy i hav connected my nokia 5310(express music) as GSM modem through USB.but it is not possible to send AT commands through VB application,so please help me in rectifying thar error.
Error:8020
Hello buddy i am using nokia 5310(Xpressmusic) phone which is used as an GSM modem,which is connected on my USB hub,when i am passing AT commands through hyperterminal it is reponding,but when i am using your VB application it is reporting error:8020,so please kindly help me in rectifying that error.
PLEase email or contact me
PLEase email or contact me for code modifications;
dark_raditz0825@yahoo.com
thank for your code
uhm sir panu po ba ang pag connect sa vb.net ng gsm modem
visual studio 2008 ang gamit ko
plzz help me naman
this is my Add jomar_dugan@yahoo.com
if may sample ka po na code for sending sms recieving
thank a lot
try mo 2, im using NOKIA 5300
try mo 2, im using NOKIA 5300 express and bluetooth with PC SUite Installed
work perfectly
Option Explicit
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
'MSComm1.Settings = "460800,n,8,1" 'Change this with the Baud rate of your modem (The one you use with Hyper Terminal)
'MSComm1.CommPort = 10 ' Change this with the port your Modem is attached,(eg bluetooth)
'MSComm1.PortOpen = True
With MSComm1
.CommPort = 10
.Settings = "460800,N,8,1"
.Handshaking = comRTS
.RTSEnable = True
.DTREnable = True
.RThreshold = 1
.SThreshold = 1
.InputMode = comInputModeBinary
.InputLen = 0
.PortOpen = True 'must be the last
End With
End Sub
Private Sub Command1_Click()
' Send an 'AT' command to the phone
MSComm1.Output = "AT" & vbCrLf
Sleep 500
MSComm1.Output = "AT+CMGF=1" & vbCrLf 'This line can be removed if your modem will always be in Text Mode...
Sleep 500
MSComm1.Output = "AT+CMGS=" & Chr(34) & TxtNumber.Text & Chr(34) & vbCrLf 'Replace this with your mobile Phone's No.
Sleep 1000
MSComm1.Output = TxtMessage.Text & Chr(26)
Sleep 2000
MsgBox "Message Send"
End Sub
Thanks for giving a
Thanks for giving a solution
But Code is not working plz Help us..............
From PooMi
GPS / GSM Based Bus Tracking system
Resp SIR .
i,Rahul J Bhayani Student of DJ Extc ,want to knw abt my code n its problem
chek my code
'-----------------------------*****************************************************************************---------------
Private Sub Command1_Click()
'Dim serial_loop As Integer 'For contines searching and processing
'
'For serial_loop = 1 To 4
'MsgBox ("LoopCounter=" & serial_loop) '---------------No of Attempts-------------'
'
'
''If MSComm1.PortOpen Then MSComm1.PortOpen = False
' 'Check com1 is being used by other process or not ,if yes den close that process
'
'MSComm1.CommPort = 1
' 'set the badurate,parity,databits,stopbits for the connection
'MSComm1.Settings = "9600,N,8,1"
' 'set the DRT and RTS flags
'MSComm1.DTREnable = True
' 'ready pc to take data from modem
'
'MSComm1.RTSEnable = True
' 'ready modem to take commands from pc
'
'
'MSComm1.InputLen = 0 'Read entire Rx Buffer
'
' 'enable the oncomm event for every reveived character
'MSComm1.RThreshold = 1
' 'enable the oncomm event for send characters
'MSComm1.SThreshold = 1
'
'MSComm1.Handshaking = comNone ' disable handshaking
'
'MSComm1.PortOpen = True 'open the serial port
'
'
'
'
'
'
''MSComm1.Output = "AT+CTZU=1" & vbCr '-------------GMT to IST converte-----------'
'
'MSComm1.Output = "AT+CMGR=1" & vbCr
''MsgBox ("MSComm1.input=" & MSComm1.Input) '--------------Check Point 1--------------'
'
'
'''''''''''''''''''''''''''''''''''declaration of variables''''''''''''
'
'Dim gps_mesg As String
'Dim gsm_mesg As String
'Dim input_buffer As String
'Dim mobile_no_mesg As String
'Dim strReceivedMsg As String
'Dim date_of_mesg As String
'Dim time_of_mesg As String
'Dim time_of_gps_mesg As String
'Dim data_mesg As String
'Dim source_mesg As String
'Dim dest_mesg As String
'Dim busno_mesg As String
'Dim gps_mob_no As String
'Dim gsm_mob_no As String
'Dim latitude_mesg As String
'Dim longitude_mesg As String
'Dim len_mesg As String
'Dim gps_status As String
'Dim gsm_status As String
'Dim unvalid_mesg As String
'
'
''------------------------ make sure tht all variables are Clear-------------------
'gps_mesg = ""
'gsm_mesg = ""
'input_buffer = ""
'mobile_no_mesg = ""
'strReceivedMsg = ""
'date_of_mesg = ""
'time_of_mesg = ""
'time_of_gps_mesg = ""
'data_mesg = ""
'source_mesg = ""
'dest_mesg = ""
'busno_mesg = ""
'gps_mob_no = ""
'gsm_mob_no = ""
'latitude_mesg = ""
'longitude_mesg = ""
'len_mesg = ""
'gps_status = ""
'gsm_status = ""
'
'
''''''''''''''''''''declaration of variables''''''''''''
'
'Dim time As Integer
'Dim speed As Integer
'Dim distance As Integer
'Dim received_mesg_count As Integer
'Dim sent_mesg_count As Integer
'Dim unvalid_mesg_count As Integer
'Dim gps_received_mesg_count As Integer
'Dim gsm_received_mesg_count As Integer
'
'
'''''''''''''''''''''''''''define status flags'''''''''''''''''''''''''
'
'Dim bln As Boolean
'Dim bln_gsm_mesg As Boolean
'Dim bln_gps_mesg As Boolean
'Dim bln_valid_status As Boolean
'Dim bln_mobile_no_mesg As Boolean
'Dim bln_busno_mesg As Boolean
'Dim bln_date_of_mesg As Boolean
'Dim bln_time_of_mesg As Boolean
'Dim bln_time_of_gps_mesg As Boolean
'Dim bln_data_mesg As Boolean
'Dim bln_source_mesg As Boolean
'Dim bln_dest_mesg As Boolean
'Dim bln_cursor_data_mesg As Boolean
'Dim bln_latitude_mesg As Boolean
'Dim bln_longitude_mesg As Boolean
'Dim bln_gps_time As Boolean
'Dim bln_cursor2 As Boolean
'Dim bln_cursor3 As Boolean
'Dim bln_cursor4 As Boolean
'Dim bln_gps_status As Boolean
'Dim bln_gsm_status As Boolean
'Dim bln_blank_mesg As Boolean
'
'''''''''''''''''''' make sure tht all flags are false''''''''''
'
'bln = False
'bln_gsm_mesg = False
'bln_gps_mesg = False
'bln_valid_status = False
'bln_mobile_no_mesg = False
'bln_busno_mesg = False
'bln_date_of_mesg = False
'bln_time_of_mesg = False
'bln_time_of_gps_mesg = False
'bln_data_mesg = False
'bln_source_mesg = False
'bln_dest_mesg = False
'bln_cursor_data_mesg = False
'bln_latitude_mesg = False
'bln_longitude_mesg = False
'bln_cursor2 = False
'bln_cursor3 = False
'bln_cursor4 = False
'bln_gps_statu = False
'bln_gsm_status = False
'bln_blank_mesg = False
'
''gps_mesg = "+CMGR:" & Chr(34) & "REC UNREAD" & Chr(34) & "," & Chr(34) & "+919870687973" & Chr(34) & ",," & Chr(34) & "11/03/05,21:12:56+22" & vbCr & vbLf & "Latitude is:19.65" & Chr(32) & "longitude is:71.65" & Chr(32) & "time:12.12" & vbCr & vbLf & "OK" & vbCr
''MsgBox (gps_mesg)
''gsm_mesg = "+CMGR:" & Chr(34) & "REC UNREAD" & Chr(34) & "," & Chr(34) & "+919870132518" & Chr(34) & ",," & Chr(34) & "11/03/05,21:12:56+22" & vbCr & vbLf & "1 2 707" & Chr(32) & vbCr & vbLf & "OK" & vbCr
''MsgBox (gsm_mesg)
''unvalid_mesg = "+CMGR:" & Chr(34) & "REC UNREAD" & Chr(34) & "," & Chr(34) & "+919870132518" & Chr(34) & ",," & Chr(34) & "11/03/05,21:12:56+22" & Chr(34) & vbCr & "hello fuck off" & Chr(32) & vbCr & "OK" & vbCr
'
'
'If serial_loop = 1 Then
'gps_mob_no = "+919699606076"
'Else
'gps_mob_no = "+919870687973"
'End If
'
' Do
'
' input_buffer = input_buffer + MSComm1.Input
'
' 'If serial_loop = 1 Or serial_loop = 3 Then
' input_buffer = input_buffer + gps_mesg
'
' 'ElseIf serial_loop = 6 Or serial_loop = 7 Then
' input_buffer = input_buffer + gsm_mesg
'
' 'Else
' 'input_buffer = input_buffer + unvalid_mesg
'
' 'End If
'
' Loop Until InStr(input_buffer, "OK" & vbCr)
' MsgBox ("input_buffer=" & input_buffer)
' MsgBox ("Length of input_buffer=" & Len(input_buffer))
'
'
'
'If InStr(input_buffer, "REC UNREAD") Then
'
' MsgBox ("input_buffer=" & input_buffer) '--------------Check Point 2--------------'
'Incoming_Mesg.Text = Incoming_Mesg.Text + input_buffer
' strReceivedMsg = input_buffer
'
'
'len_mesg = Len(strReceivedMsg) '''''''''''Find the length of incoming mesg'''''''
' MsgBox ("len_mesg=" & len_mesg) '--------------Check Point 3--------------'
'
' '''''''''''''''''''''''''''''''''''Condition For Valid Mesg''''''''''''''''''''''''''''
' If (len_mesg 44 And Asc(Mid(strReceivedMsg, j, 1)) 34 Then
' mobile_no_mesg = mobile_no_mesg + Mid(strReceivedMsg, j, 1)
' End If
'
' If Asc(Mid(strReceivedMsg, j, 1)) = 44 Then
' bln_mobile_no_mesg = True
'
' MsgBox ("mobile_no_mesg=" & mobile_no_mesg) '-------------Check Point 4--------------'
' MsgBox ("gps_mob_no=" & gps_mob_no) '-------------Check Point 5--------------'
'
' '''''''''''''''''''''''''''''''''''''Chk Mesg belongs to GPS modem OR GSM Modem''''''''''''''''''''
'
'
'
'
' If mobile_no_mesg = gps_mob_no Then
' bln_gps_mesg = True
' gps_received_mesg_count = gps_received_mesg_count + 1
' Text1.Text = mobile_no_mesg
' MsgBox ("Received Mesg IS Gps mesg") '-------------Check Point 6--------------'
'
' Else
' bln_gsm_mesg = True
' gsm_received_mesg_count = gsm_received_mesg_count + 1
' Text4.Text = mobile_no_mesg
' MsgBox ("Received Mesg IS Gsm mesg") '-------------Check Point 7--------------'
' End If
'
' j = j + 2
' End If
'
' End If
'
'
' ''''''''''''''''''''''''''''''''''''''''''''Find Date from msg''''''''''''''''''''''''''
'
' If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = False Then
'
' If Asc(Mid(strReceivedMsg, j, 1)) 44 And Asc(Mid(strReceivedMsg, j, 1)) 34 Then
' date_of_mesg = date_of_mesg + Mid(strReceivedMsg, j, 1)
' 'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
' End If
'
' If Asc(Mid(strReceivedMsg, j, 1)) = 44 Then
' bln_date_of_mesg = True
'
' MsgBox ("date_of_mesg=" & date_of_mesg) '-------------Check Point 8--------------'
' j = j + 1
' End If
'
' End If
'
' '''''''''''''''''''''''''''''''''''''''''''''Find Time from msg'''''''''''''''''''''''
'
' If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = False Then
'
' If Asc(Mid(strReceivedMsg, j, 1)) 44 And Asc(Mid(strReceivedMsg, j, 1)) 34 And Mid(strReceivedMsg, j, 1) "+" Then
' time_of_mesg = time_of_mesg + Mid(strReceivedMsg, j, 1)
' 'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
' End If
'
' If Asc(Mid(strReceivedMsg, j, 1)) = 44 Or Mid(strReceivedMsg, j, 1) = "+" Then
'
' bln_time_of_mesg = True
' 'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
' MsgBox ("time_of_mesg=" & time_of_mesg) '-------------Check Point 9--------------'
' j = j + 1
'
' End If
'
' End If
'
' '''''''''''''''''''''''''''''''''''''''''''''move cursor towards data of mesg '''''''''''''
'
' If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = True And bln_cursor_data_mesg = False Then
'
' If Mid(strReceivedMsg, j, 1) = vbLf Then
' bln_cursor_data_mesg = True
' 'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
' j = j + 1
' End If
'
' End If
'
' '''''''''''''''''''''''''''''''''''''''''Find actual data from msg''''''''''''''''''''
'
' If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = True And bln_cursor_data_mesg = True And Mid(strReceivedMsg, j, 1) vbLf And bln_data_mesg = False Then
'
' data_mesg = data_mesg + Mid(strReceivedMsg, j, 1)
' 'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
'
' End If
'
' If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = True And bln_cursor_data_mesg = True And Mid(strReceivedMsg, j, 1) = vbLf And bln_data_mesg = False Then
'
' bln_data_mesg = True
' MsgBox ("Data mesg=" & data_mesg) '-------------Check Point 10--------------'
'
' End If
'
' Next
'
'
'
' '------------------------check Incoming Mesg is Gps mesg or Gsm mesg--------------------------'
' If bln_gps_mesg = True Then
' gps_mesg = data_mesg
' MsgBox ("gps_mesg=" & gps_mesg) '-------------Check Point 11--------------'
'
' For k = 1 To Len(gps_mesg)
'
'
'
' ''''''''''''''''''''''''''''''''''''''move cursor to ":" ''''''''''''''''''''
' If Asc(Mid(gps_mesg, k, 1)) = 58 And bln_cursor2 = False Then
' bln_cursor2 = True
' 'MsgBox (Asc(Mid(gps_mesg, k, 1)))
' k = k + 1
' End If
'
'
' ''''''''''''''''''''''''''''''''''''''Find actual latitude from msg''''''''''''''''''''
' If Asc(Mid(gps_mesg, k, 1)) 32 And bln_cursor2 = True And bln_latitude_mesg = False Then
' latitude_mesg = latitude_mesg + Mid(gps_mesg, k, 1)
' 'MsgBox (Asc(Mid(gps_mesg, k, 1)))
' End If
'
'
' If Asc(Mid(gps_mesg, k, 1)) = 32 And bln_latitude_mesg = False Then
' bln_latitude_mesg = True
' MsgBox ("latitude_mesg=" & latitude_mesg) '-------------Check Point 12--------------'
' k = k + 1
' End If
'
'
'
' ''''''''''''''''''''''''''''''''''''''move cursor to ":" ''''''''''''''''''''
' If Asc(Mid(gps_mesg, k, 1)) = 58 And bln_cursor3 = False And bln_cursor2 = True And bln_latitude_mesg = True Then
' bln_cursor3 = True
' 'MsgBox (Asc(Mid(gps_mesg, k, 1)))
' k = k + 1
' End If
'
' ''''''''''''''''''''''''''''''''''''''Find actual longitude from msg''''''''''''''''''''
' If Asc(Mid(gps_mesg, k, 1)) 32 And bln_cursor2 = True And bln_cursor3 = True And bln_latitude_mesg = True And bln_longitude_mesg = False Then
' longitude_mesg = longitude_mesg + Mid(gps_mesg, k, 1)
' 'MsgBox (Asc(Mid(gps_mesg, k, 1)))
' End If
'
'
' If Asc(Mid(gps_mesg, k, 1)) = 32 And bln_longitude_mesg = False Then
' bln_longitude_mesg = True
' 'MsgBox (Asc(Mid(gps_mesg, k, 1)))
' MsgBox ("longitude_mesg=" & longitude_mesg) '-------------Check Point 13--------------'
' k = k + 1
'
' End If
'
'
' ''''''''''''''''''''''''''''''''''''''move cursor to ":" ''''''''''''''''''''
' If Asc(Mid(gps_mesg, k, 1)) = 58 And bln_cursor4 = False And bln_cursor2 = True And bln_cursor3 = True And bln_latitude_mesg = True And bln_longitude_mesg = True Then
' bln_cursor4 = True
' k = k + 1
' End If
'
'
' ''''''''''''''''''''''''''''''''''''''Find actual GPS_Time from msg''''''''''''''''''''
' If Mid(gps_mesg, k, 1) vbCr And bln_cursor2 = True And bln_cursor3 = True And bln_cursor4 = True And bln_latitude_mesg = True And bln_longitude_mesg = True And bln_time_of_gps_mesg = False Then
' time_of_gps_mesg = time_of_gps_mesg + Mid(gps_mesg, k, 1)
' End If
'
'
'
' If Mid(gps_mesg, k, 1) = vbCr And bln_time_of_gps_mesg = False Then
' bln_time_of_gps_mesg = True
' MsgBox ("time_of_gps_mesg=" & time_of_gps_mesg) '-------------Check Point 14--------------'
' End If
' Next
'
'
'
' Else ''''''''''''''''' Extract info from GSM Mesg''''''''''''''''''
' gsm_mesg = data_mesg
' MsgBox ("gsm_mesg=" & gsm_mesg)
' MsgBox ("length of gsm_mesg=" & Len(gsm_mesg))
'
' For i = 1 To Len(gsm_mesg)
'
'
' '''''''''''''''''''''''''''''''''''''''''Find actual Source from msg''''''''''''''''''''
' If Asc(Mid(gsm_mesg, i, 1)) 32 And bln_source_mesg = False Then
' source_mesg = source_mesg + Mid(gsm_mesg, i, 1)
' 'MsgBox (Asc(Mid(gsm_mesg, i, 1)))
' 'MsgBox ("source_mesg=" & source_mesg)
'
' ElseIf Asc(Mid(gsm_mesg, i, 1)) = 32 And bln_source_mesg = False Then
' bln_source_mesg = True
' MsgBox ("source_mesg=" & source_mesg) '-------------Check Point 15--------------'
' MsgBox ("Length of source_mesg=" & Len(source_mesg))
' i = i + 1
'
' End If
'
'
' '''''''''''''''''''''''''''''''''''''''''Find actual destination from msg''''''''''''''''''''
' If Asc(Mid(gsm_mesg, i, 1)) 32 And bln_source_mesg = True And bln_dest_mesg = False Then
' dest_mesg = dest_mesg + Mid(gsm_mesg, i, 1)
' 'MsgBox (Asc(Mid(gsm_mesg, i, 1)))
' 'MsgBox ("dest_mesg=" & dest_mesg)
'
' ElseIf Asc(Mid(gsm_mesg, i, 1)) = 32 And bln_dest_mesg = False Then
' bln_dest_mesg = True
' MsgBox ("dest_mesg=" & dest_mesg) '-------------Check Point 16--------------'
' MsgBox ("Length of dest_mesg=" & Len(dest_mesg))
' i = i + 1
'
' End If
'
'
' '''''''''''''''''''''''''''''''''''''''''Find actual Bus no. from msg''''''''''''''''''''
' If Mid(gsm_mesg, i, 1) vbCr And bln_source_mesg = True And bln_dest_mesg = True And bln_busno_mesg = False Then
' busno_mesg = busno_mesg + Mid(gsm_mesg, i, 1)
' 'MsgBox ("busno_mesg=" & busno_mesg)
' 'MsgBox (Mid(gsm_mesg, i, 1))
'
' ElseIf Mid(gsm_mesg, i, 1) = vbCr And bln_busno_mesg = False Then
' bln_busno_mesg = True
' MsgBox ("busno_mesg=" & busno_mesg) '-------------Check Point 17--------------'
' MsgBox ("Length of busno_mesg=" & Len(busno_mesg))
'
' End If
'
' Next
'
'
' End If
'
'
'
' ''''''''''''''''''''''''''''''''''''''for GUI ''''''''''''''''''''''''''''''''''
'
'
'
'
' ''''''''''''''''''''''''''''''''''''''For Gps GuI Info'''''''''''''''''''''''''''''''''''''''
' MsgBox ("bln_gps_mesg=" & bln_gps_mesg)
'
' If bln_gps_mesg = True Then
' Text2.Text = gps_mesg
' Text3.Text = time_of_gps_mesg
' Text12.Text = latitude_mesg
' Text13.Text = longitude_mesg
' End If
'
'
'
'
' ''''''''''''''''''''''''''''''''''''''For GSM GuI Info'''''''''''''''''''''''''''''''''''''''
' MsgBox ("bln_gsm_mesg=" & bln_gsm_mesg)
'
' If bln_gsm_mesg = True Then
'
'
' Text5.Text = date_of_mesg & " " & time_of_mesg
' Text6.Text = len_mesg
' Text8.Text = busno_mesg
' Text9.Text = source_mesg
' Text10.Text = dest_mesg
' Text11.Text = busno_mesg
'
' If (Len(source_mesg)) 1 Or Len(dest_mesg) 1 Or (Len(busno_mesg)) 3 Then
' bln_valid_status = False
' MsgBox ("bln_valid_status=" & bln_valid_status & " Received Query Not Valid")
' End If
'
' End If
'
'
' ''''''''''''''''''''''''''''''''''Calculate externally Time using Spped n Distance------------------------'
' Text14.Text = "6"
'
' Text15.Text = "25"
'
' distance = Val(Text14.Text)
'
' speed = Val(Text15.Text)
'
' Text16.Text = (distance / speed) * 60
'
'
'
' '''''''''''''''''''''''''''''''''chk uor GPS signal''''''''''''''''''''''''''
'
' If Text12.Text = "Text12" Then
' bln_gps_status = False
' Text19.Text = "keep searching"
' Else
' bln_gps_status = True
' Text19.Text = "ok"
' End If
' MsgBox ("bln_gps_status=" & bln_gps_status)
'
'
' ''''''''''''''''''''''''''''''''Chk uor GSM Signal'''''''''''''''''''''''''''''
'
' If Text8.Text = "Text8" Then
' bln_gsm_status = False
' Text20.Text = "keep searching"
' Else
' bln_gsm_status = True
' Text20.Text = "ok"
' End If
'
'
' MsgBox ("bln_gsm_status=" & bln_gsm_status)
'End If
'
' ''''''''''''''''''''''''''Chk For Both Mesg'''''''''''''''''''''''''''''''''
'
'
'
'
'
' ''''''''''''''''''''If all Mesg Received n all r correct then only Send Mesg to GSM user''''''''''''''''''''''''
' If bln_valid_status = True Then
'
'
' If bln_gps_status = True And bln_gsm_status = True And bln_gsm_mesg = True Then
'
' Text17.Text = "Bus No=" & Text8.Text & " Approx. Arrival in Time=" & Text16.Text & "Min." & " Source Stn=" & Text9.Text & " Destination Stn=" & Text10.Text & " Gps Latitute=" & Text12.Text & " Gps Longitude=" & Text13.Text & " Gps (Last Location) Mesg Time=" & Text3.Text & vbCr & Chr(26)
' 'MsgBox ("AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10))
'
' 'MSComm1.Output = "AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10)
' 'MSComm1.Output = Text17.Text & vbCr & Chr(26)
'
' 'MsgBox (Text17.Text & vbCr & Chr(26))
'
' sent_mesg_count = sent_mesg_count + 1
' MsgBox ("Mesg Sent")
'
' End If
'
'
' ''''''''''''''''''''Else show n send Invalid Mesg Error TO User'''''''''''''''''
'
'
' Else
' Text17.Text = "Not Valid mesg " & vbCr & "Your Mesg:" & data_mesg & "Is Unreadable. Please Use Standard Format as 1 5 707 " & vbCr & Chr(26)
' 'MsgBox ("Not Valid mesg " & vbCr & "Your Mesg:" & data_mesg & "Is Unreadable. Please Use Standard Format as 1 5 707 ")
' 'MSComm1.Output = "AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10)
' 'MSComm1.Output = "Not Valid mesg " & vbCr & "Your Mesg:" & data_mesg & " Is Unreadable. Please Use Standard Format as 1 5 707 " & vbCr & Chr(26)
' unvalid_mesg_count = unvalid_mesg_count + 1
' Text8.Text = "Text8"
' Text9.Text = "Unreadable"
' Text10.Text = "Unreadable"
' Text11.Text = "Unreadable"
' MsgBox ("Error Report Mesg Sent")
'
' End If
'
'
'
'
'Text18.Text = Text4.Text
'Text21.Text = gsm_received_mesg_count
'Text22.Text = gps_received_mesg_count
'Text23.Text = sent_mesg_count
'Text24.Text = unvalid_mesg_count
'
'received_mesg_count = gps_received_mesg_count + gsm_received_mesg_count
'Text25.Text = received_mesg_count
'Text26.Text = sent_mesg_count + unvalid_mesg_count
'MsgBox ("check for new mesg")
'
'ElseIf Len(input_buffer) 16 Then
' MSComm1.Output = "AT+CMGD=1" & vbCrLf
' 'MsgBox (MSComm1.Input)
' MsgBox ("Mesg Deleted")
'
'End If
'
'Next
'
'End Sub
'
'Private Sub Command2_Click()
'
' Text16.Text = (Val(Text14.Text) / Val(Text15.Text)) * 60
'
' If Text19.Text = "ok" And Text20.Text = "ok" Then
' Text17.Text = "Bus No=" & Text8.Text & " Approx. Arrival in Time=" & Text16.Text & "Min." & " Source Stn=" & Text9.Text & " Destination Stn=" & Text10.Text & " Gps Latitute=" & Text12.Text & " Gps Longitude=" & Text13.Text & " Gps (Last Location) Mesg Time=" & Text3.Text & vbCr & Chr(26)
' 'MsgBox ("AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10))
'
' 'MSComm1.Output = "AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10)
' 'MSComm1.Output = Text17.Text & vbCr & Chr(26)
'
' 'MsgBox (Text17.Text & vbCr & Chr(26))
'
'
' MsgBox ("Modified Mesg Sent")
' End If
'
End Sub
Private Sub Command3_Click()
'MSComm1.PortOpen = False
End Sub
Private Sub Form_Load() 'first load this
If MSComm1.PortOpen Then MSComm1.PortOpen = False 'Check com1 is being used by other process or not ,if yes den close that process
MSComm1.CommPort = 1 'select com port 1
MSComm1.Settings = "9600,N,8,1" 'set the badurate,parity,databits,stopbits for the connection
MSComm1.DTREnable = True 'ready pc to take data from modem
MSComm1.RTSEnable = True 'ready modem to take commands from pc
MSComm1.InputLen = 0 'Read entire Rx Buffer
MSComm1.RThreshold = 1 'enable the oncomm event for every reveived character
MSComm1.SThreshold = 1 'enable the oncomm event for send characters
MSComm1.Handshaking = comNone ' disable handshaking
MSComm1.PortOpen = True 'open the serial port
'MSComm1.Output = "AT+CTZU=1" & vbCr '-------------GMT to IST converte-----------'
MSComm1.Output = "AT+CMGR=1" & vbCr 'Check First incoming mesg of Gsm Modem
End Sub
Private Sub Form_Unload(Cancel As Integer)
If MSComm1.PortOpen = True Then
MSComm1.PortOpen = False
Exit Sub
'Close #1
End If
End Sub
Private Sub MSComm1_OnComm()
'MSComm1.CommPort = 1
' 'set the badurate,parity,databits,stopbits for the connection
'MSComm1.Settings = "9600,N,8,1"
' 'set the DRT and RTS flags
'MSComm1.DTREnable = True
' 'ready pc to take data from modem
'
'MSComm1.RTSEnable = True
' 'ready modem to take commands from pc
'
'
'MSComm1.InputLen = 0 'Read entire Rx Buffer
'
' 'enable the oncomm event for every reveived character
'MSComm1.RThreshold = 1
' 'enable the oncomm event for send characters
'MSComm1.SThreshold = 1
'
'MSComm1.Handshaking = comNone ' disable handshaking
'
'MSComm1.PortOpen = True 'open the serial port
'MSComm1.Output = "AT+CTZU=1" & vbCr '-------------GMT to IST converte-----------'
MSComm1.Output = "AT+CMGR=1" & vbCr
'MsgBox ("MSComm1.input=" & MSComm1.Input) '--------------Check Point 1--------------'
''''''''''''''''''''''''''''''''''declaration of variables''''''''''''
Dim gps_mesg As String
Dim gsm_mesg As String
Dim input_buffer As String
Dim mobile_no_mesg As String
Dim strReceivedMsg As String
Dim date_of_mesg As String
Dim time_of_mesg As String
Dim time_of_gps_mesg As String
Dim data_mesg As String
Dim source_mesg As String
Dim dest_mesg As String
Dim busno_mesg As String
Dim gps_mob_no As String
Dim gsm_mob_no As String
Dim latitude_mesg As String
Dim longitude_mesg As String
Dim len_mesg As String
Dim gps_status As String
Dim gsm_status As String
Dim unvalid_mesg As String
'------------------------ make sure tht all variables are Clear-------------------
gps_mesg = ""
gsm_mesg = ""
input_buffer = ""
mobile_no_mesg = ""
strReceivedMsg = ""
date_of_mesg = ""
time_of_mesg = ""
time_of_gps_mesg = ""
data_mesg = ""
source_mesg = ""
dest_mesg = ""
busno_mesg = ""
gps_mob_no = ""
gsm_mob_no = ""
latitude_mesg = ""
longitude_mesg = ""
len_mesg = ""
gps_status = ""
gsm_status = ""
'''''''''''''''''''declaration of variables''''''''''''
Dim time As Integer
Dim speed As Integer
Dim distance As Integer
Dim received_mesg_count As Integer
Dim sent_mesg_count As Integer
Dim unvalid_mesg_count As Integer
Dim gps_received_mesg_count As Integer
Dim gsm_received_mesg_count As Integer
''''''''''''''''''''''''''define status flags'''''''''''''''''''''''''
Dim bln As Boolean
Dim bln_gsm_mesg As Boolean
Dim bln_gps_mesg As Boolean
Dim bln_valid_status As Boolean
Dim bln_mobile_no_mesg As Boolean
Dim bln_busno_mesg As Boolean
Dim bln_date_of_mesg As Boolean
Dim bln_time_of_mesg As Boolean
Dim bln_time_of_gps_mesg As Boolean
Dim bln_data_mesg As Boolean
Dim bln_source_mesg As Boolean
Dim bln_dest_mesg As Boolean
Dim bln_cursor_data_mesg As Boolean
Dim bln_latitude_mesg As Boolean
Dim bln_longitude_mesg As Boolean
Dim bln_gps_time As Boolean
Dim bln_cursor2 As Boolean
Dim bln_cursor3 As Boolean
Dim bln_cursor4 As Boolean
Dim bln_gps_status As Boolean
Dim bln_gsm_status As Boolean
Dim bln_blank_mesg As Boolean
''''''''''''''''''' make sure tht all flags are false''''''''''
bln = False
bln_gsm_mesg = False
bln_gps_mesg = False
bln_valid_status = False
bln_mobile_no_mesg = False
bln_busno_mesg = False
bln_date_of_mesg = False
bln_time_of_mesg = False
bln_time_of_gps_mesg = False
bln_data_mesg = False
bln_source_mesg = False
bln_dest_mesg = False
bln_cursor_data_mesg = False
bln_latitude_mesg = False
bln_longitude_mesg = False
bln_cursor2 = False
bln_cursor3 = False
bln_cursor4 = False
bln_gps_statu = False
bln_gsm_status = False
bln_blank_mesg = False
'gps_mesg = "+CMGR:" & Chr(34) & "REC UNREAD" & Chr(34) & "," & Chr(34) & "+919870687973" & Chr(34) & ",," & Chr(34) & "11/03/05,21:12:56+22" & vbCr & vbLf & "Latitude is:19.65" & Chr(32) & "longitude is:71.65" & Chr(32) & "time:12.12" & vbCr & vbLf & "OK" & vbCr
'MsgBox (gps_mesg)
'gsm_mesg = "+CMGR:" & Chr(34) & "REC UNREAD" & Chr(34) & "," & Chr(34) & "+919870132518" & Chr(34) & ",," & Chr(34) & "11/03/05,21:12:56+22" & vbCr & vbLf & "1 2 707" & Chr(32) & vbCr & vbLf & "OK" & vbCr
'MsgBox (gsm_mesg)
'unvalid_mesg = "+CMGR:" & Chr(34) & "REC UNREAD" & Chr(34) & "," & Chr(34) & "+919870132518" & Chr(34) & ",," & Chr(34) & "11/03/05,21:12:56+22" & Chr(34) & vbCr & "hello fuck off" & Chr(32) & vbCr & "OK" & vbCr
If serial_loop = 1 Then
gps_mob_no = "+919699606076"
Else
gps_mob_no = "+919870687973"
End If
Do
input_buffer = input_buffer + MSComm1.Input
'If serial_loop = 1 Or serial_loop = 3 Then
input_buffer = input_buffer + gps_mesg
'ElseIf serial_loop = 6 Or serial_loop = 7 Then
input_buffer = input_buffer + gsm_mesg
'Else
'input_buffer = input_buffer + unvalid_mesg
'End If
Loop Until InStr(input_buffer, "OK" & vbCr)
MsgBox ("input_buffer=" & input_buffer)
MsgBox ("Length of input_buffer=" & Len(input_buffer))
If InStr(input_buffer, "REC UNREAD") Then
MsgBox ("input_buffer=" & input_buffer) '--------------Check Point 2--------------'
Incoming_Mesg.Text = Incoming_Mesg.Text + input_buffer
strReceivedMsg = input_buffer
len_mesg = Len(strReceivedMsg) '''''''''''Find the length of incoming mesg'''''''
MsgBox ("len_mesg=" & len_mesg) '--------------Check Point 3--------------'
'''''''''''''''''''''''''''''''''''Condition For Valid Mesg''''''''''''''''''''''''''''
If (len_mesg 44 And Asc(Mid(strReceivedMsg, j, 1)) 34 Then
mobile_no_mesg = mobile_no_mesg + Mid(strReceivedMsg, j, 1)
End If
If Asc(Mid(strReceivedMsg, j, 1)) = 44 Then
bln_mobile_no_mesg = True
MsgBox ("mobile_no_mesg=" & mobile_no_mesg) '-------------Check Point 4--------------'
MsgBox ("gps_mob_no=" & gps_mob_no) '-------------Check Point 5--------------'
'''''''''''''''''''''''''''''''''''''Chk Mesg belongs to GPS modem OR GSM Modem''''''''''''''''''''
If mobile_no_mesg = gps_mob_no Then
bln_gps_mesg = True
gps_received_mesg_count = gps_received_mesg_count + 1
Text1.Text = mobile_no_mesg
MsgBox ("Received Mesg IS Gps mesg") '-------------Check Point 6--------------'
Else
bln_gsm_mesg = True
gsm_received_mesg_count = gsm_received_mesg_count + 1
Text4.Text = mobile_no_mesg
MsgBox ("Received Mesg IS Gsm mesg") '-------------Check Point 7--------------'
End If
j = j + 2
End If
End If
''''''''''''''''''''''''''''''''''''''''''''Find Date from msg''''''''''''''''''''''''''
If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = False Then
If Asc(Mid(strReceivedMsg, j, 1)) 44 And Asc(Mid(strReceivedMsg, j, 1)) 34 Then
date_of_mesg = date_of_mesg + Mid(strReceivedMsg, j, 1)
'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
End If
If Asc(Mid(strReceivedMsg, j, 1)) = 44 Then
bln_date_of_mesg = True
MsgBox ("date_of_mesg=" & date_of_mesg) '-------------Check Point 8--------------'
j = j + 1
End If
End If
'''''''''''''''''''''''''''''''''''''''''''''Find Time from msg'''''''''''''''''''''''
If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = False Then
If Asc(Mid(strReceivedMsg, j, 1)) 44 And Asc(Mid(strReceivedMsg, j, 1)) 34 And Mid(strReceivedMsg, j, 1) "+" Then
time_of_mesg = time_of_mesg + Mid(strReceivedMsg, j, 1)
'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
End If
If Asc(Mid(strReceivedMsg, j, 1)) = 44 Or Mid(strReceivedMsg, j, 1) = "+" Then
bln_time_of_mesg = True
'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
MsgBox ("time_of_mesg=" & time_of_mesg) '-------------Check Point 9--------------'
j = j + 1
End If
End If
'''''''''''''''''''''''''''''''''''''''''''''move cursor towards data of mesg '''''''''''''
If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = True And bln_cursor_data_mesg = False Then
If Mid(strReceivedMsg, j, 1) = vbLf Then
bln_cursor_data_mesg = True
'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
j = j + 1
End If
End If
'''''''''''''''''''''''''''''''''''''''''Find actual data from msg''''''''''''''''''''
If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = True And bln_cursor_data_mesg = True And Mid(strReceivedMsg, j, 1) vbLf And bln_data_mesg = False Then
data_mesg = data_mesg + Mid(strReceivedMsg, j, 1)
'MsgBox (Asc(Mid(strReceivedMsg, j, 1)))
End If
If bln = True And bln_mobile_no_mesg = True And bln_date_of_mesg = True And bln_time_of_mesg = True And bln_cursor_data_mesg = True And Mid(strReceivedMsg, j, 1) = vbLf And bln_data_mesg = False Then
bln_data_mesg = True
MsgBox ("Data mesg=" & data_mesg) '-------------Check Point 10--------------'
End If
Next
'------------------------check Incoming Mesg is Gps mesg or Gsm mesg--------------------------'
If bln_gps_mesg = True Then
gps_mesg = data_mesg
MsgBox ("gps_mesg=" & gps_mesg) '-------------Check Point 11--------------'
For k = 1 To Len(gps_mesg)
''''''''''''''''''''''''''''''''''''''move cursor to ":" ''''''''''''''''''''
If Asc(Mid(gps_mesg, k, 1)) = 58 And bln_cursor2 = False Then
bln_cursor2 = True
'MsgBox (Asc(Mid(gps_mesg, k, 1)))
k = k + 1
End If
''''''''''''''''''''''''''''''''''''''Find actual latitude from msg''''''''''''''''''''
If Asc(Mid(gps_mesg, k, 1)) 32 And bln_cursor2 = True And bln_latitude_mesg = False Then
latitude_mesg = latitude_mesg + Mid(gps_mesg, k, 1)
'MsgBox (Asc(Mid(gps_mesg, k, 1)))
End If
If Asc(Mid(gps_mesg, k, 1)) = 32 And bln_latitude_mesg = False Then
bln_latitude_mesg = True
MsgBox ("latitude_mesg=" & latitude_mesg) '-------------Check Point 12--------------'
k = k + 1
End If
''''''''''''''''''''''''''''''''''''''move cursor to ":" ''''''''''''''''''''
If Asc(Mid(gps_mesg, k, 1)) = 58 And bln_cursor3 = False And bln_cursor2 = True And bln_latitude_mesg = True Then
bln_cursor3 = True
'MsgBox (Asc(Mid(gps_mesg, k, 1)))
k = k + 1
End If
''''''''''''''''''''''''''''''''''''''Find actual longitude from msg''''''''''''''''''''
If Asc(Mid(gps_mesg, k, 1)) 32 And bln_cursor2 = True And bln_cursor3 = True And bln_latitude_mesg = True And bln_longitude_mesg = False Then
longitude_mesg = longitude_mesg + Mid(gps_mesg, k, 1)
'MsgBox (Asc(Mid(gps_mesg, k, 1)))
End If
If Asc(Mid(gps_mesg, k, 1)) = 32 And bln_longitude_mesg = False Then
bln_longitude_mesg = True
'MsgBox (Asc(Mid(gps_mesg, k, 1)))
MsgBox ("longitude_mesg=" & longitude_mesg) '-------------Check Point 13--------------'
k = k + 1
End If
''''''''''''''''''''''''''''''''''''''move cursor to ":" ''''''''''''''''''''
If Asc(Mid(gps_mesg, k, 1)) = 58 And bln_cursor4 = False And bln_cursor2 = True And bln_cursor3 = True And bln_latitude_mesg = True And bln_longitude_mesg = True Then
bln_cursor4 = True
k = k + 1
End If
''''''''''''''''''''''''''''''''''''''Find actual GPS_Time from msg''''''''''''''''''''
If Mid(gps_mesg, k, 1) vbCr And bln_cursor2 = True And bln_cursor3 = True And bln_cursor4 = True And bln_latitude_mesg = True And bln_longitude_mesg = True And bln_time_of_gps_mesg = False Then
time_of_gps_mesg = time_of_gps_mesg + Mid(gps_mesg, k, 1)
End If
If Mid(gps_mesg, k, 1) = vbCr And bln_time_of_gps_mesg = False Then
bln_time_of_gps_mesg = True
MsgBox ("time_of_gps_mesg=" & time_of_gps_mesg) '-------------Check Point 14--------------'
End If
Next
Else ''''''''''''''''' Extract info from GSM Mesg''''''''''''''''''
gsm_mesg = data_mesg
MsgBox ("gsm_mesg=" & gsm_mesg)
MsgBox ("length of gsm_mesg=" & Len(gsm_mesg))
For i = 1 To Len(gsm_mesg)
'''''''''''''''''''''''''''''''''''''''''Find actual Source from msg''''''''''''''''''''
If Asc(Mid(gsm_mesg, i, 1)) 32 And bln_source_mesg = False Then
source_mesg = source_mesg + Mid(gsm_mesg, i, 1)
'MsgBox (Asc(Mid(gsm_mesg, i, 1)))
'MsgBox ("source_mesg=" & source_mesg)
ElseIf Asc(Mid(gsm_mesg, i, 1)) = 32 And bln_source_mesg = False Then
bln_source_mesg = True
MsgBox ("source_mesg=" & source_mesg) '-------------Check Point 15--------------'
MsgBox ("Length of source_mesg=" & Len(source_mesg))
i = i + 1
End If
'''''''''''''''''''''''''''''''''''''''''Find actual destination from msg''''''''''''''''''''
If Asc(Mid(gsm_mesg, i, 1)) 32 And bln_source_mesg = True And bln_dest_mesg = False Then
dest_mesg = dest_mesg + Mid(gsm_mesg, i, 1)
'MsgBox (Asc(Mid(gsm_mesg, i, 1)))
'MsgBox ("dest_mesg=" & dest_mesg)
ElseIf Asc(Mid(gsm_mesg, i, 1)) = 32 And bln_dest_mesg = False Then
bln_dest_mesg = True
MsgBox ("dest_mesg=" & dest_mesg) '-------------Check Point 16--------------'
MsgBox ("Length of dest_mesg=" & Len(dest_mesg))
i = i + 1
End If
'''''''''''''''''''''''''''''''''''''''''Find actual Bus no. from msg''''''''''''''''''''
If Mid(gsm_mesg, i, 1) vbCr And bln_source_mesg = True And bln_dest_mesg = True And bln_busno_mesg = False Then
busno_mesg = busno_mesg + Mid(gsm_mesg, i, 1)
'MsgBox ("busno_mesg=" & busno_mesg)
'MsgBox (Mid(gsm_mesg, i, 1))
ElseIf Mid(gsm_mesg, i, 1) = vbCr And bln_busno_mesg = False Then
bln_busno_mesg = True
MsgBox ("busno_mesg=" & busno_mesg) '-------------Check Point 17--------------'
MsgBox ("Length of busno_mesg=" & Len(busno_mesg))
End If
Next
End If
''''''''''''''''''''''''''''''''''''''for GUI ''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''''For Gps GuI Info'''''''''''''''''''''''''''''''''''''''
MsgBox ("bln_gps_mesg=" & bln_gps_mesg)
If bln_gps_mesg = True Then
Text2.Text = gps_mesg
Text3.Text = time_of_gps_mesg
Text12.Text = latitude_mesg
Text13.Text = longitude_mesg
End If
''''''''''''''''''''''''''''''''''''''For GSM GuI Info'''''''''''''''''''''''''''''''''''''''
MsgBox ("bln_gsm_mesg=" & bln_gsm_mesg)
If bln_gsm_mesg = True Then
Text5.Text = date_of_mesg & " " & time_of_mesg
Text6.Text = len_mesg
Text8.Text = busno_mesg
Text9.Text = source_mesg
Text10.Text = dest_mesg
Text11.Text = busno_mesg
If (Len(source_mesg)) 1 Or Len(dest_mesg) 1 Or (Len(busno_mesg)) 3 Then
bln_valid_status = False
MsgBox ("bln_valid_status=" & bln_valid_status & " Received Query Not Valid")
End If
End If
''''''''''''''''''''''''''''''''''Calculate externally Time using Spped n Distance------------------------'
Text14.Text = "6"
Text15.Text = "25"
distance = Val(Text14.Text)
speed = Val(Text15.Text)
Text16.Text = (distance / speed) * 60
'''''''''''''''''''''''''''''''''chk uor GPS signal''''''''''''''''''''''''''
If Text12.Text = "Text12" Then
bln_gps_status = False
Text19.Text = "keep searching"
Else
bln_gps_status = True
Text19.Text = "ok"
End If
MsgBox ("bln_gps_status=" & bln_gps_status)
''''''''''''''''''''''''''''''''Chk uor GSM Signal'''''''''''''''''''''''''''''
If Text8.Text = "Text8" Then
bln_gsm_status = False
Text20.Text = "keep searching"
Else
bln_gsm_status = True
Text20.Text = "ok"
End If
MsgBox ("bln_gsm_status=" & bln_gsm_status)
End If
''''''''''''''''''''''''''Chk For Both Mesg'''''''''''''''''''''''''''''''''
''''''''''''''''''''If all Mesg Received n all r correct then only Send Mesg to GSM user''''''''''''''''''''''''
If bln_valid_status = True Then
If bln_gps_status = True And bln_gsm_status = True And bln_gsm_mesg = True Then
Text17.Text = "Bus No=" & Text8.Text & " Approx. Arrival in Time=" & Text16.Text & "Min." & " Source Stn=" & Text9.Text & " Destination Stn=" & Text10.Text & " Gps Latitute=" & Text12.Text & " Gps Longitude=" & Text13.Text & " Gps (Last Location) Mesg Time=" & Text3.Text & vbCr & Chr(26)
'MsgBox ("AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10))
'MSComm1.Output = "AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10)
'MSComm1.Output = Text17.Text & vbCr & Chr(26)
'MsgBox (Text17.Text & vbCr & Chr(26))
sent_mesg_count = sent_mesg_count + 1
MsgBox ("Mesg Sent")
End If
''''''''''''''''''''Else show n send Invalid Mesg Error TO User'''''''''''''''''
Else
Text17.Text = "Not Valid mesg " & vbCr & "Your Mesg:" & data_mesg & "Is Unreadable. Please Use Standard Format as 1 5 707 " & vbCr & Chr(26)
'MsgBox ("Not Valid mesg " & vbCr & "Your Mesg:" & data_mesg & "Is Unreadable. Please Use Standard Format as 1 5 707 ")
'MSComm1.Output = "AT+CMGS=" & Chr$(34) & Text4.Text & Chr$(34) & Chr(13) & Chr(10)
'MSComm1.Output = "Not Valid mesg " & vbCr & "Your Mesg:" & data_mesg & " Is Unreadable. Please Use Standard Format as 1 5 707 " & vbCr & Chr(26)
unvalid_mesg_count = unvalid_mesg_count + 1
Text8.Text = "Text8"
Text9.Text = "Unreadable"
Text10.Text = "Unreadable"
Text11.Text = "Unreadable"
MsgBox ("Error Report Mesg Sent")
End If
Text18.Text = Text4.Text
Text21.Text = gsm_received_mesg_count
Text22.Text = gps_received_mesg_count
Text23.Text = sent_mesg_count
Text24.Text = unvalid_mesg_count
received_mesg_count = gps_received_mesg_count + gsm_received_mesg_count
Text25.Text = received_mesg_count
Text26.Text = sent_mesg_count + unvalid_mesg_count
MsgBox ("check for new mesg")
ElseIf Len(input_buffer) 16 Then
MSComm1.Output = "AT+CMGD=1" & vbCr
MsgBox (MSComm1.Input)
MsgBox ("Mesg Deleted")
End If
MSComm1.Output = "AT+CMGR=1" & vbCr
End Sub
i want to use this code n what want is that if i gt mesg frm gps user then it wll go on +cmti :1 then how would i delete it n make a space for gsm user to ask query by sending mesg n process both n reply to gsm use
my emial id is : rjbhayani@yahoo.com plz help me this is our final proj
lazarwilson
Thank You
Welcome !!! All the best,
Welcome !!!
All the best,
c code for sending mms using at commands
hi ,
could you please help i want to develop a c code project fro sending mms using the available at commands for sending mms.I do have the at commands for sending mms,but dono how to implement in c.
thanks and regards
balaji r.m
balajilong2gmail.com
im not good in C, you can
im not good in C, you can convert my vb codes in C if you want to..
send sms using mobile phone modem using php
hi i need to send sms using php via mobile phone modem not using internet... i need to develoop an app in which a sms will be send but it should use mobile phone connected to computer .. no internet is available...pls suggest a solution with code if possible...thanks
Sending SMS from PHP
use DCOM in your Php code
Open the list of Windows services (Start -> Control Panel -> Administrative tools -> Services)
Find the service 'wampapache', click it by right mouse button and select 'Properties'
Select the tab 'Log On', select 'System account' and set the flag 'Allow to interact with desktop'
Click OK, then close WAMP server and start it again
Put a sample PHP script into your www directory.
// Get address and message
$addr = $_GET['addr'];
$body = $_GET['body'];
// Open GSM Modem Driver
$hgsmdrv = new COM("GSM.SMSDriver") or die("Unable to open GSM Modem Driver");
// Connect to GSM modem
$hgsmdrv->Connect();
// Create message
$sms = new COM("GSM.SMSMessage") or die("Unable to create SMS message");
$sms->To = $addr;
$sms->Body = $body;
// Send message
$sms->Send();
//free the objects
$hgsmdrv = null;
$sms = null;
echo "Message '$body' has been sent to '$addr'";
?>
to send and receive sms on pc
i want to create web application which can send and receive sms through GSM modem using C# code.Can u help me.
Student
Email-Id:-tauras_girl2@yahoo.com
i will send a sample to you,
i will send a sample to you, but it is writeen in VB.net translate it to C#
Want help
good afternoon sir i am creating an application in c#.net in that i have to send and receive SMS and which can also connect the internet throug mobile to PC. so sir can u help me for that?? i want the code for the internet connection using the mobile modem. and the Sms sending and recieving message.
My Email id is romil.sheth9@gmail.com
Thanx Sir in advance
Attaching file
Sir edmond..you're such a great programmer...i need your help for our thesis and it would be a great help..do you have any program that attaches file from a pc with an sms, the file is not that too large..or do you have any program that transmit a file from a pc by using a mms..would it be possible?
Email: morphme08@yahoo.com
yes it is possible but you
yes it is possible but you will use GPRS to send file as a packet data..
for more info please email me.. tnx
Need Help in C language
Hello sir,
I m Jitendra Bisht i need your help How I can Print Data from printer using my c program under DOS environment. have already used PRN keyword but it doesn't work. Dear Sir can u send my solution for it. my email-id is jeet.mp3@gmail.com
HELP :)
Just downloaded ur code for sms sir edmond and its really great. its simple and easy to understand. Im doing my thesis now and part of it is sending bills through sms.
I am using the 'prepaid smart bro kit' as my modem. pinalitan ko lang po ng sim ng smart na pangtext talaga. at first it worked. siguro nkasend po ako ng 9 times. pero Now nagtataka po ako bakit hindi na sya gumagana.
I tried it even sa hyperterminal. pero di na rin po.
Sir ed help naman po, baka alam nyo po ang dahilan?
Thanks in advance :)
im sending my new version of
im sending my new version of Bulk sending SMS project hope this will help you..
just give me your feedbacks..
all the best
need help regarding the gsm modem programming
hello sir..
i am doing a project based on sms based security system using gsm modem. i am using psoc to control the modem but not having much knowledge about the modem programming. please help in programming. if you can explain the algorithm or steps , would be fine.
sherry(email2sharat@gmail.com)
mail me @
mail me @
dark_raditz0825@yahoo.com
09212279363
for your requirements
SMS based systems...
hey sherry, did you get your answers to your query? i am also having the same problems just like yours. hope you could help me... :D
Receiving SMS
Hello Sir, do you have a visual basic program for receiving sms? (from phone back to pc).how will i know RtsHold and HandShake of my modem?..thanks :)
here's my mail: litangel20@yahoo.com
thank you so much :)
yes, i already emailed u
yes, i already emailed u dear, hope it will help you..
PHP receiving SMS text messages
how can i receive messages using php.. please help.. we are using gsm modems
Receiving
Do you have the receive sms visual basic? will you post it here sir? the program is good but i'm also waiting for your receiving sms programmed in visual basic too..i hope you could also post it too..thanks sir
please email for demo
please email for demo programs..
seeking your help
sir i am sowmya(BE), doing my final yr project on topic "REMOTE MONITORING AND CONTROL OF WINDMILL USING ENBEDDED SYSTEMS"...we are using keil c lang for programming,i wanted to know form you know,how to receive a data by gsm modem that has been sent using mobile phone.. can you help me out with entire picture of interfacing layout behind it, since i am new to GSM technology.i will be even more thank full, if you can mail me the details to my id .. sowmyasivakumar@in.com
C program
can u please help me out sending at commands to a gsm MODEM in c programming..?
Need SMS code
Hello sir,
I am doing my proj in php. i need source code for sending and receiving sms in my project. pls send to my mail id
mkdeepak87@gmail.com
thanks in advance
deepak
please contact me for request
please contact me for request projects..
tnx
09212279363
hello
sir,, i want code for sending and receiving sms by PHP and i want store sms in My Sql .. pls help me sir thanking
this my mail id: ramitmass@gmail.com
nokia 6610 phone
sir, ok po ba gamitin nokia 6610 for this sample project?
to be sure , use 5110 or 6210
to be sure , use 5110 or 6210 and huawei modem(cheap lng kz cla unlike wave com, siemens,etc)
can't send message
Sir Edmond thanks for the advice..i'm trying to send an sms using nokia 6310i connected, i've connected it using rs232 and dlr3 to my laptop and i also change the setting and com port but a message "message not send" which i can't send a message..is this program ok when i connect a cellphone directly to usb or it needed to be connected with a serial port?..thanks in advanced..hope u will become more successful in programming..
Pages
Add new comment