SensorStatus = GreedyRange(SensorData) # TODO: message not implemented due to somewhat complicated structure and lack of examples # SensorColumnGet = Struct( # Embedded(SensorSettingsGet), # "raw_value_x" / PropertyValue # ) # TODO: message not implemented due to somewhat complicated structure and lack of examples # SensorSeriesGet = Struct( # Embedded(SensorSettingsGet), # "raw_value_y" / PropertyValue # ) FastCadencePeriodDivisorAndTriggerType = EmbeddedBitStruct( "status_trigger_type" / BitsInteger(1), "fast_cadence_period_divisor" / BitsInteger(7) ) UnitlessTriggerDelta = DefaultCountValidator(Int8ul, rounding=1, resolution=0.1) TriggerDelta = Struct( Switch( this.status_trigger_type, { 0: Struct( "status_trigger_delta_down" / PropertyValue, "status_trigger_delta_up" / PropertyValue ), 1: Struct( "status_trigger_delta_down" / UnitlessTriggerDelta, "status_trigger_delta_up" / UnitlessTriggerDelta
"sensor_sampling_funcion" / Int8ul, "sensor_measurement_period" / Int8ul, "sensor_update_interval" / Int8ul ) SensorDescriptorStatus = GreedyRange( Select( SensorDescriptor, Struct("sensor_property_id" / Int16ul) ), ) MarshalledPropertyIDShort = EmbeddedBitStruct( "_", "sensor_setting_property_id" / BitsInteger(11), "length" / ExprAdapter(BitsInteger(4), obj_ + 1, obj_ - 1), "format" / Const(0, BitsInteger(1)), reversed=True ) MarshalledPropertyIDLong = EmbeddedBitStruct( "_", "sensor_setting_property_id" / BitsInteger(16), "length" / ExprAdapter(BitsInteger(7), obj_ + 1, obj_ - 1), "format" / Const(1, BitsInteger(1)), reversed=True ) SensorData = Select( Struct( *MarshalledPropertyIDShort,
ChromaticityCoordinates = Struct( "chromaticity_x_coordinate" / DefaultCountValidator(Int16ul, resolution=1 / 0xffff), "chromaticity_y_coordinate" / DefaultCountValidator(Int16ul, resolution=1 / 0xffff)) ColorRenderingIndex = Struct("color_rendering_index" / DefaultCountValidator(Int8sl)) # misc GlobalTradeItemNumber = Struct("global_trade_item_number" / BytesInteger(6, swapped=True)) Appearance = Struct( # TODO: check if correct *EmbeddedBitStruct("_", "category" / BitsInteger(10), "sub_category" / BitsInteger(6), reversed=True)) CountryCode = Struct("country_code" / DefaultCountValidator(Int16ul)) Presence = Struct("presence_detected" / Flag) EventStatistics = Struct( "number_of_events" / Count16, "average_event_duration" / TimeSecond16, "time_elapsed_since_last_event" / TimeExponential8, "sensing_duration" / TimeExponential8, ) RelativeRuntimeInAGenericLevelRange = Struct( "relative_value" /