FORUMS PROFESSIONNELS
WINDEV
,
WEBDEV
et
WINDEV Mobile
Accueil
|
Messages récents
|
Connexion
|
Déconnexion
|
Français
Accueil
→
WINDEV Mobile 2024
→
[WM]Loop and a timer
[WM]Loop and a timer
Débuté par Jim, 07 juin 2018 18:54 - 2 réponses
Connectez-vous…
Jim
#1
Posté le 07 juin 2018 - 18:54
I have an app that sends an sms to get status from a device.
It works great when the text comes back from the device.
But, if the device is off or doesn't respond, I would like it to time out.
I cannot find a way to do that.
The LOOP seems to lock down and nothing else operates while the LOOP is in a loop.
I have tried simple automated procedures, using the clock, etc.
Nothing has worked. Is there a way to check for a new incoming message without a LOOP?
nNummmessages is int = SMSNbMessage(smsMemory)
rslt is boolean = SMSSend()
IF rslt = True THEN
LOOP
x = SMSNbMessage(smsMemory)
IF x <> nNummmessages THEN BREAK
END
END
Thanks
Jim
Signaler
0
0
Fabrice Harari
#2
Posté le 07 juin 2018 - 22:30
Hi Jim,
one way of doing that is to add a test on elapsed time inside your loop
and do a break if more than x seconds has elapsed
Another way is to use a timer instead of a loop to check every x 1/100
of a second if a new sms arrived and to count the number of times you
enter the timer. If N times is reached to stop the timer
Best regards
--
Fabrice Harari
International WinDev, WebDev and WinDev mobile Consulting
Free Video Courses, free WXShowroom.com, open source WXReplication, open
source WXEDM.
More information on
http://www.fabriceharari.com
On 6/7/2018 10:54 AM, Jim wrote:
I have an app that sends an sms to get status from a device.
It works great when the text comes back from the device.
But, if the device is off or doesn't respond, I would like it to time out.
I cannot find a way to do that. The LOOP seems to lock down and nothing
else operates while the LOOP is in a loop.
I have tried simple automated procedures, using the clock, etc. Nothing
has worked. Is there a way to check for a new incoming message without
a LOOP?
nNummmessages is int = SMSNbMessage(smsMemory)
rslt is boolean = SMSSend()
IF rslt = True THEN
LOOP
x = SMSNbMessage(smsMemory)
IF x <> nNummmessages THEN BREAK
END
END
Thanks
Jim
Signaler
0
0
Jim
#3
Posté le 08 juin 2018 - 18:38
Fabrice,
Thanks, I tried option 2 and it is working.
I finally got my mind wrapped around these timers (automated procedures).
I had to have all my code in there, not back in the main thread.
Thanks again!
Jim
Signaler
0
0
→ Revenir à WINDEV Mobile 2024
WINDEV 2024
WEBDEV 2024
WINDEV Mobile 2024
WINDEV (précédentes versions)
Français
English
Español
Portuguesa
Fermer cette fenêtre
Type de recherche
Uniquement les sujets
Tous les messages
Période de recherche
Date indifférente
Moins d'une heure
Moins de 24 heures
Moins d'une semaine
Moins d'un mois
Moins d'un an
Annuler
Aperçu de votre message
Ajouter une image
Importer une image depuis une URL
Envoyer une image depuis un fichier de votre disque
Déposez ici un fichier ou cliquez sur "Parcourir..."
ou
Annuler
0%
WLangage
SQL
XML, HTML
JAVA, Javascript
Texte