Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- REM Created: 2011-07-14
- REM Revision: 2011-07-14
- CLS
- REM CONSTANTS
- REM ---------
- N% = GETSYS PRG, "NBTAGS" REM total number of tags
- S$ = GETSYS PRG, "SERNUM" REM eWON's serial number
- REM Apply ONCHANGE even handler TO all defined tags.
- FOR i% = 1 TO N%
- ONCHANGE i%, "x% = " + STR$ i% + " GOTO onchange_handler"
- NEXT i%
- REM ONCHANGE EVENT HANDLER
- REM ----------------------
- REM Similar, possibly more elegant solution would be with use of TCP stream (see OPEN).
- onchange_handler:
- PRINT STR$ x%
- f$ = ""
- c% = 0
- REM Iterate through the tags...
- FOR i% = 1 TO N%
- REM ...but update only those that changed.
- IF IOMOD i% THEN
- c% = c% + 1
- f$ = f$ + "&" + STR$ i% + "=" + STR$ GETIO i%
- ENDIF
- NEXT i%
- IF (c% > 0) THEN
- REM IF there are ANY changed tags, send them, together with the unit's serial
- REM number AND current time TO a provided location via HTTP.
- p$ = "/tags?sn=" + S$ + "&ts=" + HEX$ GETSYS PRG, "TIMESEC"
- GETHTTP "db.fsintegratedsystems.co.uk", "", p$ + f$
- ENDIF
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement