def __init__(self, mw):
        QtCore.QObject.__init__(self)

        self.mw = mw

        self.qtcb_enumerate.connect(self.cb_enumerate)

        self.ipcon = IPConnection()
        self.ipcon.connect(self.HOST, self.PORT)
        self.ipcon.register_callback(self.ipcon.CALLBACK_ENUMERATE, self.qtcb_enumerate.emit)
        self.ipcon.enumerate()
class DeviceManager(QtCore.QObject):
    HOST = "localhost"
    PORT = 4223

    devices = {}
    qtcb_enumerate = QtCore.pyqtSignal(str, str, str, type((0,)), type((0,)), int, int)

    def __init__(self, mw):
        QtCore.QObject.__init__(self)

        self.mw = mw

        self.qtcb_enumerate.connect(self.cb_enumerate)

        self.ipcon = IPConnection()
        self.ipcon.connect(self.HOST, self.PORT)
        self.ipcon.register_callback(self.ipcon.CALLBACK_ENUMERATE, self.qtcb_enumerate.emit)
        self.ipcon.enumerate()

    def cb_enumerate(self, uid, connected_uid, position, hardware_version, 
                     firmware_version, device_identifier, enumeration_type):
        if enumeration_type in (self.ipcon.ENUMERATION_TYPE_CONNECTED, self.ipcon.ENUMERATION_TYPE_AVAILABLE):
            if device_identifier == BrickletIO4.DEVICE_IDENTIFIER and uid == '555555':
                if self.mw.foot_pedal != None:
                    self.mw.foot_pedal.register_callback(BrickletIO4.CALLBACK_INTERRUPT, None)
                else:
                    self.mw.foot_pedal = BrickletIO4(uid, self.ipcon)
                    self.mw.foot_pedal.register_callback(BrickletIO4.CALLBACK_INTERRUPT, self.mw.qtcb_foot_pedal.emit)
                    self.mw.foot_pedal.set_interrupt(1)

                return

            device_information = DeviceInformation(uid, connected_uid, position, hardware_version,
                                                   firmware_version, device_identifier, enumeration_type)

            # Overwrite device if it already exists
            self.devices[device_identifier] = device_information
            if self.mw.current_plugin:
                if (self.mw.current_plugin.get_device_identifier() % 10000) == device_identifier:
                    self.mw.current_plugin.new_enum(device_information)
                    return

            if device_identifier == BrickMaster.DEVICE_IDENTIFIER and \
               self.mw.label_tool_status.text() == 'Master Brick startet neu':
                self.mw.set_tool_status_normal('Master Brick wurde neu gestartet')