HMS

Home Media Server for Roku Players
git clone https://www.brianlane.com/git/HMS
Log | Files | Refs | README | LICENSE

KeystoreTask.brs (1084B)


      1 '********************************************************************
      2 '**  Home Media Server Application - KeystoreTask
      3 '**  Copyright (c) 2022 Brian C. Lane All Rights Reserved.
      4 '********************************************************************
      5 sub Init()
      6     print "KeystoreTask->Init()"
      7 
      8     m.top.functionName = "ExecuteCommand"
      9 end sub
     10 
     11 ' ExecuteCommand is executed when  m.keystoreTask.control = "run" from MainScene
     12 ' This needs to be reset along with UNObserveField("done") to prevent accidental re-triggering
     13 sub ExecuteCommand()
     14     print "KeystoreTask->ExecuteCommand()"
     15     print "Server url = "; m.top.serverurl
     16     print "command = "; m.top.command
     17     print "key = "; m.top.key
     18     print "value = "; m.top.value
     19 
     20     if not m.top.has_keystore
     21         m.top.done = true
     22         return
     23     end if
     24 
     25     if m.top.command = "get"
     26         m.top.value = getKeyValue(m.top.serverurl, m.top.key)
     27         print "new value = "; m.top.value
     28     else if m.top.command = "set"
     29         setKeyValue(m.top.serverurl, m.top.key, m.top.value)
     30     end if
     31 
     32     m.top.done = true
     33 end sub