Helper functions in GSM_Tyes and Osmocom_Types
Change-Id: Ibd8f215a7cd4564126503c3552bbcceb6d31c779
diff --git a/library/GSM_Types.ttcn b/library/GSM_Types.ttcn
index 5884c27..b86bfd7 100644
--- a/library/GSM_Types.ttcn
+++ b/library/GSM_Types.ttcn
@@ -247,5 +247,10 @@
return GSM51_MFRAMES_PER_SEC * int2float(bs_ag_blks_res);
}
+/* compute TC as per 45.002 6.3.1.3 */
+function f_gsm_compute_tc(integer fn) return integer {
+ return (fn / 51) mod 8;
+}
+
} with { encode "RAW"; variant "FIELDORDER(msb)" }
diff --git a/library/Osmocom_Types.ttcn b/library/Osmocom_Types.ttcn
index 713acc9..a6d5c82 100644
--- a/library/Osmocom_Types.ttcn
+++ b/library/Osmocom_Types.ttcn
@@ -99,5 +99,24 @@
self.stop;
}
+type record of integer IntegerRecord;
+
+function int2bool(integer int) return boolean {
+ if (int != 0) {
+ return true;
+ } else {
+ return false;
+ }
+}
+
+function f_array_contains(IntegerRecord arr, integer key) return boolean {
+ for (var integer i:= 0; i< sizeof(arr); i := i + 1) {
+ if (arr[i] == key) {
+ return true;
+ }
+ }
+ return false;
+}
+
} with { encode "RAW"; variant "FIELDORDER(msb)" }