David Blume commited on 2016-01-31 00:15:37
Showing 1 changed files, with 20 additions and 8 deletions.
| ... | ... |
@@ -24,19 +24,22 @@ sub showScreen(contentID As String, options As String) |
| 24 | 24 |
deviceID = deviceInfo.GetDeviceUniqueId() |
| 25 | 25 |
aaIPAddrs = deviceInfo.GetIPAddrs() |
| 26 | 26 |
|
| 27 |
- screen.addParagraph("IP Tagger")
|
|
| 28 |
- screen.addParagraph("deviceID = " + deviceID)
|
|
| 27 |
+ screen.SetTitle("IP Tagger")
|
|
| 29 | 28 |
for each key in aaIPAddrs |
| 30 |
- ipAddr = ipAddrs[key] |
|
| 29 |
+ ipAddr = aaipAddrs[key] |
|
| 31 | 30 |
if ipAddr <> invalid and ipAddr.Len() > 0 |
| 32 | 31 |
screen.addParagraph("IP " + key + "=" + ipAddr)
|
| 33 |
- ' screen.addParagraph("IPs = " + aaIPAddrs)
|
|
| 32 |
+ end if |
|
| 33 |
+ end for |
|
| 34 | 34 |
|
| 35 | 35 |
request = CreateObject("roUrlTransfer")
|
| 36 |
- request.SetUrl("https://kvs.dlma.com")
|
|
| 37 |
- code = request.PostFromString(deviceID+"="+ipAddr+"&auth=ahov") |
|
| 38 |
- screen.addParagraph("POST code = " + code)
|
|
| 39 |
- |
|
| 36 |
+ request.SetPort(port) |
|
| 37 |
+ request.SetUrl("http://kvs.dlma.com/")
|
|
| 38 |
+ params = deviceID+"="+ipAddr+"&auth=ahov" |
|
| 39 |
+ screen.addParagraph("Tagging "+ipAddr+" for "+deviceID+"...")
|
|
| 40 |
+ if request.AsyncPostFromString(params) |
|
| 41 |
+ print "Post was sent!" |
|
| 42 |
+ endif |
|
| 40 | 43 |
screen.Show() |
| 41 | 44 |
|
| 42 | 45 |
while true |
| ... | ... |
@@ -45,6 +48,15 @@ sub showScreen(contentID As String, options As String) |
| 45 | 48 |
if msg.isScreenClosed() |
| 46 | 49 |
exit while |
| 47 | 50 |
end if |
| 51 |
+ else if type(msg) = "roUrlEvent" |
|
| 52 |
+ if msg.GetInt() = 1 |
|
| 53 |
+ if msg.GetResponseCode() = 200 |
|
| 54 |
+ screen.addParagraph("Success! You can get this device's IP address from the following URL:")
|
|
| 55 |
+ screen.addParagraph("http://kvs.dlma.com?k="+deviceID)
|
|
| 56 |
+ else |
|
| 57 |
+ screen.addParagraph("It didn't work. Got code " + msg.GetResponseCode())
|
|
| 58 |
+ endif |
|
| 59 |
+ endif |
|
| 48 | 60 |
end if |
| 49 | 61 |
end while |
| 50 | 62 |
screen.Close() ' Wonder if this is needed |
| 51 | 63 |