Forum Discussion
RobSMS
10 years agoVisitor
This worked for me...
Setup a roSystemLog event in the main thread that pushes .bandwidth to the global var. Then just use an observeField on the global var that pushes the data to the Render node.
So for example....
Then in your scenegraph init...
Setup a roSystemLog event in the main thread that pushes .bandwidth to the global var. Then just use an observeField on the global var that pushes the data to the Render node.
So for example....
Sub RunUserInterface(args As Object)
screen = CreateObject("roSGScreen")
scene = screen.CreateScene("HomeScene")
port = CreateObject("roMessagePort")
m.global = screen.getGlobalNode()
m.global.addFields( { bandwidthMetric: 0 } )
syslog = CreateObject("roSystemLog")
syslog.SetMessagePort(port)
syslog.EnableType("bandwidth.minute")
while true
msg = wait(0,port)
if type(msg) = "roSystemLogEvent" then
i = msg.GetInfo()
if i.LogType = "bandwidth.minute" then
m.global.bandwidth = i.bandwidth
end if
end if
end while
End Sub
Then in your scenegraph init...
Function Init()
m.global.ObserveField("bandwidth", "PushToScreen")
End Function
Sub PushToScreen()
m.bandwidth = m.top.findNode("Bandwidth")
m.bandwidth.text = "Bandwidth: " + m.global.bandwidth.toStr()
End Sub