Run the test code again wit...
David Blume authored 5 years ago
|
1) sub init()
2) m.top.functionName = "executeTest"
|
Add test support for DIAL;...
David Blume authored 5 years ago
|
3) m.top.ObserveField("pucidHash", "onUpdatePucidHash")
|
Run the test code again wit...
David Blume authored 5 years ago
|
4) end sub
5)
|
Add test support for DIAL;...
David Blume authored 5 years ago
|
6)
7) function GetRequest() as object
8) r = CreateObject("roUrlTransfer")
9) r.InitClientCertificates()
|
Add a certificates file to...
David Blume authored 5 years ago
|
10) r.SetCertificatesFile("pkg:/certificates/rokuca.pem")
11) ' r.SetCertificatesFile("common:/certs/ca-bundle.crt")
|
Add test support for DIAL;...
David Blume authored 5 years ago
|
12)
13) r.SetUrl("https://api.roku.com/registrysvc/api/" + CreateObject("roAppInfo").GetDevID())
14) r.AddHeader("accept", "application/json")
15) r.AddHeader("content-type", "application/*")
16) r.AddHeader("x-roku-registry-aes-key-version", "v1")
17) r.AddHeader("x-roku-reserved-regsvc-token", "")
18)
19) ' Note if called from init(), then m.top.pucidHash won't have been set yet.
20) r.AddHeader("x-roku-registry-aes-encryption-key", m.top.pucidHash)
21)
22) print "GetRequest() x-roku-registry-aes-encryption-key:" + m.top.pucidHash
23) print " URL:" + r.GetUrl()
24) return r
25) end function
26)
27)
28) function onUpdatePucidHash() as void
29) ' Maybe do something with m.top.pucidHash
30) end function
31)
32)
|
Run the test code again wit...
David Blume authored 5 years ago
|
33) function executeTest() as void
34) ' This task gets run one at the start, and then
35) ' again every time the OK button is pressed.
36)
37) deviceInfo = CreateObject("roDeviceInfo")
38) aaConnectionInfo = deviceInfo.GetConnectionInfo()
39) for each key in aaConnectionInfo
40) val = aaConnectionInfo[key]
41) m.top.updateText = key + " = " + val.ToStr()
42) end for
43)
|
Add test support for DIAL;...
David Blume authored 5 years ago
|
44) request = GetRequest()
45) port = CreateObject("roMessagePort")
46) request.SetMessagePort(port)
47)
|
Add some invariant info to...
David Blume authored 5 years ago
|
48) requestBody = { "token": "auth" }
49) res = request.AsyncPostFromString(FormatJson(requestBody))
|
Add test support for DIAL;...
David Blume authored 5 years ago
|
50) if res = true
51) msg = wait(0, port)
52) if type(msg) = "roUrlEvent"
53) if msg.GetInt() = 1
54) m.top.updateText = "PSI Request roUrlEvent = " + msg.GetResponseCode().ToStr()
55) end if
56) ' else if msg = invalid
57) ' request.AsyncCancel()
58) end if
59) else
60) m.top.updateText = "AsyncPostFromString failed"
61) end if
|