def initServer(self): """ Initialize DC Box server Initializes dictionary (dcDict) of relevant device data Initializes queue (queue) for commands to send Initializes serial connection Frees connection for writing @raise SerialDeviceError: (For subclass author) Define regKey and serNode attributes """ self.createDict() self.queue = [] if not self.regKey or not self.serNode: raise SerialDeviceError( 'Must define regKey and serNode attributes') port = yield self.getPortFromReg(self.regKey) self.port = port try: serStr = yield self.findSerial(self.serNode) self.initSerial(serStr, port) except SerialConnectionError, e: self.ser = None if e.code == 0: print 'Could not find serial server for node: %s' % self.serNode print 'Please start correct serial server' elif e.code == 1: print 'Error opening serial connection' print 'Check set up and restart serial server' else: raise
def initServer(self): """ Initialize CCTDACServer """ yield self.createInfo() # Populate list of Channels self.queue = [] if not self.regKey or not self.serNode: raise SerialDeviceError( 'Must define regKey and serNode attributes') #port = yield self.getPortFromReg( self.regKey ) port = '/dev/ttyUSB0' self.port = port try: print self.serNode serStr = yield self.findSerial(self.serNode) #self.initSerial( serStr, port, baudrate=56000 ) self.initSerial(serStr, port) except SerialConnectionError, e: print "SERIAL CONNECTION ERROR" self.ser = None if e.code == 0: print 'Could not find serial server for node: %s' % self.serNode print 'Please start correct serial server' elif e.code == 1: print 'Error opening serial connection' print 'Check set up and restart serial server' else: raise
def initServer(self): """ Initialize laserDACServer """ self.createInfo() self.queue = [] if not self.regKey or not self.serNode: raise SerialDeviceError( 'Must define regKey and serNode attributes') port = yield self.getPortFromReg(self.regKey) self.port = port try: print self.serNode serStr = yield self.findSerial(self.serNode) self.initSerial(serStr, port) except SerialConnectionError, e: self.ser = None if e.code == 0: print 'Could not find serial server for node: %s' % self.serNode print 'Please start correct serial server' elif e.code == 1: print 'Error opening serial connection' print 'Check set up and restart serial server' else: raise
def checkQueue(self): """ When timer expires, check for voltage to write """ if self.toWrite: try: self.writeToSerial(self.toWrite) self.toWrite = None except: raise SerialDeviceError('Problem with serial connection') else: self.free = True
def initServer(self): self.createChannelInfo() if not self.regKey or not self.serNode: raise SerialDeviceError( 'Must define regKey and serNode attributes') port = yield self.getPortFromReg(self.regKey) self.port = port try: serStr = yield self.findSerial(self.serNode) self.initSerial(serStr, port, baudrate=BAUDRATE) except SerialConnectionError, e: self.ser = None if e.code == 0: print 'Could not find serial server for node: %s' % self.serNode print 'Please start correct serial server' elif e.code == 1: print 'Error opening serial connection' print 'Check set up and restart serial server' else: raise