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


Python Peripheral.__init__方法代码示例

本文整理汇总了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)
开发者ID:IanHarvey,项目名称:bluepy,代码行数:37,代码来源:sensortag.py

示例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
开发者ID:vaggos2002,项目名称:py-angel-sensor,代码行数:11,代码来源:main.py

示例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)
开发者ID:IanHarvey,项目名称:bluepy,代码行数:11,代码来源:thingy52.py

示例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')
开发者ID:matthewg42,项目名称:fire_pong,代码行数:21,代码来源:btle.py

示例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
开发者ID:druxx,项目名称:ha-utils,代码行数:21,代码来源:bbw200.py

示例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)
开发者ID:Flu-Ger,项目名称:py-angel-sensor,代码行数:4,代码来源:temp.py

示例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)
开发者ID:Jeoy5460,项目名称:imu,代码行数:8,代码来源:ble_task.py


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