Skip to content

Instantly share code, notes, and snippets.

@Khobalt
Khobalt / validatePool.brs
Last active May 16, 2017 21:36
This gist demonstrates how to validate the files in a pool against their sha1 hashes.
REM read more about assetPools here: http://docs.brightsign.biz/display/DOC/roAssetPool
REM read more about syncspecs here: http://docs.brightsign.biz/display/DOC/roSyncSpec
REM Sha1's should be calculated on the server and placed into an entry of the sync spec like so:
REM <download>
REM <name>autoplay-Project 1.xml</name>
REM <hash method="SHA1">a8e24dcfb83a694da58bafb3ab763c07ca842baf</hash>
REM <size>7962</size>
REM <link>pool/a/f/sha1-a8e24dcfb83a694da58bafb3ab763c07ca842baf</link>
REM </download>
@Khobalt
Khobalt / validatePool.brs
Created May 12, 2017 21:51
This gist demonstrates how to validate the files in a pool against their sha1 hashes.
CreateObject("roAssetPool", pool_path As String)
pool = CreateObject ("roAssetPool", "SD:/pool")
sync_spec = createObject("roSyncSpec")
sync_spec.readFromFile("path/to/sync.xml")
if pool.validate(sync_spec) then
print "Files match their sha1's"
else
print "Failure validating files"
print pool.getFailureReason()
@Khobalt
Khobalt / validatePool.brs
Created May 12, 2017 21:51
This gist demonstrates how to validate the files in a pool against their sha1 hashes.
CreateObject("roAssetPool", pool_path As String)
pool = CreateObject ("roAssetPool", "SD:/pool")
sync_spec = createObject("roSyncSpec")
sync_spec.readFromFile("path/to/sync.xml")
if pool.validate(sync_spec) then
print "Files match their sha1's"
else
print "Failure validating files"
print pool.getFailureReason()
@Khobalt
Khobalt / roAssetRealizer.brs
Created May 12, 2017 21:39
This gist demonstrates how to safely move a firmware update file to the root of the card from the pool
msqPort = createObject("roMessagePort")
'Defer the watchdog because the system may be tied up for a little while as the transfer commences
msgPort.DeferWatchdog(120)
newSync = createObject("roSyncSpec")
newSync.readFromFile("path/to/newSyncSpec.xml")
assetCollection = newSync.GetAssets("download")
path$ ="/fwUpdate/path/to/pool"
@Khobalt
Khobalt / networkdetect.brs
Created May 10, 2017 19:20
This gist demonstrates how to detect a network connection on a BrightSign, and only load the application if the network is available
REM
REM
REM This code demonstrates how to detect a network configuration.
REM Read more: http://docs.brightsign.biz/display/DOC/roNetworkHotplug
REM
Sub Main()
networkAvailable = false
'Check ethernet
nc = CreateObject("roNetworkConfiguration", 0)
if type(nc) = "roNetworkConfiguration" then