Personal tools
The Open Lighting Project has moved!

We've launched our new site at www.openlighting.org. This wiki will remain and be updated with more technical information.

Difference between revisions of "OLA Python API"

From wiki.openlighting.org

Jump to: navigation, search
Line 1: Line 1:
document this [simonn]
+
== Building the Python Bindings ==
  
 +
See [[Building LLA]]  but run ''./configure --enable-python-libs''
  
 +
== Interesting Classes ==
 +
 +
; LlaClient
 +
: the main connection class
 +
; dmxBuffer
 +
: represents a list of DMX channel values
 +
; LlaClientObserver
 +
: base class to handle events
 +
; LlaPlugin
 +
: represents a Plugin
 +
; LlaDevice
 +
: represents a Device
 +
 +
== Sending DMX ==
 
A simple example to send DMX:
 
A simple example to send DMX:
  
 
<pre>
 
<pre>
 
from lla import *
 
from lla import *
 +
import sys
  
 
con = LlaClient()
 
con = LlaClient()
con.start()
+
if con.start():
 +
  sys.exit()
 +
 
 
universe = 0
 
universe = 0
  
 +
# create a dmxBuffer for the channel values
 +
DMX_LEN = 512
 
dmx = dmxBuffer(DMX_LEN)
 
dmx = dmxBuffer(DMX_LEN)
 
for i in range(0, DMX_LEN):
 
for i in range(0, DMX_LEN):
Line 16: Line 36:
  
 
con.send_dmx(universe, dmx, DMX_LEN)
 
con.send_dmx(universe, dmx, DMX_LEN)
 +
</pre>
 +
 +
== Receiving DMX ==
 +
 +
Receiving is slightly harder, we need to setup an Observer object to handle the events:
 +
 +
<pre>
 +
from lla import *
 +
import sys
 +
 +
 
</pre>
 
</pre>

Revision as of 09:45, 13 October 2007

Building the Python Bindings

See Building LLA but run ./configure --enable-python-libs

Interesting Classes

LlaClient
the main connection class
dmxBuffer
represents a list of DMX channel values
LlaClientObserver
base class to handle events
LlaPlugin
represents a Plugin
LlaDevice
represents a Device

Sending DMX

A simple example to send DMX:

from lla import *
import sys

con = LlaClient()
if con.start():
  sys.exit()

universe = 0

# create a dmxBuffer for the channel values
DMX_LEN = 512
dmx = dmxBuffer(DMX_LEN)
for i in range(0, DMX_LEN):
  dmx[i] = i

con.send_dmx(universe, dmx, DMX_LEN)

Receiving DMX

Receiving is slightly harder, we need to setup an Observer object to handle the events:

from lla import *
import sys