Skip to content

Instantly share code, notes, and snippets.

@Khobalt
Created May 10, 2017 19:20
Show Gist options
  • Save Khobalt/68c324ed671ea4fe56a2f89c1b6659a1 to your computer and use it in GitHub Desktop.
Save Khobalt/68c324ed671ea4fe56a2f89c1b6659a1 to your computer and use it in GitHub Desktop.
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
currentConfig = nc.GetCurrentConfig()
if type(currentConfig) = "roAssociativeArray" then
if currentConfig.ip4_address <> "" then
networkAvailable = true
endif
endif
endif
nc = invalid
'Check wifi
nc = CreateObject("roNetworkConfiguration", 1)
if type(nc) = "roNetworkConfiguration" then
currentConfig = nc.GetCurrentConfig()
if type(currentConfig) = "roAssociativeArray" then
if currentConfig.ip4_address <> "" then
networkAvailable = true
endif
endif
endif
mp = createObject("roMessagePort")
hotPlug = createObject("roNetworkHotplug")
hotPlug.setPort(mp)
while true
if networkAvailable = true then
loadApplication()
endif
event = wait(0, mp)
if type(event) = "roNetworkAttached"
networkAvailable = true
elseif type(event) = "roNetworkDetached"
networkAvailable = false
endif
endwhile
End Sub
Sub loadAppliction()
'Your loading code here
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment