blob: c12e5d2afc1d7b2e4113e4e7c86b3f6dfdd36cb6 [file] [log] [blame]
Harald Welte7f26f552018-02-23 09:38:15 +01001module TRXC_Types {
2
3import from Osmocom_Types all;
4
5type charstring TrxcType ("CMD", "RSP", "IND") with {
6 variant "TEXT_CODING(,convert=upper_case,'((CMD)|(RSP)|(IND))',case_insensitive)"
7}
8
9type charstring TrxcVerb ("POWERON", "POWEROFF", "CLOCK",
10 "RXTUNE", "TXTUNE", "SETSLOT", "SETTSC", "SETBSIC", "SETPOWER",
11 "SETMAXDLY", "SETMAXDLYNB", "SETSLOT", "HANDOVER", "NOHANDOVER",
12 "MEASURE", "FAKE_RSSI", "FAKE_TIMING" ) with {
13 variant "TEXT_CODING(,convert=upper_case,
14 '((POWERON)|(POWEROFF)|(CLOCK)|(RXTUNE)|(TXTUNE)|(SETSLOT)|(SETTSC)|(SETBSIC)|(SETPOWER)|(SETMAXDLY)|(SETMAXDLYNB)|(HANDOVER)|(NOHANDOVER)|(MEASURE)|(FAKE_RSSI)|(FAKE_TIMING))'
15 ,case_insensitive)"
16}
17
18type integer TrxcStatus;
19type charstring TrxcParam;
20type record of TrxcParam TrxcParams;
21
22type record TrxcCommand {
23 TrxcVerb verb,
24 TrxcParams params optional
25} with {
26 variant "SEPARATOR(' ', ' ')"
27}
28
29type record TrxcResponse {
30 TrxcVerb verb,
31 TrxcStatus status,
32 TrxcParams params optional
33} with {
34 variant "SEPARATOR(' ', ' ')"
35}
36
37type record TrxcIndication {
38 TrxcVerb verb,
39 TrxcParams params optional
40} with {
41 variant "SEPARATOR(' ', ' ')"
42}
43
44type union TrxcMessage {
45 TrxcCommand cmd,
46 TrxcResponse rsp,
47 TrxcIndication ind
48} with {
49 variant (cmd) "BEGIN('CMD ')"
50 variant (rsp) "BEGIN('RSP ')"
51 variant (ind) "BEGIN('IND ')"
52}
53
54external function enc_TrxcMessage(in TrxcMessage id) return charstring
55 with { extension "prototype(convert) encode(TEXT)" };
56external function dec_TrxcMessage(in charstring id) return TrxcMessage
57 with { extension "prototype(convert) decode(TEXT)" };
58
59template (value) TrxcMessage ts_TRXC_FAKE_RSSI(uint8_t rssi) := {
60 cmd := {
61 verb := "FAKE_RSSI",
62 params := { int2str(rssi) }
63 }
64}
65
66template (value) TrxcMessage ts_TRXC_FAKE_TIMING(int16_t timing) := {
67 cmd := {
68 verb := "FAKE_TIMING",
69 params := { int2str(timing) }
70 }
71}
72
73
74} with { encode "TEXT" }