当前位置: 首页>>代码示例>>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;未经允许,请勿转载。