class DripperSetupMixIn(object):
    '''This is a Mixin for the ConfigurationAPI and exists only for organizational purposes'''

    def get_dripper_drips_per_mm(self):
        '''Returns Drips Per mm'''

        return self._current_config.dripper.drips_per_mm

    def get_dripper_type(self):
        '''Returns the configured Dripper Type'''

        return self._current_config.dripper.dripper_type

    def get_dripper_emulated_drips_per_second(self):
        '''Gets the drips per second to be emulated'''

        return self._current_config.dripper.emulated_drips_per_second

    def get_dripper_photo_zaxis_delay(self):
        '''Gets the photo delay in seconds'''

        return self._current_config.dripper.photo_zaxis_delay

    def set_dripper_drips_per_mm(self, drips):
        '''Sets Drips Per mm'''

        self._current_config.dripper.drips_per_mm = drips
        if self._drip_detector:
            self._drip_detector.set_drips_per_mm(drips)
        self.save()

    def set_dripper_type(self, value):
        '''Sets the configured Dripper Type'''

        self._current_config.dripper.dripper_type = value
        self.save()

    def set_dripper_emulated_drips_per_second(self, value):
        '''Sets the drips per second to be emulated'''

        self._current_config.dripper.emulated_drips_per_second = value
        self.save()

    def set_dripper_photo_zaxis_delay(self, value):
        '''Sets the photo delay in seconds'''

        self._current_config.dripper.photo_zaxis_delay = value
        self.save()

    def reset_drips(self):
        '''Sets the drip count back to 0'''

        self._drip_detector.reset()

    def start_counting_drips(self, drip_call_back=None):
        '''Turns on the counting of drips. Stop must be called to end this.'''

        self.drip_call_back = drip_call_back
        if self._current_config.serial.on:
            self._commander = SerialCommander(self._current_config.serial.port)
        self._change_dripper()

    def _change_dripper(self):
        self._stop_current_dripper()
        if self._current_config.dripper.dripper_type == 'emulated':
            pass
        elif self._current_config.dripper.dripper_type == 'photo':
            pass
        elif self._current_config.dripper.dripper_type == 'microcontroller':
            self._communicator = UsbPacketCommunicator(self._current_config.circut.calibration_queue_length)
            self._communicator.start()
            self._drip_detector = SerialDripZAxis(self._communicator, 1, 0.0, drip_call_back=self.drip_call_back)

    def _stop_current_dripper(self):
        if self._communicator:
            self._communicator.close()
        if self._drip_detector:
            self._drip_detector.close()
            self._drip_detector = None

    def stop_counting_drips(self):
        '''Turns off the counting of drips if counting'''

        if self._commander:
            self._commander.close()
        self._stop_current_dripper()

    def send_dripper_on_command(self):
        '''If serial commuinication is enabled this send the turn on drips command'''

        if self._commander:
            self._commander.send_command(self._current_config.serial.on_command)
        else:
            raise Exception("Serial not Started")

    def send_dripper_off_command(self):
        '''If serial commuinication is enabled this send the turn off drips command'''

        if self._commander:
            self._commander.send_command(self._current_config.serial.off_command)
        else:
            raise Exception("Serial not Started")
Exemplo n.º 2
0
class DripperSetupMixIn(object):
    '''This is a Mixin for the ConfigurationAPI and exists only for organizational purposes'''
    def get_dripper_drips_per_mm(self):
        '''Returns Drips Per mm'''

        return self._current_config.dripper.drips_per_mm

    def get_dripper_type(self):
        '''Returns the configured Dripper Type'''

        return self._current_config.dripper.dripper_type

    def get_dripper_emulated_drips_per_second(self):
        '''Gets the drips per second to be emulated'''

        return self._current_config.dripper.emulated_drips_per_second

    def get_dripper_photo_zaxis_delay(self):
        '''Gets the photo delay in seconds'''

        return self._current_config.dripper.photo_zaxis_delay

    def set_dripper_drips_per_mm(self, drips):
        '''Sets Drips Per mm'''

        self._current_config.dripper.drips_per_mm = drips
        if self._drip_detector:
            self._drip_detector.set_drips_per_mm(drips)
        self.save()

    def set_dripper_type(self, value):
        '''Sets the configured Dripper Type'''

        self._current_config.dripper.dripper_type = value
        self.save()

    def set_dripper_emulated_drips_per_second(self, value):
        '''Sets the drips per second to be emulated'''

        self._current_config.dripper.emulated_drips_per_second = value
        self.save()

    def set_dripper_photo_zaxis_delay(self, value):
        '''Sets the photo delay in seconds'''

        self._current_config.dripper.photo_zaxis_delay = value
        self.save()

    def reset_drips(self):
        '''Sets the drip count back to 0'''

        self._drip_detector.reset()

    def start_counting_drips(self, drip_call_back=None):
        '''Turns on the counting of drips. Stop must be called to end this.'''

        self.drip_call_back = drip_call_back
        if self._current_config.serial.on:
            self._commander = SerialCommander(self._current_config.serial.port)
        self._change_dripper()

    def _change_dripper(self):
        self._stop_current_dripper()
        if self._current_config.dripper.dripper_type == 'emulated':
            pass
        elif self._current_config.dripper.dripper_type == 'photo':
            pass
        elif self._current_config.dripper.dripper_type == 'microcontroller':
            self._communicator = UsbPacketCommunicator(
                self._current_config.circut.calibration_queue_length)
            self._communicator.start()
            self._drip_detector = SerialDripZAxis(
                self._communicator, 1, 0.0, drip_call_back=self.drip_call_back)

    def _stop_current_dripper(self):
        if self._communicator:
            self._communicator.close()
        if self._drip_detector:
            self._drip_detector.close()
            self._drip_detector = None

    def stop_counting_drips(self):
        '''Turns off the counting of drips if counting'''

        if self._commander:
            self._commander.close()
        self._stop_current_dripper()

    def send_dripper_on_command(self):
        '''If serial commuinication is enabled this send the turn on drips command'''

        if self._commander:
            self._commander.send_command(
                self._current_config.serial.on_command)
        else:
            raise Exception("Serial not Started")

    def send_dripper_off_command(self):
        '''If serial commuinication is enabled this send the turn off drips command'''

        if self._commander:
            self._commander.send_command(
                self._current_config.serial.off_command)
        else:
            raise Exception("Serial not Started")
