Changeset - cde2ae379be0
[Not reviewed]
default
0 1 0
drewp - 21 years ago 2004-06-16 13:01:53

added dummy mode, activated by env var DMXDUMMY=1
1 file changed with 6 insertions and 2 deletions:
0 comments (0 inline, 0 general)
light8/dmxserver.py
Show inline comments
 
@@ -16,50 +16,54 @@ clients shall connect to the xmlrpc serv
 
    values for the n first dmx channels.
 

	
 
server is port 8030; xmlrpc method is called outputlevels(pid,levellist).
 

	
 
todo:
 
  save dmx on quit and restore on restart
 
  if parport fails, run in dummy mode (and make an option for that too)
 
"""
 

	
 
from __future__ import division
 
from twisted.internet import reactor
 
from twisted.web import xmlrpc, server
 
import sys,time
 
import sys,time,os
 
from optparse import OptionParser
 
from io import ParportDMX
 
from updatefreq import Updatefreq
 

	
 
class XMLRPCServe(xmlrpc.XMLRPC):
 
    def __init__(self,options):
 

	
 
        xmlrpc.XMLRPC.__init__(self)
 
        
 
        self.clientlevels={} # clientID : list of levels
 
        self.lastseen={} # clientID : time last seen
 
        self.clientfreq={} # clientID : updatefreq
 
        
 
        self.combinedlevels=[] # list of levels, after max'ing the clients
 
        self.clientschanged=1 # have clients sent anything since the last send?
 
        self.options=options
 
        self.lastupdate=0 # time of last dmx send
 
        self.laststatsprint=0  # time
 

	
 
        # desired seconds between sendlevels() calls
 
        self.calldelay=1/options.updates_per_sec 
 

	
 
        print "starting parport connection"
 
        self.parportdmx=ParportDMX()
 
        self.parportdmx.golive()
 
        if os.environ.get('DMXDUMMY',0):
 
            self.parportdmx.godummy()
 
        else:
 
            self.parportdmx.golive()
 
            
 

	
 
        self.updatefreq=Updatefreq() # freq of actual dmx sends
 
        self.num_unshown_updates=None
 
        self.lastshownlevels=None
 
        # start the loop
 
        self.sendlevels()
 

	
 
        # the other loop
 
        self.purgeclients()
 
        
 
    def purgeclients(self):
 
        
0 comments (0 inline, 0 general)