/
functions.fn
43 lines (41 loc) · 1.14 KB
/
functions.fn
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
!# functions.fn 1.3
!#
!# Dieses Script gibt eine Liste der Gewerke als JSON String aus
!#
!# 6'2013-7'2014 bluefox, hobbyquaker
!#
object oFunction;
string sFunctionId;
string sChannelId;
boolean bFirst = true;
boolean bFirstSecond = true;
Write("{");
foreach (sFunctionId, dom.GetObject(ID_FUNCTIONS).EnumUsedIDs()) {
if (bFirst == false) {
WriteLine(',');
} else {
bFirst = false;
}
oFunction = dom.GetObject(sFunctionId);
Write('"' # sFunctionId # '": ');
Write('{"Name": "');
WriteURL(oFunction.Name());
Write('","TypeName":"' # oFunction.TypeName() # '_FUNCTIONS');
Write('", "EnumInfo": "');
WriteURL(oFunction.EnumInfo());
Write('", "Channels": [');
bFirstSecond = true;
foreach(sChannelId, oFunction.EnumUsedIDs()) {
if (bFirstSecond == false) {
Write(',');
} else {
bFirstSecond = false;
}
string sIfaceId = dom.GetObject(sChannelId).Interface();
string sIface = dom.GetObject(sIfaceId).Name();
Write('{"Address":"' # dom.GetObject(sChannelId).Address() # '",');
Write('"Interface":"' # sIface # '"}');
}
Write(']}');
}
Write('}');