cbc: Initial set of CBC tess for osmo-cbc
osmo-cbc is the Osmocom cell broadcast centre. So far, there was no
TTCN-3 test suite. Let's change that.
Change-Id: I38286e8a3dd0f39bd25f631dcbb3ff4f8d4c221f
diff --git a/library/CBSP_Types.ttcn b/library/CBSP_Types.ttcn
index c4c6cf2..5ab3c98 100644
--- a/library/CBSP_Types.ttcn
+++ b/library/CBSP_Types.ttcn
@@ -378,5 +378,24 @@
external function dec_CBSP_PDU(in octetstring msg) return CBSP_PDU
with { extension "prototype(convert) decode(RAW)" };
+/* convert from warning period encoding to seconds */
+function f_cbsp_period2s(uint8_t period) return integer
+{
+ if (period == 0) {
+ return -1; /* infinite */
+ } else if (period <= 10) {
+ return period;
+ } else if (period <= 20) {
+ return 10 + (period - 10)*2;
+ } else if (period <= 38) {
+ return 30 + (period - 20)*5;
+ } else if (period <= 86) {
+ return 120 + (period - 38)*10;
+ } else if (period <= 186) {
+ return 600 + (period - 86)*30;
+ } else {
+ return 0;
+ }
+}
} with { encode "RAW"; variant "FIELDORDER(msb)" }