-
Notifications
You must be signed in to change notification settings - Fork 0
/
bacnet_csml.h
171 lines (167 loc) · 4.77 KB
/
bacnet_csml.h
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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
#ifndef BACNET_CSML_H
#define BACNET_CSML_H
#include <stddef.h>
//#include "bacnet_asn.h"
/*! \defgroup _bacnet_csml
*/
#define CSML_TAGS \
TAG(Any),\
TAG(Array),\
TAG(Bit),\
TAG(BitString),\
TAG(Boolean),\
TAG(Choice),\
TAG(Choices),\
TAG(Collection),\
TAG(Comment),\
TAG(Composition),\
TAG(Date),\
TAG(DatePattern),\
TAG(DateTime),\
TAG(DateTimePattern),\
TAG(Definitions),\
TAG(Description),\
TAG(DisplayName),\
TAG(DisplayNameForWriting),\
TAG(Documentation),\
TAG(Double),\
TAG(Enumerated),\
TAG(ErrorText),\
TAG(Extensions),\
TAG(Failures),\
TAG(Includes),\
TAG(Integer),\
TAG(Link),\
TAG(Links),\
TAG(List),\
TAG(MemberTypeDefinition),\
TAG(NamedBits),\
TAG(NamedValues),\
TAG(Null),\
TAG(Object),\
TAG(ObjectIdentifier),\
TAG(ObjectIdentifierPattern),\
TAG(OctetString),\
TAG(PriorityArray),\
TAG(Raw),\
TAG(Real),\
TAG(RelinquishDefault),\
TAG(RequiredWhenText),\
TAG(Revisions),\
TAG(Sequence),\
TAG(SequenceOf),\
TAG(String),\
TAG(StringSet),\
TAG(TagDefinitions),\
TAG(Time),\
TAG(TimePattern),\
TAG(UnitsText),\
TAG(Unknown),\
TAG(Unsigned),\
TAG(Value),\
TAG(ValueTags),\
TAG(WeekNDay),\
TAG(WritableWhenText),
#define CSML_ATTRS \
ATTR(absent,ASN_TYPE_BOOLEAN),\
ATTR(associatedWith,ASN_TYPE_STRING),\
ATTR(authRead,ASN_TYPE_STRING),\
ATTR(authVisible,ASN_TYPE_BOOLEAN),\
ATTR(authWrite,ASN_TYPE_STRING),\
ATTR(base,ASN_TYPE_ENUMERATED),\
ATTR(bit,ASN_TYPE_UNSIGNED),\
ATTR(children,ASN_TYPE_STRING),/* StringSet */\
ATTR(choices,ASN_TYPE_STRING),\
ATTR(commandable,ASN_TYPE_BOOLEAN),\
ATTR(comment,ASN_TYPE_STRING),\
ATTR(contextTag,ASN_TYPE_UNSIGNED),\
ATTR(count,ASN_TYPE_UNSIGNED),\
ATTR(defaultLocale,ASN_TYPE_STRING),\
ATTR(descendants,ASN_TYPE_STRING),/* List of Link */\
ATTR(description,ASN_TYPE_STRING),\
ATTR(displayName,ASN_TYPE_STRING),\
ATTR(displayNameForWriting,ASN_TYPE_STRING),\
ATTR(documentation,ASN_TYPE_STRING),\
ATTR(error,ASN_TYPE_UNSIGNED),\
ATTR(errorText,ASN_TYPE_STRING),\
ATTR(etag,ASN_TYPE_STRING),\
ATTR(extends,ASN_TYPE_STRING),\
ATTR(failures,ASN_TYPE_STRING),/* List of Link */\
ATTR(fault,ASN_TYPE_BOOLEAN),\
ATTR(history,ASN_TYPE_STRING),/* List of Sequence */\
ATTR(href,ASN_TYPE_STRING),\
ATTR(id,ASN_TYPE_STRING),\
ATTR(inAlarm,ASN_TYPE_BOOLEAN),\
ATTR(isMultiLine,ASN_TYPE_BOOLEAN),\
ATTR(length,ASN_TYPE_UNSIGNED),\
ATTR(links,ASN_TYPE_STRING),/* Collection of Link */\
ATTR(locale,ASN_TYPE_STRING),\
ATTR(maximum,ASN_TYPE_STRING),\
ATTR(maximumForWriting,ASN_TYPE_STRING),\
ATTR(mediaType,ASN_TYPE_STRING),\
ATTR(memberType,ASN_TYPE_STRING),\
ATTR(memberTypeDefinition,ASN_TYPE_STRING),\
ATTR(minimum,ASN_TYPE_STRING),\
ATTR(minimumForWriting,ASN_TYPE_STRING),\
ATTR(name,ASN_TYPE_STRING),\
ATTR(namedBits,ASN_TYPE_STRING),\
ATTR(namedValues,ASN_TYPE_STRING),\
ATTR(nodeSubtype,ASN_TYPE_STRING),\
ATTR(nodeType,ASN_TYPE_ENUMERATED),\
ATTR(notForReading,ASN_TYPE_BOOLEAN),\
ATTR(notForWriting,ASN_TYPE_BOOLEAN),\
ATTR(notPresentWith,ASN_TYPE_STRING),\
ATTR(objectType,ASN_TYPE_STRING),\
ATTR(optional,ASN_TYPE_BOOLEAN),\
ATTR(outOfService,ASN_TYPE_BOOLEAN),\
ATTR(overlays,ASN_TYPE_STRING),\
ATTR(overridden,ASN_TYPE_BOOLEAN),\
ATTR(priorityArray,ASN_TYPE_STRING),/* Array of Choice */\
ATTR(propertyIdentifier,ASN_TYPE_UNSIGNED),\
ATTR(readable,ASN_TYPE_BOOLEAN),\
ATTR(relationship,ASN_TYPE_ENUMERATED),\
ATTR(relinquishDefault,ASN_TYPE_STRING),\
ATTR(requiredWhen,ASN_TYPE_STRING),\
ATTR(requiredWhenText,ASN_TYPE_STRING),\
ATTR(requiredWith,ASN_TYPE_STRING), /* StringSet */\
ATTR(requiredWithout,ASN_TYPE_STRING),/* StringSet */\
ATTR(resolution,ASN_TYPE_STRING),\
ATTR(revisions,ASN_TYPE_STRING),\
ATTR(sourceId,ASN_TYPE_STRING),\
ATTR(tags,ASN_TYPE_STRING),/* StringSet */\
ATTR(target,ASN_TYPE_STRING),\
ATTR(targetType,ASN_TYPE_STRING),\
ATTR(type,ASN_TYPE_STRING),\
ATTR(units,ASN_TYPE_ENUMERATED),\
ATTR(unitsText,ASN_TYPE_STRING),\
ATTR(unspecifiedValue,ASN_TYPE_BOOLEAN),\
ATTR(value,ASN_TYPE_STRING),\
ATTR(valueTags,ASN_TYPE_STRING),/* List of Any */\
ATTR(variability,ASN_TYPE_ENUMERATED),\
ATTR(virtual,ASN_TYPE_BOOLEAN),\
ATTR(volatility,ASN_TYPE_ENUMERATED),\
ATTR(writable,ASN_TYPE_BOOLEAN),\
ATTR(writableWhen,ASN_TYPE_STRING),\
ATTR(writableWhenText,ASN_TYPE_STRING),\
ATTR(writeEffective,ASN_TYPE_ENUMERATED), \
ATTR(xmlns,ASN_TYPE_STRING), \
#define TAG(name) CSML_TAG_##name
enum _CSML_TAGS {// перечисление атрибутов,
_CSML_TAGS_NULL =0,// этот не используется
CSML_TAGS
CSML_TAGS_COUNT
};
#undef TAG
#define ATTR(name,t) CSML_ATTR_##name
enum _CSML_ATTRS {// перечисление атрибутов,
_CSML_ATTR_NULL =0,// этот не используется
CSML_ATTRS
CSML_ATTRS_COUNT
};
#undef ATTR
typedef struct _Node Node_t;
Node_t* csml_parse(char *buf, size_t length);
void csml_debug(Node_t* node);
void csml_free(Node_t* node);
BACnetValue* csml_attr(Node_t* node, uint32_t attr_id);
#endif // BACNET_CSML_H