当前位置: 首页>>代码示例>>Python>>正文


Python btle.DefaultDelegate方法代码示例

本文整理汇总了Python中bluepy.btle.DefaultDelegate方法的典型用法代码示例。如果您正苦于以下问题:Python btle.DefaultDelegate方法的具体用法?Python btle.DefaultDelegate怎么用?Python btle.DefaultDelegate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在bluepy.btle的用法示例。


在下文中一共展示了btle.DefaultDelegate方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: connect

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def connect(self):
        # Auto-discover device on first connection
        if (self.MacAddr is None):
            scanner     = Scanner().withDelegate(DefaultDelegate())
            searchCount = 0
            while self.MacAddr is None and searchCount < 50:
                devices      = scanner.scan(0.1) # 0.1 seconds scan period
                searchCount += 1
                for dev in devices:
                    ManuData = dev.getValueText(255)
                    SN = parseSerialNumber(ManuData)
                    if (SN == self.SN):
                        self.MacAddr = dev.addr # exits the while loop on next conditional check
                        break # exit for loop
            
            if (self.MacAddr is None):
                print "ERROR: Could not find device."
                print "GUIDE: (1) Please verify the serial number."
                print "       (2) Ensure that the device is advertising."
                print "       (3) Retry connection."
                sys.exit(1)
        
        # Connect to device
        if (self.periph is None):
            self.periph = Peripheral(self.MacAddr)
        if (self.curr_val_char is None):
            self.curr_val_char = self.periph.getCharacteristics(uuid=self.uuid)[0] 
开发者ID:Airthings,项目名称:waveplus-reader,代码行数:29,代码来源:read_waveplus.py

示例2: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self, handler):
        btle.DefaultDelegate.__init__(self)

        self._handler = handler 
开发者ID:undera,项目名称:pylgbst,代码行数:6,代码来源:cbluepy.py

示例3: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self, light):
        self.light = light
        btle.DefaultDelegate.__init__(self) 
开发者ID:Leiaz,项目名称:python-awox-mesh-light,代码行数:5,代码来源:__init__.py

示例4: getTag

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def getTag(self):
        """Scans for BT LE devices and returns the choosen keywords"""
        self.count = 0
        scanner = Scanner().withDelegate(DefaultDelegate())
        devices = scanner.scan(self.scanTimeout)
        for dev in devices:
            if dev.addr == self.address.lower():
                self.count = 1
			
        if self.count > 0:
            self.count = 0
            return self.found
        else:
            return self.missing 
开发者ID:rkoshak,项目名称:sensorReporter,代码行数:16,代码来源:bluetoothScanner.py

示例5: scan_devices

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def scan_devices(self, delegate=DefaultDelegate, timeout=5):
        devices = Scanner(self.iface).withDelegate(delegate()).scan(timeout=timeout) 
        return self._package_data_devices(devices) 
开发者ID:ElevenPaths,项目名称:HomePWN,代码行数:5,代码来源:ble.py

示例6: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self,callback):
   self.callback = callback
   btle.DefaultDelegate.__init__(self) 
开发者ID:enesbcs,项目名称:rpieasy,代码行数:5,代码来源:_P512_BLEMijia.py

示例7: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self,keypressed_callback,KPHANDLE):
        self.keypressed_callback = keypressed_callback
        self.keypressed_handle = KPHANDLE
        btle.DefaultDelegate.__init__(self) 
开发者ID:enesbcs,项目名称:rpieasy,代码行数:6,代码来源:_P510_ITag.py

示例8: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self, mac):
        """Initialize the connection."""
        btle.DefaultDelegate.__init__(self)

        self._conn = None
        self._mac = mac
        self._callbacks = {} 
开发者ID:rytilahti,项目名称:python-eq3bt,代码行数:9,代码来源:connection.py

示例9: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self, mac=None):
        btle.DefaultDelegate.__init__(self)
        self.services = Services(mac=get_myo(mac))
        self.services.setDelegate(self)

        self.emg_event_handlers = []
        self.imu_event_handlers = []
        self.sync_event_handlers = []
        self.classifier_event_handlers = []
        self.battery_event_handlers = [] 
开发者ID:Alvipe,项目名称:Open-Myo,代码行数:12,代码来源:open_myo.py

示例10: __init__

# 需要导入模块: from bluepy import btle [as 别名]
# 或者: from bluepy.btle import DefaultDelegate [as 别名]
def __init__(self, dongle):
		btle.DefaultDelegate.__init__(self)
		self.dongle = dongle 
开发者ID:LedgerHQ,项目名称:blue-loader-python,代码行数:5,代码来源:commBLE.py


注:本文中的bluepy.btle.DefaultDelegate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。