Try to use the serial number again.
David Blume

David Blume commited on 2019-09-06 21:18:17
Showing 2 changed files, with 19 additions and 4 deletions.

... ...
@@ -17,12 +17,27 @@ sub init()
17 17
     m.settings = m.top.findNode("MySettings")
18 18
 end sub
19 19
 
20
+function getDeviceId(deviceInfo as object) as String
21
+    ' Try to get the Serial Number for an ECP call
22
+    request = CreateObject("roUrlTransfer")
23
+    request.SetUrl("http://localhost:8060/query/device-info")
24
+    root = CreateObject("roXMLElement")
25
+    if root.Parse(request.GetToString()) then
26
+        elements = root.GetNamedElements("serial-number")
27
+        if elements.Count() > 0
28
+            return elements[0].GetText()
29
+        end if
30
+    end if
31
+    ' That did not work, so make a custom one.
32
+    clientID = Right(deviceInfo.GetChannelClientId(), 6)
33
+    modelID = deviceInfo.GetModel()
34
+    return clientID + "-" + modelID
35
+end function
36
+
20 37
 function executeTask() as void
21 38
     m.port = CreateObject("roMessagePort")
22 39
 
23 40
     deviceInfo = CreateObject("roDeviceInfo")
24
-    clientID = Right(deviceInfo.GetChannelClientId(), 6)
25
-    modelID = deviceInfo.GetModel()
26 41
 
27 42
     aaIPAddrs = deviceInfo.GetIPAddrs()
28 43
     for each key in aaIPAddrs
... ...
@@ -32,7 +47,7 @@ function executeTask() as void
32 47
         end if
33 48
     end for
34 49
 
35
-    sendRequest(ipAddr, clientID + "-" + modelID)
50
+    sendRequest(ipAddr, getDeviceId(deviceInfo))
36 51
 end function
37 52
 
38 53
 sub sendRequest(ipAddr as String, deviceID as String)
... ...
@@ -1,7 +1,7 @@
1 1
 title=IP Tagger
2 2
 major_version=2
3 3
 minor_version=1
4
-build_version=1
4
+build_version=2
5 5
 mm_icon_focus_hd=pkg:/images/mm_icon_focus_hd.png
6 6
 mm_icon_focus_sd=pkg:/images/mm_icon_focus_sd.png
7 7
 splash_screen_hd=pkg:/images/splash_screen_hd.png
8 8