def discovered_devices(self) -> List[BLEDevice]: found = [] peripherals = self._manager.central_manager.retrievePeripheralsWithIdentifiers_( NSArray(self._identifiers.keys()), ) for peripheral in peripherals: address = peripheral.identifier().UUIDString() name = peripheral.name() or "Unknown" details = peripheral rssi = self._manager.devices[address].rssi advertisementData = self._identifiers[peripheral.identifier()] manufacturer_binary_data = advertisementData.get( "kCBAdvDataManufacturerData" ) manufacturer_data = {} if manufacturer_binary_data: manufacturer_id = int.from_bytes( manufacturer_binary_data[0:2], byteorder="little" ) manufacturer_value = bytes(manufacturer_binary_data[2:]) manufacturer_data = {manufacturer_id: manufacturer_value} uuids = [ cb_uuid_to_str(u) for u in advertisementData.get("kCBAdvDataServiceUUIDs", []) ] service_data = {} adv_service_data = advertisementData.get("kCBAdvDataServiceData", []) for u in adv_service_data: service_data[cb_uuid_to_str(u)] = bytes(adv_service_data[u]) found.append( BLEDevice( address, name, details, rssi=rssi, uuids=uuids, manufacturer_data=manufacturer_data, service_data=service_data, delegate=self._manager.central_manager.delegate(), ) ) return found
except Exception as e: print("Error for path index %s, node index %i:\n%s" % (pi, ni, e)) import traceback print(traceback.format_exc()) return False # determine current layer: currentFont = Glyphs.font currentLayer = currentFont.selectedLayers[0] currentGlyph = currentLayer.parent # find compatible layers in the same glyph: layerIDs = [] for subrunArray in currentGlyph.layerGroups_masters_error_( NSArray(currentFont.instances), NSArray(currentFont.masters), None): subrun = tuple(subrunArray) if currentLayer.layerId in subrun: for ID in subrun: if ID != currentLayer.layerId: layerIDs.append(ID) # if there are any compatible layers... if not layerIDs: Message( title="Dekink Error", message= "Could not find any other layers in this glyph for this interpolation.", OKButton=None) else: if not currentGlyph.mastersCompatible:
def doCBad_(self, aTimer): NSArray([1])[5]