summaryrefslogtreecommitdiffstats
path: root/library/TRXC_Types.ttcn
blob: 77666d97f016c7cd0bbe2adddd1d6e703597a84e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
module TRXC_Types {

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" ) 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))'
			,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)" };

template (value) TrxcMessage ts_TRXC_FAKE_RSSI(uint8_t rssi, int16_t 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) }
	}
}


} with { encode "TEXT" }