예제 #1
0
    def _update_manufacturer(self, advertisementData: NSDictionary):
        mfg_bytes = advertisementData.get("kCBAdvDataManufacturerData")
        if not mfg_bytes:
            return

        mfg_id = int.from_bytes(mfg_bytes[0:2], byteorder="little")
        mfg_val = bytes(mfg_bytes[2:])
        self.metadata["manufacturer_data"] = {mfg_id: mfg_val}
예제 #2
0
 def _update_uuids(self, advertisementData: NSDictionary):
     cbuuids = advertisementData.get("kCBAdvDataServiceUUIDs", [])
     if not cbuuids:
         return
     chuuids = [cb_uuid_to_str(u) for u in cbuuids]
     if "uuids" in self.metadata:
         for uuid in chuuids:
             if not uuid in self.metadata["uuids"]:
                 self.metadata["uuids"].append(uuid)
     else:
         self.metadata["uuids"] = chuuids
예제 #3
0
파일: device.py 프로젝트: soldag/bleak
 def _update_uuids(self, advertisementData: NSDictionary):
     cbuuids = advertisementData.get("kCBAdvDataServiceUUIDs", [])
     if not cbuuids:
         return
     # converting to lower case to match other platforms
     chuuids = [str(u).lower() for u in cbuuids]
     if "uuids" in self.metadata:
         for uuid in chuuids:
             if not uuid in self.metadata["uuids"]:
                 self.metadata["uuids"].append(uuid)
     else:
         self.metadata["uuids"] = chuuids
예제 #4
0
 def _update_uuids(self, advertisementData: NSDictionary):
     cbuuids = advertisementData.get("kCBAdvDataServiceUUIDs", [])
     if not cbuuids:
         return
     # converting to lower case to match other platforms
     self.metadata["uuids"] = [str(u).lower() for u in cbuuids]