Situation Scripting Beispiel Fragen




             Simulation von Ger¨ten
                               a
Oder: Wie binde ich IP-Ger¨te in digitalSTROM ein
                          a


                          Patrick St¨hlin
                                    a

                             futureLAB AG


                              27.01.2011
Situation Scripting Beispiel Fragen

Situation




     Viele Ger¨te wurden in den letzten Jahren IP f¨hig
              a                                    a
     digitalSTROM in Version 1.0 nur mit Licht
     Der digitalSTROM Server (dSS) ist erweiterbar
Situation Scripting Beispiel Fragen

Situation




     Viele Ger¨te wurden in den letzten Jahren IP f¨hig
              a                                    a
     digitalSTROM in Version 1.0 nur mit Licht
     Der digitalSTROM Server (dSS) ist erweiterbar
Situation Scripting Beispiel Fragen

Situation




     Viele Ger¨te wurden in den letzten Jahren IP f¨hig
              a                                    a
     digitalSTROM in Version 1.0 nur mit Licht
     Der digitalSTROM Server (dSS) ist erweiterbar
Situation Scripting Beispiel Fragen

Situation




   Durch die Scriptbarkeit des dSS k¨ nnen nicht digitalSTROM
                                    o
            Ger¨te transparent eingebunden werden.
               a
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

JavaScript im dSS I




     SpiderMonkey JavaScript-Engine
     Aufgerufen durch
          Events
          Beim Start (Simulation)
          Details im Wiki [dT]
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

JavaScript im dSS II




  M¨ glichkeiten
   o
      Events
      Property-Tree
      TCP client/server
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Properties




     Baumstruktur
     Speicherbar
     Zugriff von aussen
          JSON
          SOAP
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Properties




     Baumstruktur
     Speicherbar
     Zugriff von aussen
          JSON
          SOAP
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Properties




     Baumstruktur
     Speicherbar
     Zugriff von aussen
          JSON
          SOAP
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Events




     Name
     Parameter
     Quelle
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Konstanten




     Scene.User1 . . . Scene.User4
     Scene.Bell
     usw. . .
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Simulations API




     callScene(sceneNumber)
     getConsumption
     get/setConfigParameter
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Simulation




     Bekannt machen in der Simulation: config.xml
     Instanzierung sim.xml
     Ansprechen
          JSON/SOAP
          digitalSTROM
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Simulation




     Bekannt machen in der Simulation: config.xml
     Instanzierung sim.xml
     Ansprechen
          JSON/SOAP
          digitalSTROM
Situation Scripting Beispiel Fragen   JS im Server Scripting API Sim-API

Simulation




     Bekannt machen in der Simulation: config.xml
     Instanzierung sim.xml
     Ansprechen
          JSON/SOAP
          digitalSTROM
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

Code




   function SimpleDevice () {
     this . callScene = function ( sceneNumber ) {
       print ( ’ SimpleDevice . callScene ’ , sceneNumber ) ;
     }
   }
   new SimpleDevice () ;
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

config.xml


      [...]
      < property name = " simple_device " >
         < property name = " script - file [0] " type = " string " >
            < value >../ jslib / dsid . js </ value >
         </ property >
         < property name = " script - file [1] " type = " string " >
            < value > some / where / simple_device . js </ value >
         </ property >
         < property name = " id " type = " string " >
            < value > example . simple_device </ value >
         </ property >
     </ property >
     [...]
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                           a

sim.xml



  <? xml version = " 1.0 " ? >
  < simulation version = " 1 " >
     < modulator busid = " 70 " dsid = " 10 " >
        < device dsid = " 4 " busid = " 4 " type = " example .
              simple_device " / >
        < zone id = " 1 " >
           < group id = " 1 " >
              < device busid = " 4 " / >
           </ group >
        </ zone >
     </ modulator >
  </ simulation >
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

VLC Player




     OpenSource Medienplayer
     Dokumentiertes, telnet basiertes Protokoll
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

VLC Player




     OpenSource Medienplayer
     Dokumentiertes, telnet basiertes Protokoll
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                       a

Kommandos




    Track: play, stop, prev, next
    Lautst¨rke: volup, voldown
          a
    Jeweils mit LF (n) terminiert
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

Medienger¨te in digitalSTROM
         a




     Volume: Scene.Inc/Scene.Dec
     On: Scene.Off - Scene.User1
     Next: Scene.User1 - Scene.User2 - Scene.User3 -
     Scene.User1
     Previous: Scene.User4 - Scene.User3 - Scene.User2 -
     Scene.User1
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

config.xml


      [...]
      < property name = " vlc_player " >
         < property name = " script - file [0] " type = " string " >
            < value >../ jslib / dsid . js </ value >
         </ property >
         < property name = " script - file [1] " type = " string " >
            < value >../ examples / plugins / js / vlc . js </ value >
         </ property >
         < property name = " id " type = " string " >
            < value > example . vlc_player </ value >
         </ property >
     </ property >
     [...]
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                           a

sim.xml



  <? xml version = " 1.0 " ? >
  < simulation version = " 1 " >
     < modulator busid = " 70 " dsid = " 10 " >
        < device dsid = " 4 " busid = " 4 " type = " example .
              vlc_player " / >
        < zone id = " 1 " >
           < group id = " 4 " >
              < device busid = " 4 " / >
           </ group >
        </ zone >
     </ modulator >
  </ simulation >
Situation Scripting Beispiel Fragen   Simples Ger¨t VLC Player
                                                        a

Testaufbau




     VLC mit rc-interface vlc -I rc
     --lua-config="rc=host=’localhost:4212’"
     dSS lokal installiert
Situation Scripting Beispiel Fragen

