def set_proximity(self, proximity: single.Single) -> "Sensors": """ Sets the channel :param proximity: Channel to set :return: A modified instance of self """ redvox.api1000.common.typing.check_type(proximity, [single.Single]) self.get_proto().proximity.CopyFrom(proximity.get_proto()) self._proximity = single.Single(self.get_proto().proximity) return self
def set_light(self, light: single.Single) -> "Sensors": """ Sets the channel :param light: Channel to set :return: A modified instance of self """ redvox.api1000.common.typing.check_type(light, [single.Single]) self.get_proto().light.CopyFrom(light.get_proto()) self._light = single.Single(self.get_proto().light) return self
def new_proximity(self) -> single.Single: """ :return: A new empty sensor """ self.remove_proximity() self.get_proto().proximity.SetInParent() self._proximity = single.Single(self.get_proto().proximity) self._proximity.get_timestamps().set_default_unit() # noinspection PyTypeChecker self._proximity.get_samples().set_unit(common.Unit.CENTIMETERS) return self._proximity
def new_pressure(self) -> single.Single: """ :return: A new empty sensor """ self.remove_pressure() self.get_proto().pressure.SetInParent() self._pressure = single.Single(self.get_proto().pressure) self._pressure.get_timestamps().set_default_unit() # noinspection PyTypeChecker self._pressure.get_samples().set_unit(common.Unit.KILOPASCAL) return self._pressure
def new_light(self) -> single.Single: """ :return: A new empty sensor """ self.remove_light() self.get_proto().light.SetInParent() self._light = single.Single(self.get_proto().light) self._light.get_timestamps().set_default_unit() # noinspection PyTypeChecker self._light.get_samples().set_unit(common.Unit.LUX) return self._light
def new_relative_humidity(self) -> single.Single: """ :return: A new empty sensor """ self.remove_relative_humidity() self.get_proto().relative_humidity.SetInParent() self._relative_humidity = single.Single( self.get_proto().relative_humidity) self._relative_humidity.get_timestamps().set_default_unit() # noinspection PyTypeChecker self._relative_humidity.get_samples().set_unit(common.Unit.PERCENTAGE) return self._relative_humidity
def new_ambient_temperature(self) -> single.Single: """ :return: A new empty sensor """ self.remove_ambient_temperature() self.get_proto().ambient_temperature.SetInParent() self._ambient_temperature = single.Single( self.get_proto().ambient_temperature) self._ambient_temperature.get_timestamps().set_default_unit() # noinspection PyTypeChecker self._ambient_temperature.get_samples().set_unit( common.Unit.DEGREES_CELSIUS) return self._ambient_temperature
def set_ambient_temperature( self, ambient_temperature: single.Single) -> "Sensors": """ Sets the channel :param ambient_temperature: Channel to set :return: A modified instance of self """ redvox.api1000.common.typing.check_type(ambient_temperature, [single.Single]) self.get_proto().ambient_temperature.CopyFrom( ambient_temperature.get_proto()) self._ambient_temperature = single.Single( self.get_proto().ambient_temperature) return self
def __init__(self, sensors_proto: redvox_api_m_pb2.RedvoxPacketM.Sensors): super().__init__(sensors_proto) self._accelerometer: xyz.Xyz = xyz.Xyz(sensors_proto.accelerometer) self._ambient_temperature: single.Single = single.Single( sensors_proto.ambient_temperature) self._audio: audio.Audio = audio.Audio(sensors_proto.audio) self._compressed_audio: audio.CompressedAudio = audio.CompressedAudio( sensors_proto.compressed_audio) self._gravity: xyz.Xyz = xyz.Xyz(sensors_proto.gravity) self._gyroscope: xyz.Xyz = xyz.Xyz(sensors_proto.gyroscope) self._image: image.Image = image.Image(sensors_proto.image) self._light: single.Single = single.Single(sensors_proto.light) self._linear_acceleration: xyz.Xyz = xyz.Xyz( sensors_proto.linear_acceleration) self._location: location.Location = location.Location( sensors_proto.location) self._magnetometer: xyz.Xyz = xyz.Xyz(sensors_proto.magnetometer) self._orientation: xyz.Xyz = xyz.Xyz(sensors_proto.orientation) self._pressure: single.Single = single.Single(sensors_proto.pressure) self._proximity: single.Single = single.Single(sensors_proto.proximity) self._relative_humidity: single.Single = single.Single( sensors_proto.relative_humidity) self._rotation_vector: xyz.Xyz = xyz.Xyz(sensors_proto.rotation_vector) self._velocity: xyz.Xyz = xyz.Xyz(sensors_proto.velocity)