def _init_addressings(self): # 'self.addressings' uses a structure like this: # "/hmi/knob1": {'addrs': [], 'idx': 0} self.addressings = dict((act["uri"], {'idx': 0, 'addrs': []}) for act in get_hardware()["actuators"]) # Store all possible hardcoded values self._hw2uri_map = {} self._uri2hw_map = {} for i in range(0, 4): knob_hw = (HARDWARE_TYPE_MOD, 0, ACTUATOR_TYPE_KNOB, i) foot_hw = (HARDWARE_TYPE_MOD, 0, ACTUATOR_TYPE_FOOTSWITCH, i) knob_uri = "/hmi/knob%i" % (i+1) foot_uri = "/hmi/footswitch%i" % (i+1) self._hw2uri_map[knob_hw] = knob_uri self._hw2uri_map[foot_hw] = foot_uri self._uri2hw_map[knob_uri] = knob_hw self._uri2hw_map[foot_uri] = foot_hw
def _init_addressings(self): # 'self.addressings' uses a structure like this: # "/hmi/knob1": {'addrs': [], 'idx': 0} self.addressings = dict((act["uri"], { 'idx': 0, 'addrs': [] }) for act in get_hardware()["actuators"]) # Store all possible hardcoded values self._hw2uri_map = {} self._uri2hw_map = {} for i in range(0, 4): knob_hw = (HARDWARE_TYPE_MOD, 0, ACTUATOR_TYPE_KNOB, i) foot_hw = (HARDWARE_TYPE_MOD, 0, ACTUATOR_TYPE_FOOTSWITCH, i) knob_uri = "/hmi/knob%i" % (i + 1) foot_uri = "/hmi/footswitch%i" % (i + 1) self._hw2uri_map[knob_hw] = knob_uri self._hw2uri_map[foot_hw] = foot_uri self._uri2hw_map[knob_uri] = knob_hw self._uri2hw_map[foot_uri] = foot_hw
def get_hardware(self): if self.addressings is None: return {} hw = deepcopy(get_hardware()) hw["addressings"] = self.addressings.get_addressings() return hw