98 lines
2.6 KiB
Plaintext
98 lines
2.6 KiB
Plaintext
module TRXC_Types {
|
|
|
|
/* TRX Control protocol type definitions in TTCN-3
|
|
* (C) 2018 Harald Welte <laforge@gnumonks.org>
|
|
* All rights reserved.
|
|
*
|
|
* Released under the terms of GNU General Public License, Version 2 or
|
|
* (at your option) any later version.
|
|
*
|
|
* SPDX-License-Identifier: GPL-2.0-or-later
|
|
*/
|
|
|
|
import from Osmocom_Types all;
|
|
|
|
type charstring TrxcType ("CMD", "RSP", "IND") with {
|
|
variant "TEXT_CODING(,convert=upper_case,'((CMD)|(RSP)|(IND))',case_insensitive)"
|
|
}
|
|
|
|
type charstring TrxcVerb ("POWERON", "POWEROFF", "CLOCK",
|
|
"RXTUNE", "TXTUNE", "SETSLOT", "SETTSC", "SETBSIC", "SETPOWER",
|
|
"SETMAXDLY", "SETMAXDLYNB", "SETSLOT", "HANDOVER", "NOHANDOVER",
|
|
"MEASURE", "FAKE_RSSI", "FAKE_TOA", "FAKE_CI" ) with {
|
|
variant "TEXT_CODING(,convert=upper_case,
|
|
'((POWERON)|(POWEROFF)|(CLOCK)|(RXTUNE)|(TXTUNE)|(SETSLOT)|(SETTSC)|(SETBSIC)|(SETPOWER)|(SETMAXDLY)|(SETMAXDLYNB)|(HANDOVER)|(NOHANDOVER)|(MEASURE)|(FAKE_RSSI)|(FAKE_TOA)|(FAKE_CI))'
|
|
,case_insensitive)"
|
|
}
|
|
|
|
type integer TrxcStatus;
|
|
type charstring TrxcParam;
|
|
type record of TrxcParam TrxcParams with {
|
|
variant "SEPARATOR(' ', ' ')"
|
|
}
|
|
|
|
type record TrxcCommand {
|
|
TrxcVerb verb,
|
|
TrxcParams params optional
|
|
} with {
|
|
variant "SEPARATOR(' ', ' ')"
|
|
}
|
|
|
|
type record TrxcResponse {
|
|
TrxcVerb verb,
|
|
TrxcStatus status,
|
|
TrxcParams params optional
|
|
} with {
|
|
variant "SEPARATOR(' ', ' ')"
|
|
}
|
|
|
|
type record TrxcIndication {
|
|
TrxcVerb verb,
|
|
TrxcParams params optional
|
|
} with {
|
|
variant "SEPARATOR(' ', ' ')"
|
|
}
|
|
|
|
type union TrxcMessage {
|
|
TrxcCommand cmd,
|
|
TrxcResponse rsp,
|
|
TrxcIndication ind
|
|
} with {
|
|
variant (cmd) "BEGIN('CMD ')"
|
|
variant (rsp) "BEGIN('RSP ')"
|
|
variant (ind) "BEGIN('IND ')"
|
|
}
|
|
|
|
external function enc_TrxcMessage(in TrxcMessage id) return charstring
|
|
with { extension "prototype(convert) encode(TEXT)" };
|
|
external function dec_TrxcMessage(in charstring id) return TrxcMessage
|
|
with { extension "prototype(convert) decode(TEXT)" };
|
|
|
|
/* rxlev2dbm(0..63) gives us [-110..-47], plus -10 dbm for noise */
|
|
type integer TRXC_RSSI (-120..-47);
|
|
type integer TRXC_RSSI_THRESH (-120..120);
|
|
|
|
template (value) TrxcMessage ts_TRXC_FAKE_RSSI(TRXC_RSSI rssi, TRXC_RSSI_THRESH thresh := 0) := {
|
|
cmd := {
|
|
verb := "FAKE_RSSI",
|
|
params := { int2str(rssi), int2str(thresh) }
|
|
}
|
|
}
|
|
|
|
template (value) TrxcMessage ts_TRXC_FAKE_TIMING(int16_t timing, int16_t thresh := 0) := {
|
|
cmd := {
|
|
verb := "FAKE_TOA",
|
|
params := { int2str(timing), int2str(thresh) }
|
|
}
|
|
}
|
|
|
|
template (value) TrxcMessage ts_TRXC_FAKE_CI(int16_t ci, int16_t thresh := 0) := {
|
|
cmd := {
|
|
verb := "FAKE_CI",
|
|
params := { int2str(ci), int2str(thresh) }
|
|
}
|
|
}
|
|
|
|
|
|
} with { encode "TEXT" }
|