- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Is there a way to execute a function every few secs
Hello,
I have changed background image in .brs file in task node folder but it is not updated.
I need to change the background image in .brs file in task node folder. Please provide me the information.
I have set the Background image like this
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Re: Is there a way to execute a function every few secs
Hello,
API call triggered in the timer but not going to the next actions.
When I set the timer to m.top.deactivate = true then only the next actions are working.
I need to call the api in timer for every 5 sec.
Based on the API response I have to stop the timer and navigating to another screen.
Xml file:
<?xml version="1.0" encoding="UTF-8"?> <component name="PollUrlTask" extends="Task"> <interface> <field id="url" type="string" /> <field id="intervalSecs" type="integer" value="5" /> <field id="deactivate" type="boolean" /> <!-- watch this --> <field id="result" type="string" /> </interface> <script type="text/brightscript" uri="PollUrlTask.brs" /> </component>
PollUrlTask.brs :
function fetch1(url as string) as string
req = CreateObject("roUrlTransfer")
port = CreateObject("roMessagePort")
req.SetMessagePort(port)
req.setRequest("POST")
req.SetUrl(url)
if (left(url, 5) = "https") then req.SetCertificatesFile("common:/certs/ca-bundle.crt")
result = req.AsyncGetToString()
if result then
while true
msg = wait(0, port)
json = ParseJson(msg)
print "json.result.devicestatus" json.statusCode
if json.statusCode = 200
m.global.userToken = json.result.token
print "userToken11111111" m.global.userToken
if m.global.userToken <> invalid
m.top.deactivate = true
end if
else if json.statusCode = 401
activation()
end if
if type(msg) = "roUrlEvent" then
code = msg.GetResponseCode()
if code = 200 then
return msg.GetString()
else
return ""
end if
else
result.AsyncCancel()
return ""
end if
end while
end if
return ""
end function
- « Previous
-
- 1
- 2
- Next »