本文整理汇总了Python中gattlib.GATTRequester.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python GATTRequester.__init__方法的具体用法?Python GATTRequester.__init__怎么用?Python GATTRequester.__init__使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类gattlib.GATTRequester
的用法示例。
在下文中一共展示了GATTRequester.__init__方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, addr=None, device='hci0', debug=False, **connect_kwargs):
'''
@param addr (optional): MAC address of Pavlok device
If not passed, will be discovered with DiscoveryService (requires root privileges)
@param device (optional): host Bluetooth interface ('hci0' by default)
@param debug (optional): debug logging (disabled by default)
@param connect_kwargs: keyword arguments (security_level, channel_type, mtu, psm) to pass to GATTRequester.connect
security_level: 'low' (default), 'medium', 'high'
channel_type: 'public' (default), 'random'
mtu: integer
psm: integer
'''
self._init_logging(debug)
if not addr:
addr = self._get_pavlok_mac_addr(device)
assert addr, 'Could not find Pavlok device'
GATTRequester.__init__(self, addr, False, device) #GATTRequester is an old-style class
if connect_kwargs:
self.logger.debug('Got keyword arguments for self.connect: %s', connect_kwargs)
self.connect(wait=False, **connect_kwargs) #Blocking connect() is better, but it would require root privileges
self._wait_until_connected()
characteristics = self.discover_characteristics()
self.logger.debug('GATT characteristics: %s', characteristics)
#Find matching value handles for service UUIDs
self.handles = {name:filter(lambda e: e['uuid'] == uuid, characteristics)[0]['value_handle']\
for name, uuid in self.service_uuids.items()}
self.logger.debug('GATT value handles: %s', self.handles)
self.logger.debug('Hardware revision: %s, firmware revision: %s', self.hardware_revision, self.firmware_revision)
示例2: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, wakeup, pstream, tstream, *args):
GATTRequester.__init__(self, *args)
self.wakeup = wakeup
self.s = pstream
self.t = tstream
self.count = 0
self.prev_ay = 1
self.local_maxima = 1
示例3: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, wakeup, pstream, *args):
GATTRequester.__init__(self, *args)
self.wakeup = wakeup
self.s = pstream
示例4: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, wakeup, *args):
GATTRequester.__init__(self, *args)
self.wakeup = wakeup
开发者ID:AwxiVYTHUIiMOol,项目名称:https-bitbucket.org-OscarAcena-pygattlib,代码行数:5,代码来源:receive_notification.py
示例5: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, *args):
GATTRequester.__init__(self, *args)
示例6: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, wakeup, update, *args):
GATTRequester.__init__(self, *args)
self.wakeup = wakeup
self.update = update
示例7: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, thread, verbose, *args):
GATTRequester.__init__(self, *args)
self.event_thread = thread
self.verbose = verbose
示例8: __init__
# 需要导入模块: from gattlib import GATTRequester [as 别名]
# 或者: from gattlib.GATTRequester import __init__ [as 别名]
def __init__(self, address, do_connect, device ):
GATTRequester.__init__(self, address, do_connect, device)
self.notification21data = ""
self.notification24data = ""