class DripperSetupMixIn(object):

    '''Depricated use get_dripper_drips_per_mm'''
    def get_drips_per_mm(self):
        logging.warning("Depricated use get_dripper_drips_per_mm")
        return self.get_dripper_drips_per_mm()

    '''Returns Drips Per mm'''
    def get_dripper_drips_per_mm(self):
        return self._current_config.dripper.drips_per_mm

    '''Returns the configured Dripper Type'''
    def get_dripper_type(self):
        return self._current_config.dripper.dripper_type

    '''Depricated use get_dripper_emulated_drips_per_second'''
    def get_emulated_drips_per_second(self):
        logging.warning("Depricated use get_dripper_emulated_drips_per_second")
        return self.get_dripper_emulated_drips_per_second()

    '''Gets the drips per second to be emulated'''
    def get_dripper_emulated_drips_per_second(self):
        return self._current_config.dripper.emulated_drips_per_second

    '''Depricated use get_dripper_photo_zaxis_delay'''
    def get_photo_zaxis_delay(self):
        logging.warning("Depricated use get_dripper_photo_zaxis_delay")
        return self.get_dripper_photo_zaxis_delay()

    '''Gets the photo delay in seconds'''
    def get_dripper_photo_zaxis_delay(self):
        return self._current_config.dripper.photo_zaxis_delay

    '''Depricated use set_dripper_drips_per_mm'''
    def set_drips_per_mm(self, drips):
        logging.warning("Depricated use set_dripper_drips_per_mm")
        self.set_dripper_drips_per_mm(drips)

    '''Sets Drips Per mm'''
    def set_dripper_drips_per_mm(self, drips):
        self._current_config.dripper.drips_per_mm = drips
        if self._drip_detector:
            self._drip_detector.set_drips_per_mm(drips)
        self.save()

    '''Sets the configured Dripper Type'''
    def set_dripper_type(self, value):
        self._current_config.dripper.dripper_type = value
        self.save()

    '''Depricated use set_dripper_emulated_drips_per_second'''
    def set_emulated_drips_per_second(self, value):
        logging.warning("Depricated use set_dripper_emulated_drips_per_second")
        self.set_dripper_emulated_drips_per_second(value)

    '''Sets the drips per second to be emulated'''
    def set_dripper_emulated_drips_per_second(self, value):
        self._current_config.dripper.emulated_drips_per_second = value
        self.save()

    '''Depricated use set_dripper_photo_zaxis_delay'''
    def set_photo_zaxis_delay(self, value):
        logging.warning("Depricated use set_dripper_photo_zaxis_delay")
        self.set_dripper_photo_zaxis_delay(value)

    '''Sets the photo delay in seconds'''
    def set_dripper_photo_zaxis_delay(self, value):
        self._current_config.dripper.photo_zaxis_delay = value
        self.save()

    '''Sets the drip count back to 0'''
    def reset_drips(self):
        self._drip_detector.reset()

    '''Turns on the counting of drips. Stop must be called to end this.'''
    def start_counting_drips(self, drip_call_back=None):
        self.drip_call_back = drip_call_back
        if self._current_config.serial.on:
            self._commander = SerialCommander(self._current_config.serial.port)
        self._change_dripper()

    def _change_dripper(self):
        self._stop_current_dripper()
        if self._current_config.dripper.dripper_type == 'emulated':
            pass
        elif self._current_config.dripper.dripper_type == 'photo':
            pass
        elif self._current_config.dripper.dripper_type == 'microcontroller':
            self._communicator = UsbPacketCommunicator(self._current_config.circut.calibration_queue_length)
            self._communicator.start()
            self._drip_detector = SerialDripZAxis(self._communicator, 1, 0.0, drip_call_back=self.drip_call_back)

    def _stop_current_dripper(self):
        if self._communicator:
            self._communicator.close()
        if self._drip_detector:
            self._drip_detector.close()
            self._drip_detector = None

    '''Turns off the counting of drips if counting'''
    def stop_counting_drips(self):
        if self._commander:
            self._commander.close()
        self._stop_current_dripper()

    def send_dripper_on_command(self):
        if self._commander:
            self._commander.send_command(self._current_config.serial.on_command)
        else:
            raise Exception("Serial not Started")

    def send_dripper_off_command(self):
        if self._commander:
            self._commander.send_command(self._current_config.serial.off_command)
        else:
            raise Exception("Serial not Started")
