def close(self, event): log.debug("Closing LTCBackend") try: self.ignite(False) except PhidgetException: log.info("Unable to turn off ignite on quit") self.relay.close() self.core.close()
def __init__(self, **kwargs): log.debug("Acquiring InterfaceKit") self.ik = InterfaceKit() log.debug("Registering Handlers") self.ik.setOnAttachHandler(self._onAttach) self.ik.setOnDetachHandler(self._onDetach) self.ik.setOnErrorhandler(self._onError) self.ik.setOnOutputChangeHandler(self._onOutput) self.ik.setOnInputChangeHandler(self._onInput) self.ik.setOnSensorChangeHandler(self._onSensor)
def add_callback(self, cb, type): log.debug("Adding callback to {} sensor".format(self.name)) self.callback[type].append(cb)
def _onError(self, event): log.debug(event.description) log.verbose("{} event received".format(type)) for cb in self.callback['error']: cb(event)
def remove_callback(self, cb, type): log.debug("Removing a {} type callback".format(type)) self.callback[type].remove(cb)
def add_callback(self, cb, type): log.debug("Adding a {} type callback".format(type)) self.callback[type].append(cb)
def close(self): log.verbose("Closing InterfaceKit") self.ik.closePhidget() log.debug("Interfac kit closed")
def start(self): log.verbose("Opening remote IP") self.ik.openRemoteIP(self.IP, self.port, self.devserial) log.debug("Remote IP opened")