本文整理汇总了Python中bluepy.btle.Peripheral.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Peripheral.__init__方法的具体用法?Python Peripheral.__init__怎么用?Python Peripheral.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类bluepy.btle.Peripheral
的用法示例。
在下文中一共展示了Peripheral.__init__方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self,addr,version=AUTODETECT):
Peripheral.__init__(self,addr)
if version==AUTODETECT:
svcs = self.discoverServices()
if _TI_UUID(0xAA70) in svcs:
version = SENSORTAG_2650
else:
version = SENSORTAG_V1
fwVers = self.getCharacteristics(uuid=AssignedNumbers.firmwareRevisionString)
if len(fwVers) >= 1:
self.firmwareVersion = fwVers[0].read().decode("utf-8")
else:
self.firmwareVersion = u''
if version==SENSORTAG_V1:
self.IRtemperature = IRTemperatureSensor(self)
self.accelerometer = AccelerometerSensor(self)
self.humidity = HumiditySensor(self)
self.magnetometer = MagnetometerSensor(self)
self.barometer = BarometerSensor(self)
self.gyroscope = GyroscopeSensor(self)
self.keypress = KeypressSensor(self)
self.lightmeter = None
elif version==SENSORTAG_2650:
self._mpu9250 = MovementSensorMPU9250(self)
self.IRtemperature = IRTemperatureSensorTMP007(self)
self.accelerometer = AccelerometerSensorMPU9250(self._mpu9250)
self.humidity = HumiditySensorHDC1000(self)
self.magnetometer = MagnetometerSensorMPU9250(self._mpu9250)
self.barometer = BarometerSensorBMP280(self)
self.gyroscope = GyroscopeSensorMPU9250(self._mpu9250)
self.keypress = KeypressSensor(self)
self.lightmeter = OpticalSensorOPT3001(self)
self.battery = BatterySensor(self)
示例2: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self, addr):
print("Press the Angel Sensor's button to continue...")
while True:
try:
Peripheral.__init__(self, addr, addrType=ADDR_TYPE_PUBLIC)
except BTLEException:
time.sleep(0.5)
continue
break
示例3: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self, addr):
Peripheral.__init__(self, addr, addrType=ADDR_TYPE_RANDOM)
# Thingy configuration service not implemented
self.battery = BatterySensor(self)
self.environment = EnvironmentService(self)
self.ui = UserInterfaceService(self)
self.motion = MotionService(self)
self.sound = SoundService(self)
示例4: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self, addr):
log.debug('connetion...')
Peripheral.__init__(self, addr)
log.debug('discovery...')
self.discoverServices()
self.notify_ch = None
s = self.getServiceByUUID('fff0')
self.cccd, = s.getCharacteristics('fff2')
self.cccn, = s.getCharacteristics('fff1')
log.debug('cccd: uuid=%s, commonName=%s, properties=%s' % (
self.cccd.uuid,
self.cccd.uuid.getCommonName(),
self.cccd.propertiesToString()))
log.debug('cccn: uuid=%s, commonName=%s, properties=%s' % (
self.cccn.uuid,
self.cccn.uuid.getCommonName(),
self.cccn.propertiesToString()))
self.cccd.write(b'\x01\x00')
self.cccn.write(b'\x01\x00')
示例5: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self, addr ):
if addr and len(addr) != 17 :
raise Exception( 'ERROR: device address must be in the format NN:NN:NN:NN:NN:NN' )
Peripheral.__init__(self, addr)
if addr:
logger.info( 'connected to {}'.format( addr ) )
# self.svcs = self.discoverServices()
self.name = ''
self.modelNumber = None
self.serialNumber = None
self.firmwareRevision = None
self.hardwareRevision = None
self.softwareRevision = None
self.manufacturer = None
self.temperature = None
self.humidity = None
self.battery = None
示例6: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self, addr):
Peripheral.__init__(self, addr, addrType=ADDR_TYPE_PUBLIC)
示例7: __init__
# 需要导入模块: from bluepy.btle import Peripheral [as 别名]
# 或者: from bluepy.btle.Peripheral import __init__ [as 别名]
def __init__(self,addr):
Peripheral.__init__(self,addr)
# self.discoverServices()
self.accelerometer = AccelerometerSensor(self)
self.keypress = KeypressSensor(self)
self.movement = MovementSensor(self)