Fragen




                                        Fragen?
References

References I




     dSS Team.
     digitalstrom server wiki.
     http://developer.digitalstrom.org/redmine/
     projects/dss/wiki/.

digitalSTROM Developer Day 2011: digitalSTROM bindet auch externe Komponenten ein - zum Beispiel den VLC-Player

  • 1.
    Situation Scripting BeispielFragen Simulation von Ger¨ten a Oder: Wie binde ich IP-Ger¨te in digitalSTROM ein a Patrick St¨hlin a futureLAB AG 27.01.2011
  • 2.
    Situation Scripting BeispielFragen Situation Viele Ger¨te wurden in den letzten Jahren IP f¨hig a a digitalSTROM in Version 1.0 nur mit Licht Der digitalSTROM Server (dSS) ist erweiterbar
  • 3.
    Situation Scripting BeispielFragen Situation Viele Ger¨te wurden in den letzten Jahren IP f¨hig a a digitalSTROM in Version 1.0 nur mit Licht Der digitalSTROM Server (dSS) ist erweiterbar
  • 4.
    Situation Scripting BeispielFragen Situation Viele Ger¨te wurden in den letzten Jahren IP f¨hig a a digitalSTROM in Version 1.0 nur mit Licht Der digitalSTROM Server (dSS) ist erweiterbar
  • 5.
    Situation Scripting BeispielFragen Situation Durch die Scriptbarkeit des dSS k¨ nnen nicht digitalSTROM o Ger¨te transparent eingebunden werden. a
  • 6.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API JavaScript im dSS I SpiderMonkey JavaScript-Engine Aufgerufen durch Events Beim Start (Simulation) Details im Wiki [dT]
  • 7.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API JavaScript im dSS II M¨ glichkeiten o Events Property-Tree TCP client/server
  • 8.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Properties Baumstruktur Speicherbar Zugriff von aussen JSON SOAP
  • 9.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Properties Baumstruktur Speicherbar Zugriff von aussen JSON SOAP
  • 10.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Properties Baumstruktur Speicherbar Zugriff von aussen JSON SOAP
  • 11.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Events Name Parameter Quelle
  • 12.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Konstanten Scene.User1 . . . Scene.User4 Scene.Bell usw. . .
  • 13.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Simulations API callScene(sceneNumber) getConsumption get/setConfigParameter
  • 14.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Simulation Bekannt machen in der Simulation: config.xml Instanzierung sim.xml Ansprechen JSON/SOAP digitalSTROM
  • 15.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Simulation Bekannt machen in der Simulation: config.xml Instanzierung sim.xml Ansprechen JSON/SOAP digitalSTROM
  • 16.
    Situation Scripting BeispielFragen JS im Server Scripting API Sim-API Simulation Bekannt machen in der Simulation: config.xml Instanzierung sim.xml Ansprechen JSON/SOAP digitalSTROM
  • 17.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a Code function SimpleDevice () { this . callScene = function ( sceneNumber ) { print ( ’ SimpleDevice . callScene ’ , sceneNumber ) ; } } new SimpleDevice () ;
  • 18.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a config.xml [...] < property name = " simple_device " > < property name = " script - file [0] " type = " string " > < value >../ jslib / dsid . js </ value > </ property > < property name = " script - file [1] " type = " string " > < value > some / where / simple_device . js </ value > </ property > < property name = " id " type = " string " > < value > example . simple_device </ value > </ property > </ property > [...]
  • 19.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a sim.xml <? xml version = " 1.0 " ? > < simulation version = " 1 " > < modulator busid = " 70 " dsid = " 10 " > < device dsid = " 4 " busid = " 4 " type = " example . simple_device " / > < zone id = " 1 " > < group id = " 1 " > < device busid = " 4 " / > </ group > </ zone > </ modulator > </ simulation >
  • 20.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a VLC Player OpenSource Medienplayer Dokumentiertes, telnet basiertes Protokoll
  • 21.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a VLC Player OpenSource Medienplayer Dokumentiertes, telnet basiertes Protokoll
  • 22.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a Kommandos Track: play, stop, prev, next Lautst¨rke: volup, voldown a Jeweils mit LF (n) terminiert
  • 23.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a Medienger¨te in digitalSTROM a Volume: Scene.Inc/Scene.Dec On: Scene.Off - Scene.User1 Next: Scene.User1 - Scene.User2 - Scene.User3 - Scene.User1 Previous: Scene.User4 - Scene.User3 - Scene.User2 - Scene.User1
  • 24.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a config.xml [...] < property name = " vlc_player " > < property name = " script - file [0] " type = " string " > < value >../ jslib / dsid . js </ value > </ property > < property name = " script - file [1] " type = " string " > < value >../ examples / plugins / js / vlc . js </ value > </ property > < property name = " id " type = " string " > < value > example . vlc_player </ value > </ property > </ property > [...]
  • 25.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a sim.xml <? xml version = " 1.0 " ? > < simulation version = " 1 " > < modulator busid = " 70 " dsid = " 10 " > < device dsid = " 4 " busid = " 4 " type = " example . vlc_player " / > < zone id = " 1 " > < group id = " 4 " > < device busid = " 4 " / > </ group > </ zone > </ modulator > </ simulation >
  • 26.
    Situation Scripting BeispielFragen Simples Ger¨t VLC Player a Testaufbau VLC mit rc-interface vlc -I rc --lua-config="rc=host=’localhost:4212’" dSS lokal installiert
  • 27.
    Situation Scripting BeispielFragen Fragen Fragen?
  • 28.
    References References I dSS Team. digitalstrom server wiki. http://developer.digitalstrom.org/redmine/ projects/dss/wiki/.