l1: Store measurement values sent by the MS

This commit extends the pcu_l1_meas structure by MS side measurement
values which are transmitted by PACKET DOWNLINK ACK/NACK and
PACKET RESOURCE REQUEST messages. The encoded values are remapped to
dB respectively % values. The values are stored in the corresponding
MS object (if there is one).

Note that the values are store as (rounded) integers, so some
different encodings are mapped to the same decoded value.

Sponsored-by: On-Waves ehf
diff --git a/src/pcu_l1_if.h b/src/pcu_l1_if.h
index 88c8399..59b9cba 100644
--- a/src/pcu_l1_if.h
+++ b/src/pcu_l1_if.h
@@ -37,16 +37,42 @@
  * L1 Measurement values
  */
 
+struct pcu_l1_meas_ts {
+	unsigned have_ms_i_level:1;
+
+	int16_t ms_i_level; /* I_LEVEL in dB */
+
+#ifdef __cplusplus
+	pcu_l1_meas_ts& set_ms_i_level(int16_t v) {
+		ms_i_level = v; have_ms_i_level = 1; return *this;
+	}
+
+	pcu_l1_meas_ts() :
+		have_ms_i_level(0)
+	{}
+#endif
+};
+
 struct pcu_l1_meas {
 	unsigned have_rssi:1;
 	unsigned have_ber:1;
 	unsigned have_bto:1;
 	unsigned have_link_qual:1;
+	unsigned have_ms_rx_qual:1;
+	unsigned have_ms_c_value:1;
+	unsigned have_ms_sign_var:1;
+	unsigned have_ms_i_level:1;
 
 	int8_t rssi; /* RSSI in dBm */
 	uint8_t ber; /* Bit error rate in % */
 	int16_t bto; /* Burst timing offset in quarter bits */
-	int16_t link_qual; /* Link quality in db */
+	int16_t link_qual; /* Link quality in dB */
+	int16_t ms_rx_qual; /* MS RXQUAL value in % */
+	int16_t ms_c_value; /* C value in dB */
+	int16_t ms_sign_var; /* SIGN_VAR in dB */
+
+	struct pcu_l1_meas_ts ts[8];
+
 #ifdef __cplusplus
 	pcu_l1_meas& set_rssi(int8_t v) { rssi = v; have_rssi = 1; return *this;}
 	pcu_l1_meas& set_ber(uint8_t v) { ber = v; have_ber = 1; return *this;}
@@ -54,11 +80,27 @@
 	pcu_l1_meas& set_link_qual(int16_t v) {
 		link_qual = v; have_link_qual = 1; return *this;
 	}
+	pcu_l1_meas& set_ms_rx_qual(int16_t v) {
+		ms_rx_qual = v; have_ms_rx_qual = 1; return *this;
+	}
+	pcu_l1_meas& set_ms_c_value(int16_t v) {
+		ms_c_value = v; have_ms_c_value = 1; return *this;
+	}
+	pcu_l1_meas& set_ms_sign_var(int16_t v) {
+		ms_sign_var = v; have_ms_sign_var = 1; return *this;
+	}
+	pcu_l1_meas& set_ms_i_level(size_t idx, int16_t v) {
+		ts[idx].set_ms_i_level(v); have_ms_i_level = 1; return *this;
+	}
 	pcu_l1_meas() :
 		have_rssi(0),
 		have_ber(0),
 		have_bto(0),
-		have_link_qual(0)
+		have_link_qual(0),
+		have_ms_rx_qual(0),
+		have_ms_c_value(0),
+		have_ms_sign_var(0),
+		have_ms_i_level(0)
 	{}
 #endif
 };