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


Python GATTRequester.__init__方法代碼示例

本文整理匯總了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)
開發者ID:flagist0,項目名稱:pypavlok,代碼行數:33,代碼來源:pypavlok.py

示例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
開發者ID:smihir,項目名稱:smartshoes,代碼行數:10,代碼來源:kiba_kumba_controller.py

示例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
開發者ID:smihir,項目名稱:smartshoes,代碼行數:6,代碼來源:notify-plot.py

示例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)
開發者ID:LucaBongiorni,項目名稱:BLESuite-CLI,代碼行數:4,代碼來源:cmdLineToolWrappers.py

示例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
開發者ID:HcDevel,項目名稱:SmartWatch,代碼行數:6,代碼來源:upload.py

示例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
開發者ID:cryptax,項目名稱:fittools,代碼行數:6,代碼來源:read-battery.py

示例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 = ""
開發者ID:szabolcszijarto,項目名稱:dandolib,代碼行數:6,代碼來源:dandolib.py


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