Advertisement
Guest User

Untitled

a guest
Sep 23rd, 2017
101
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
QBasic 1.02 KB | None | 0 0
  1. REM Created: 2011-07-14
  2. REM Revision: 2011-07-14
  3.  
  4. CLS
  5.  
  6. REM CONSTANTS
  7. REM ---------
  8. N% = GETSYS PRG, "NBTAGS" REM total number of tags
  9. S$ = GETSYS PRG, "SERNUM" REM eWON's serial number
  10.  
  11. REM Apply ONCHANGE even handler TO all defined tags.
  12. FOR i% = 1 TO N%
  13.     ONCHANGE i%, "x% = " + STR$ i% + " GOTO onchange_handler"
  14. NEXT i%
  15.  
  16.  
  17.  
  18. REM ONCHANGE EVENT HANDLER
  19. REM ----------------------
  20. REM Similar, possibly more elegant solution would be with use of TCP stream (see OPEN).
  21. onchange_handler:
  22.     PRINT STR$ x%
  23.     f$ = ""
  24.     c% = 0
  25.    
  26.     REM Iterate through the tags...
  27.     FOR i% = 1 TO N%
  28.         REM ...but update only those that changed.
  29.         IF IOMOD i% THEN
  30.             c% = c% + 1
  31.             f$ = f$ + "&" + STR$ i% + "=" + STR$ GETIO i%
  32.         ENDIF
  33.     NEXT i%
  34.    
  35.     IF (c% > 0) THEN
  36.         REM IF there are ANY changed tags, send them, together with the unit's serial
  37.         REM number AND current time TO a provided location via HTTP.
  38.         p$ = "/tags?sn=" + S$ + "&ts=" + HEX$ GETSYS PRG, "TIMESEC"
  39.         GETHTTP "db.fsintegratedsystems.co.uk", "", p$ + f$
  40.     ENDIF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement