http://www.serasidis.gr/circuits/smscontrol/smscontroller.htm :SMS remote control
من 2 سال پیش روی همین موضوع با یکی از استادام کار کردم اما جواب نگرفتم تو سایت Serasidis.gr هم گفته من روی گوشی مدل ... Ericson جواب گرفتم ولی برای گوشی های دیگه جواب بده یا نه نمیدونم
باید پروتکل داخلی گوشی ای که میخواهی استفاده کنی بلد باشی
بهترین راه تهیه یک ماژول گوشه مثل نوکیا
'wait until the mode is ready after power up
Waitms 3000
#if Uselcd = 1
Lcd "Init modem"
#endif
Print "AT" ' send AT command twice to activate the modem
Print "AT"
Flushbuf ' flush the buffer
Print "ATE0"
#if Uselcd = 1
Home Lower
#endif
Do
Print "AT" : ' Waitms 100
Getline Sret ' get data from modem
#if Uselcd = 1
Lcd Sret ' feedback on display
#endif
Loop Until Sret = "OK" ' modem must send OK
Flushbuf ' flush the input buffer
#if Uselcd = 1
Home Upper : Lcd "Get pin mode"
#endif
Print "AT+cpin?" ' get pin status
Getline Sret
#if Uselcd = 1
Home Lower : Lcd Sret
#endif
If Sret = "+CPIN: SIM PIN" Then
Print Pincode ' send pincode
End If
Flushbuf
#if Uselcd = 1
Home Upper : Lcd "set text mode"
#endif
Print "AT+CMGF=1" ' set SMS text mode
Getline Sret ' get OK status
#if Uselcd = 1
Home Lower : Lcd Sret
#endif
'main loop
Do
Getline Sret ' wait for a modem response
#if Uselcd = 1
Cls
Lcd "Msg from modem"
Home Lower : Lcd Sret
#endif
I = Instr(sret , ":" ' look for :
If I > 0 Then 'found it
Stemp = Left(sret , I)
Select Case Stemp
Case "+CMTI:" : Showsms Sret ' we received an SMS
' hanle other cases here
End Select
End If
Loop ' for ever
'subroutine that is called when a sms is received
's hold the received string
'+CMTI: "SM",5
Sub Showsms(s As String )
#if Uselcd = 1
Cls
#endif
I = Instr(s , "," ' find comma
I = I + 1
Stemp = Mid(s , I) ' s now holds the index number
#if Uselcd = 1
Lcd "get " ; Stemp
Waitms 1000 'time to read the lcd
#endif
Print "AT+CMGR=" ; Stemp ' get the message
Getline S ' header +CMGR: "REC READ","+98xxxxxxxxxx",,"02/04/05,0149+00"
#if Uselcd = 1
Lowerline
Lcd S
#endif
Do
Getline S ' get data from buffer
Select Case S
Case "PORT" : 'when you send PORT as sms text, this will be executed
#if Uselcd = 1
Cls : Lcd "do something!"
#endif
Case "OK" : Exit Do ' end of message
Case Else
End Select
Loop
#if Uselcd = 1
Home Lower : Lcd "remove sms"
#endif
Print "AT+CMGD=" ; Stemp ' delete the message
Getline S ' get OK
#if Uselcd = 1
Lcd S
#endif
End Sub
'get line of data from buffer
Sub Getline(s As String)
S = ""
Do
B = Inkey()
Select Case B
Case 0 'nothing
Case 13 ' we do not need this one
Case 10 : If S <> "" Then Exit Do ' if we have received something
Case Else
S = S + Chr(b) ' build string
End Select
Loop
End Sub
'flush input buffer
Sub Flushbuf()
Waitms 100 'give some time to get data if it is there
Do
B = Inkey() ' flush buffer
Loop Until B = 0
End Sub
دیدگاه