-
June 3rd, 2014, 05:10 AM
#1
GSM data shifting continuously
Hi,
I have written a code to get the GSM data on serial port. So when GSM module get's a call it sends the data
RING+CLIP: "+919823596784",145,"",,"",0".
However this data keeps on shifting towards right or left. I want to extract the phone number from this data. I thought of detecting first two word i.e RING+CLIP, using Instr function. However even it is present in incoming string, it's giving value 0' it means string is not present in given string. So i can not extract phone number. Moreover data keeps on shifting, so position of those two words is also not fix. Here is the code,
Code:
Dim str As String
Dim val As Integer
Dim str_1 As String
Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
Private Sub Form_Load()
On Error GoTo errx:
Dim strValue As String ' define Buffer value from Modem
MSComm1.CommPort = 6 'comm port no.
MSComm1.Settings = "9600,n,8,1"
MSComm1.RThreshold = 47 'no. of chr to receive
MSComm1.InputLen = 0 ' no. of chr on which oncomm event fires
MSComm1.PortOpen = True 'open comm port
MSComm1.Output = "AT + CLIP = 1" + Chr(13)
Sleep 500
Exit Sub
errx:
MsgBox "error"
End Sub
Private Sub MSComm1_OnComm()
'str = " RING+CLIP"
Select Case MSComm1.CommEvent
''Events
Case comEvReceive
''Case comEvRing
str_1 = Text1.Text
Text2.Text = InStr(str_1, "RING+CLIP")
''Text3.Text = Mid(str, 22, 10)
Case Else
End Select
End Sub
How to stop shifting of data, and extract desired number from this.
-
June 10th, 2014, 11:46 AM
#2
Re: GSM data shifting continuously
I'd let in 2 Rings, and then parse. Caller ID comes in after the first ring.
-
June 10th, 2014, 01:08 PM
#3
Re: GSM data shifting continuously
Originally Posted by djc_247
Hi,
I have written a code to get the GSM data on serial port. So when GSM module get's a call it sends the data
RING+CLIP: "+919823596784",145,"",,"",0".
I guess it should be something like
Code:
RING
+CLIP: "+919823596784",145,"",,"",0"
instead...
Victor Nijegorodov
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|