diff options
author | Harald Welte <laforge@gnumonks.org> | 2019-08-01 09:54:40 +0200 |
---|---|---|
committer | laforge <laforge@osmocom.org> | 2021-02-22 10:41:29 +0000 |
commit | 08332307eac13ae2049d3e8135b34401ad69334e (patch) | |
tree | be503887be7d508aa8490a0f92de934f7bb04e7c /library/CBSP_Types.ttcn | |
parent | 205b537f6f2daf0fc3848a0e19fdd3518139e4cd (diff) |
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
Diffstat (limited to 'library/CBSP_Types.ttcn')
-rw-r--r-- | library/CBSP_Types.ttcn | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/library/CBSP_Types.ttcn b/library/CBSP_Types.ttcn index c4c6cf25..5ab3c98b 100644 --- a/library/CBSP_Types.ttcn +++ b/library/CBSP_Types.ttcn @@ -378,5 +378,24 @@ external function enc_CBSP_PDU(in CBSP_PDU msg) return octetstring 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)" } |