...
Below are sample autorun.brs and autozip.brs files for reference.
Sample autorun.brs
Expand |
---|
title | This autorun.brs file instructs the player to display a local HTML file, specifically, index.html: |
---|
|
Code Block |
---|
Sub Main()
'Create the BrightSign event handler.
msgPort = CreateObject("roMessagePort")
'Define the screen viewing area.
r = CreateObject("roRectangle", 0, 0, 1920, 1080)
'Set the URL where the presentation resides. This can be either local or external.
config = {
url: "file:///index.html",
}
'Create an HTML event since our presentation is an HTML file.
h = CreateObject("roHtmlWidget", r, config)
h.SetPort(msgPort)
sleep(10000)
h.Show()
'Event loop to ensure that the script runs indefinitely
while true
msg = wait(0, msgPort)
print "type(msg)=";type(msg)
if type(msg) = "roHtmlWidgetEvent" then
eventData = msg.GetData()
if type(eventData) = "roAssociativeArray" and type(eventData.reason) = "roString" then
print "reason = ";eventData.reason
if eventData.reason = "load-error" then
print "message = ";eventData.message
endif
endif
endif
end while
End Sub |
|
Sample autozip.brs
Expand |
---|
title | This autozip.brs file instructs the player to unzip the autorun.zip file: |
---|
|
Code Block |
---|
'name file autorun.zip
' Content update application
Sub Main()
path$= FindDestPath()
source$= FindSourcePath()
package = CreateObject("roBrightPackage", source$+"autorun.zip")
package.SetPassword("test")
package.Unpack(path$)
package = 0
CreateDirectory(path$+"brightsign-dumps")
CreateDirectory(path$+"pool")
CreateDirectory(path$+"feed_cache")
CreateDirectory(path$+"feedPool")
DeleteFile(path$+"autozip.brs")
DeleteFile(source$+"autorun.zip")
a=RebootSystem()
End Sub
Function FindDestPath()
if not IsFirmwareValid() then
return "SD:/"
end if
destinationPaths = ["SSD:", "SD:", "USB1:"]
for each destination in destinationPaths
if IsMounted(destination) then
return destination+"/"
end if
next
return "unknown"
End Function
Function FindSourcePath()
if not IsFirmwareValid() then
return "SD:/"
end if
sourcePaths = ["USB1:", "SD:", "SSD:"]
for each source in sourcePaths
if IsMounted(source) and CheckFile(source+"/autorun.zip") then
return source+"/"
end if
next
return "unknown"
End Function
Function IsMounted(path as String)
if CreateObject("roStorageHotplug").GetStorageStatus(path).mounted then
return true
end if
return false
End Function
Function IsFirmwareValid()
di = CreateObject("roDeviceInfo")
return di.FirmwareIsAtLeast("7.0.60")
End Function
Function CheckFile(path as String)
file = CreateObject("roReadFile", path)
if type(file) = "roReadFile" then
return true
end if
return false
End Function |
|
...