6.1-roStorageHotplug
ON THIS PAGE
This object provides roStorageAttached messages when storage devices appear and roStorageDetached messages when storage devices disappear. There is currently no way to poll for media.Â
Object Creation: The roStorageHotplug object is created with no parameters.
CreateObject("roStorageHotplug")
ifUserData
SetUserData(user_data As Object)
Sets the user data that will be returned when events are raised.
GetUserData() As Object
Returns the user data that has previously been set via SetUserData(). It will return Invalid if no data has been set.
ifMessagePort
SetPort(port As roMessagePort)
Posts messages of type roStorageAttached and roStorageDetached to the attached message port.
Â
Â
In order to avoid race conditions at startup, you should check for any storage devices that might have existed prior to the message port being set. We recommend doing this after the object is created and the message port is set, but before instructing the script to wait for any events.
Sub Main() mp = CreateObject("roMessagePort") sh = CreateObject("roStorageHotplug") gpio = CreateObject("roControlPort", "brightsign") sh.SetPort(mp) gpio.SetPort(mp) finished = false while not finished ev = mp.WaitMessage(0) if type(ev) = "roControlDown" finished = true else if type(ev) = "roStorageAttached" print "ATTACHED "; ev.GetString() else if type(ev) = "roStorageDetached" print "DETACHED "; ev.GetString() else print type(ev) stop end if end while End SubÂ
Â
Â