def humidity_data_callback(data): """Capture any data and print them to stdout""" humidity_info = sense_pb2.Humidity().FromString(data) print('data: {0}'.format(humidity_info))
def humidity_data_callback(data): # Extract data data = sense_pb2.Humidity().FromString(data[0]) # Log data print('{0}'.format(data))
""" import asyncio import logging import math import os import sys from docopt import docopt from matrix_io.proto.malos.v1 import driver_pb2 from matrix_io.proto.malos.v1 import sense_pb2, io_pb2 from matrix_io.proto.vision.v1 import vision_pb2 from matrix_io.malos import driver """ Driver to proto message mappings """ DRIVER_PROTOS = { 'HUMIDITY': sense_pb2.Humidity(), 'IMU': sense_pb2.Imu(), 'MICARRAY_ALSA': io_pb2.MicArrayParams(), 'PRESSURE': sense_pb2.Pressure(), 'UV': sense_pb2.UV(), 'VISION': vision_pb2.VisionResult() } async def data_handler(malos_driver, driver_name): """ Sample coroutine accessing the MALOS driver data generator Args: malos_driver: MALOSDriver instance driver_name: driver name as a string (IMU, UV, PRESSURE)