コード例 #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
ファイル: device.py プロジェクト: satyajitghana/bleak
 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]