BTS: refactor f_si3_has_gprs_indicator(): use SI3RestOctets

Change-Id: I2dc970d3d34a7d70c6845558544259e387f1d6fc
Signed-off-by: Vadim Yanitskiy <axilirator@gmail.com>
diff --git a/bts/BTS_Tests.ttcn b/bts/BTS_Tests.ttcn
index 794d604..7191a7d 100644
--- a/bts/BTS_Tests.ttcn
+++ b/bts/BTS_Tests.ttcn
@@ -29,6 +29,7 @@
 import from GSM_RR_Types all;
 import from Osmocom_Types all;
 import from GSM_Types all;
+import from GSM_RestOctets all;
 import from GSM_SystemInformation all;
 import from L1CTL_PortType all;
 import from L1CTL_Types all;
@@ -4904,65 +4905,9 @@
 	return si.payload.si3;
 }
 
-/* CSN.1 L/H logic: is the bit at the current position using "inverted logic" (true) or not? */
-private function f_bitpos_is_inv(integer idx) return boolean {
-	select (idx mod 8) {
-	case ((2, 4, 6, 7)) { return true; } /* 1-bits of 0x2B */
-	case else { return false; } /* 0-bits of 0x2B */
-	}
-}
-/* determine if the bit at position 'idx' in 'str' is a CSN.1 'H' (true) or 'L' (false) */
-private function f_bit_is_high(bitstring str, integer idx) return boolean {
-	var boolean invert := f_bitpos_is_inv(idx);
-	if (invert) {
-		if (str[idx] == '1'B) {
-			return false;
-		} else {
-			return true;
-		}
-	} else {
-		if (str[idx] == '1'B) {
-			return true;
-		} else {
-			return false;
-		}
-	}
-}
-/* As the TITAN RAW codec cannot expres the CSN.1 L/H concept yet, we have to do this
-   manually.  Let's hope https://www.eclipse.org/forums/index.php/t/1099087/ takes off and
-   we can replace this piece of code soon ... */
-private function f_si3_has_gprs_indicator(OCT4 si3_restoctets) return boolean {
-	var bitstring bits := oct2bit(si3_restoctets);
-	var integer idx := 0;
-
-	if (f_bit_is_high(bits, idx)) {
-		/* skip Optional selection parameters */
-		idx := idx + 16;
-	} else {
-		idx := idx + 1;
-	}
-
-	if (f_bit_is_high(bits, idx)) {
-		/* skip Optional power offset */
-		idx := idx + 3;
-	} else {
-		idx := idx + 1;
-	}
-
-	/* skip SI2ter Indicator */
-	idx := idx + 1;
-
-	/* skip Early CM Sending Control */
-	idx := idx + 1;
-
-	/* skip Scheduling if and where */
-	if (f_bit_is_high(bits, idx)) {
-		idx := idx + 4;
-	} else {
-		idx := idx + 1;
-	}
-
-	return f_bit_is_high(bits, idx);
+private function f_si3_has_gprs_indicator(RestOctets ro) return boolean {
+	var SI3RestOctets rest := dec_SI3RestOctets(ro);
+	return rest.gprs_ind.presence == '1'B;
 }
 
 testcase TC_pcu_socket_noconnect_nosi3gprs() runs on test_CT {