本文整理匯總了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 = ""