Exemplo n.º 4
0
class DripperSetupMixIn(object):
    '''Depricated use get_dripper_drips_per_mm'''
    def get_drips_per_mm(self):
        logging.warning("Depricated use get_dripper_drips_per_mm")
        return self.get_dripper_drips_per_mm()

    '''Returns Drips Per mm'''

    def get_dripper_drips_per_mm(self):
        return self._current_config.dripper.drips_per_mm

    '''Returns the configured Dripper Type'''

    def get_dripper_type(self):
        return self._current_config.dripper.dripper_type

    '''Depricated use get_dripper_emulated_drips_per_second'''

    def get_emulated_drips_per_second(self):
        logging.warning("Depricated use get_dripper_emulated_drips_per_second")
        return self.get_dripper_emulated_drips_per_second()

    '''Gets the drips per second to be emulated'''

    def get_dripper_emulated_drips_per_second(self):
        return self._current_config.dripper.emulated_drips_per_second

    '''Depricated use get_dripper_photo_zaxis_delay'''

    def get_photo_zaxis_delay(self):
        logging.warning("Depricated use get_dripper_photo_zaxis_delay")
        return self.get_dripper_photo_zaxis_delay()

    '''Gets the photo delay in seconds'''

    def get_dripper_photo_zaxis_delay(self):
        return self._current_config.dripper.photo_zaxis_delay

    '''Depricated use set_dripper_drips_per_mm'''

    def set_drips_per_mm(self, drips):
        logging.warning("Depricated use set_dripper_drips_per_mm")
        self.set_dripper_drips_per_mm(drips)

    '''Sets Drips Per mm'''

    def set_dripper_drips_per_mm(self, drips):
        self._current_config.dripper.drips_per_mm = drips
        if self._drip_detector:
            self._drip_detector.set_drips_per_mm(drips)
        self.save()

    '''Sets the configured Dripper Type'''

    def set_dripper_type(self, value):
        self._current_config.dripper.dripper_type = value
        self.save()

    '''Depricated use set_dripper_emulated_drips_per_second'''

    def set_emulated_drips_per_second(self, value):
        logging.warning("Depricated use set_dripper_emulated_drips_per_second")
        self.set_dripper_emulated_drips_per_second(value)

    '''Sets the drips per second to be emulated'''

    def set_dripper_emulated_drips_per_second(self, value):
        self._current_config.dripper.emulated_drips_per_second = value
        self.save()

    '''Depricated use set_dripper_photo_zaxis_delay'''

    def set_photo_zaxis_delay(self, value):
        logging.warning("Depricated use set_dripper_photo_zaxis_delay")
        self.set_dripper_photo_zaxis_delay(value)

    '''Sets the photo delay in seconds'''

    def set_dripper_photo_zaxis_delay(self, value):
        self._current_config.dripper.photo_zaxis_delay = value
        self.save()

    '''Sets the drip count back to 0'''

    def reset_drips(self):
        self._drip_detector.reset()

    '''Turns on the counting of drips. Stop must be called to end this.'''

    def start_counting_drips(self, drip_call_back=None):
        self.drip_call_back = drip_call_back
        if self._current_config.serial.on:
            self._commander = SerialCommander(self._current_config.serial.port)
        self._change_dripper()

    def _change_dripper(self):
        self._stop_current_dripper()
        if self._current_config.dripper.dripper_type == 'emulated':
            pass
        elif self._current_config.dripper.dripper_type == 'photo':
            pass
        elif self._current_config.dripper.dripper_type == 'microcontroller':
            self._communicator = UsbPacketCommunicator(
                self._current_config.circut.calibration_queue_length)
            self._communicator.start()
            self._drip_detector = SerialDripZAxis(
                self._communicator, 1, 0.0, drip_call_back=self.drip_call_back)

    def _stop_current_dripper(self):
        if self._communicator:
            self._communicator.close()
        if self._drip_detector:
            self._drip_detector.close()
            self._drip_detector = None

    '''Turns off the counting of drips if counting'''

    def stop_counting_drips(self):
        if self._commander:
            self._commander.close()
        self._stop_current_dripper()

    def send_dripper_on_command(self):
        if self._commander:
            self._commander.send_command(
                self._current_config.serial.on_command)
        else:
            raise Exception("Serial not Started")

    def send_dripper_off_command(self):
        if self._commander:
            self._commander.send_command(
                self._current_config.serial.off_command)
        else:
            raise Exception("Serial not Started")