474162c905e31045a8f5e7910a86c9abc21bb939
David Blume Migrate from SDK1 to SceneG...

David Blume authored 5 years ago

1) <?xml version="1.0" encoding="utf-8" ?>
2) 
3) <component name="TagTask" extends="Task">
4) 
5) <interface>
6)   <field id="updateText" type="string" value="Tagging from TagTask"/>
7) </interface>
8) <children>
9)   <Settings id="MySettings" />
10) </children>
11) 
12) <script type="text/brightscript" >
13) <![CDATA[
14) 
15) sub init()
16)     m.top.functionName = "executeTask"
17)     m.settings = m.top.findNode("MySettings")
18) end sub
19) 
David Blume Try to use the serial numbe...

David Blume authored 5 years ago

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
David Blume Add model number to key.

David Blume authored 5 years ago

26)         serialnums = root.GetNamedElements("serial-number")
27)         if serialnums.Count() > 0
28)             model = root.GetNamedElements("model-number")
29)             if model.Count() > 0
30)                 return serialnums[0].GetText() + ":" + model[0].GetText()
dblume Improve use of client ID an...

dblume authored 1 year ago

31)             end if
David Blume Try to use the serial numbe...

David Blume authored 5 years ago

32)         end if
33)     end if
34)     ' That did not work, so make a custom one.
dblume Improve use of client ID an...

dblume authored 1 year ago

35)     clientID = Right(deviceInfo.GetChannelClientId(), 8)
36)     return clientID + ":" + deviceInfo.GetModelDetails()["ModelNumber"]
David Blume Try to use the serial numbe...

David Blume authored 5 years ago

37) end function
38) 
David Blume Migrate from SDK1 to SceneG...

David Blume authored 5 years ago

39) function executeTask() as void
40)     m.port = CreateObject("roMessagePort")
41) 
42)     deviceInfo = CreateObject("roDeviceInfo")
43) 
David Blume Use GetChannelClientId

David Blume authored 5 years ago

44)     aaIPAddrs = deviceInfo.GetIPAddrs()
David Blume Migrate from SDK1 to SceneG...

David Blume authored 5 years ago

45)     for each key in aaIPAddrs
46)         ipAddr = aaipAddrs[key]
47)         if ipAddr <> invalid and ipAddr.Len() > 0
48)             ' m.top.updateText = key + " = " + ipAddr
49)         end if
50)     end for
51) 
David Blume Try to use the serial numbe...

David Blume authored 5 years ago

52)     sendRequest(ipAddr, getDeviceId(deviceInfo))