當前位置: 首頁>>代碼示例>>Python>>正文


Python bluetooth.lookup_name方法代碼示例

本文整理匯總了Python中bluetooth.lookup_name方法的典型用法代碼示例。如果您正苦於以下問題:Python bluetooth.lookup_name方法的具體用法?Python bluetooth.lookup_name怎麽用?Python bluetooth.lookup_name使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在bluetooth的用法示例。


在下文中一共展示了bluetooth.lookup_name方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: lookup_name

# 需要導入模塊: import bluetooth [as 別名]
# 或者: from bluetooth import lookup_name [as 別名]
def lookup_name(self, addr: str, timeout: int = 10) -> BluetoothLookupNameResponse:
        """
        Look up the name of a nearby bluetooth device given the address

        :param addr: Device address
        :param timeout: Lookup timeout (default: 10 seconds)
        """
        from bluetooth import lookup_name

        self.logger.info('Looking up name for device {}'.format(addr))
        name = lookup_name(addr, timeout=timeout)

        dev = {
            'addr': addr,
            'name': name,
            'class': self._devices_by_addr.get(addr, {}).get('class'),
        }

        self._devices_by_addr[addr] = dev
        if name:
            self._devices_by_name[name] = dev

        return BluetoothLookupNameResponse(addr=addr, name=name) 
開發者ID:BlackLight,項目名稱:platypush,代碼行數:25,代碼來源:__init__.py

示例2: findDevs

# 需要導入模塊: import bluetooth [as 別名]
# 或者: from bluetooth import lookup_name [as 別名]
def findDevs(opts):
    global foundDevs
    devList = bluetooth.discover_devices(lookup_names=True)
    repeat = range(0, int(opts.repeat))

    for (dev, name) in devList:
        if dev not in foundDevs:
            name = str(bluetooth.lookup_name(dev))
            printDev(name, dev)
            foundDevs.append(dev)
            for i in repeat:
                sendFile(dev, opts.file)
            continue

        if opts.spam:
            for i in repeat:
                sendFile(dev, opts.file) 
開發者ID:StevenDias33,項目名稱:Offensive-Security-Certified-Professional,代碼行數:19,代碼來源:bluetoothObexSpam.py

示例3: lookup_info

# 需要導入模塊: import bluetooth [as 別名]
# 或者: from bluetooth import lookup_name [as 別名]
def lookup_info(addr, **kwargs):
    Class = kwargs.get('Class',True)
    Name = kwargs.get('Name',True)
    Address = kwargs.get('Address',True)
    info = {}
    while True:
        s = _run(['hcitool','inq'])
        for i in s.splitlines():
            i = str(i)
            if addr in i:
                info['class'] = re.compile(r'class: ([A-Fa-fx0-9]*)').findall(i)[0]
                info['addr'] = addr
                info['name'] = bluetooth.lookup_name(addr)
                return info

        print( 'Still looking for ', addr,'...', ' Is it discoverable? ') 
開發者ID:conorpp,項目名稱:btproxy,代碼行數:18,代碼來源:adapter.py

示例4: __init__

# 需要導入模塊: import bluetooth [as 別名]
# 或者: from bluetooth import lookup_name [as 別名]
def __init__(self, mac, port=None, name=None):
        self.sock = None

        self.mac = mac
        self.port = port
        self.name = name

        self.port = self.scan_ports() if not port else port
        self.name = bluetooth.lookup_name(mac) if not name else name 
開發者ID:Thor77,項目名稱:Blueproximity,代碼行數:11,代碼來源:device.py

示例5: checkBluetooth

# 需要導入模塊: import bluetooth [as 別名]
# 或者: from bluetooth import lookup_name [as 別名]
def checkBluetooth(btAddr):
    btName = bluetooth.lookup_name(btAddr)
    if btName:
        printDev('Hidden Bluetooth device detected', btName, btAddr)
        return True

    return False 
開發者ID:StevenDias33,項目名稱:Offensive-Security-Certified-Professional,代碼行數:9,代碼來源:bluetoothObexSpam.py

示例6: getPresence

# 需要導入模塊: import bluetooth [as 別名]
# 或者: from bluetooth import lookup_name [as 別名]
def getPresence(self):
        """Detects whether the device is near by or not using lookup_name"""
        result = bluetooth.lookup_name(self.address, timeout=25)
        if(result != None):
            return "ON"
        else:
            return "OFF" 
開發者ID:rkoshak,項目名稱:sensorReporter,代碼行數:9,代碼來源:bluetoothScanner.py


注:本文中的bluetooth.lookup_name方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。