Switch to desktop version  
Status query and Reset by SMS (Flexy 201) - Printable Version

+- Ewon Technical Forum (https://techforum.ewon.biz)
+-- Forum: Development (https://techforum.ewon.biz/forum-50.html)
+--- Forum: BASIC Script (https://techforum.ewon.biz/forum-52.html)
+--- Thread: Status query and Reset by SMS (Flexy 201) (/thread-411.html)



Status query and Reset by SMS (Flexy 201) - musfiq - 05-10-2017

Hi All,

Just to share with you guys. The following script for resetting, tag status query and controlling digital output via SMS works. Can try if want to do so.

ONSMS "Goto Program"
Program:
a% = Getsys Prg,"SmsRead"
If (a%<>0) Then
   a$ = Getsys Prg,"smsfrom"
   b$ = Getsys Prg,"smsmsg"
   c$ = "Reset"
   d$ = "1"
   e$ = "0"
   If (b$ = c$) Then 
   Goto Reset
   Endif
   If (b$ = d$) Then
   Endif
   Goto Control24V
   If (b$ = e$) Then
   Goto Control24V
   Else 
   Goto Alarm
   Endif
Reset:
   n$ = a$+",gsm,0"
   Setsys Prg,"MDMRST",1
   p$ = "Modem Reset Done"
   Sendsms n$, p$
Control24V:
   n$ = a$+",gsm,0"
   If (b$ = d$) Then
   DigitalOutput@ = Val (d$)
   SETIO "DigitalOutput", Val (d$)
   q$ = "Digital Output Value: " +d$
   Sendsms n$, q$
   Endif
   If (b$ = e$) Then
   DigitalOutput@ = Val (e$)
   SETIO "DigitalOutput", Val (e$)
   r$ = "Digital Output Value: " +e$
   Sendsms n$, r$
   Endif
Alarm:
   b% = Alstat b$
   n$ = a$+",gsm,0"
   If (b% = 0) Then
   i$ = "No Alarm for this tag"
   Sendsms n$,i$
   Endif
   If (b% = 1) Then
   j$ = "No Active Alarm"
   Sendsms n$,j$
   Endif
   If (b% = 2) Then
   k$ = "In Alarm"
   Sendsms n$,k$
   Endif
   If (b% = 3) Then
   l$ = "In Alarm but Acknoledged"
   Sendsms n$,l$
   Endif
   If (b% = 4) Then
   m$ = "Return to Normal but not Acknoledged"
   Sendsms n$,m$
   Endif
Endif
End

Thanks Mr. Simon for his help in this regard

Regards

Musfiq


RE: Status query and Reset by SMS (Flexy 201) - Lucaspin_ - 24-01-2022

Hi! I want to know how do you know when the modem reset it´s done successfully or not.
(05-10-2017, 06:35 AM)musfiq Wrote: Hi All,

Just to share with you guys. The following script for resetting, tag status query and controlling digital output via SMS works. Can try if want to do so.

ONSMS "Goto Program"
Program:
a% = Getsys Prg,"SmsRead"
If (a%<>0) Then
   a$ = Getsys Prg,"smsfrom"
   b$ = Getsys Prg,"smsmsg"
   c$ = "Reset"
   d$ = "1"
   e$ = "0"
   If (b$ = c$) Then 
   Goto Reset
   Endif
   If (b$ = d$) Then
   Endif
   Goto Control24V
   If (b$ = e$) Then
   Goto Control24V
   Else 
   Goto Alarm
   Endif
Reset:
   n$ = a$+",gsm,0"
   Setsys Prg,"MDMRST",1
   p$ = "Modem Reset Done"
   Sendsms n$, p$
Control24V:
   n$ = a$+",gsm,0"
   If (b$ = d$) Then
   DigitalOutput@ = Val (d$)
   SETIO "DigitalOutput", Val (d$)
   q$ = "Digital Output Value: " +d$
   Sendsms n$, q$
   Endif
   If (b$ = e$) Then
   DigitalOutput@ = Val (e$)
   SETIO "DigitalOutput", Val (e$)
   r$ = "Digital Output Value: " +e$
   Sendsms n$, r$
   Endif
Alarm:
   b% = Alstat b$
   n$ = a$+",gsm,0"
   If (b% = 0) Then
   i$ = "No Alarm for this tag"
   Sendsms n$,i$
   Endif
   If (b% = 1) Then
   j$ = "No Active Alarm"
   Sendsms n$,j$
   Endif
   If (b% = 2) Then
   k$ = "In Alarm"
   Sendsms n$,k$
   Endif
   If (b% = 3) Then
   l$ = "In Alarm but Acknoledged"
   Sendsms n$,l$
   Endif
   If (b% = 4) Then
   m$ = "Return to Normal but not Acknoledged"
   Sendsms n$,m$
   Endif
Endif
End

Thanks Mr. Simon for his help in this regard

Regards

Musfiq



RE: Status query and Reset by SMS (Flexy 201) - simon - 28-01-2022

Excellent Job!!!

Really appreciate you share that on the forum !! :-)