libIEC61850  0.8.3
Open-source IEC 61850 MMS/GOOSE server and client library
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Groups Pages
iec61850_common.h
Go to the documentation of this file.
1 /*
2  * iec61850_common.h
3  *
4  * Copyright 2013 Michael Zillgith
5  *
6  * This file is part of libIEC61850.
7  *
8  * libIEC61850 is free software: you can redistribute it and/or modify
9  * it under the terms of the GNU General Public License as published by
10  * the Free Software Foundation, either version 3 of the License, or
11  * (at your option) any later version.
12  *
13  * libIEC61850 is distributed in the hope that it will be useful,
14  * but WITHOUT ANY WARRANTY; without even the implied warranty of
15  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16  * GNU General Public License for more details.
17  *
18  * You should have received a copy of the GNU General Public License
19  * along with libIEC61850. If not, see <http://www.gnu.org/licenses/>.
20  *
21  * See COPYING file for the complete license text.
22  */
23 
24 #ifndef IEC61850_COMMON_H_
25 #define IEC61850_COMMON_H_
26 
27 #ifdef __cplusplus
28 extern "C" {
29 #endif
30 
31 
32 #include "libiec61850_common_api.h"
33 
46 #define TRG_OPT_DATA_CHANGED 1
47 
49 #define TRG_OPT_QUALITY_CHANGED 2
50 
52 #define TRG_OPT_DATA_UPDATE 4
53 
55 #define TRG_OPT_INTEGRITY 8
56 
58 #define TRG_OPT_GI 16
59 
68 #define RPT_OPT_SEQ_NUM 1
69 
71 #define RPT_OPT_TIME_STAMP 2
72 
74 #define RPT_OPT_REASON_FOR_INCLUSION 4
75 
77 #define RPT_OPT_DATA_SET 8
78 
80 #define RPT_OPT_DATA_REFERENCE 16
81 
83 #define RPT_OPT_BUFFER_OVERFLOW 32
84 
86 #define RPT_OPT_ENTRY_ID 64
87 
89 #define RPT_OPT_CONF_REV 128
90 
99 #define CONTROL_ORCAT_NOT_SUPPORTED 0
100 
102 #define CONTROL_ORCAT_BAY_CONTROL 1
103 
105 #define CONTROL_ORCAT_STATION_CONTROL 2
106 
108 #define CONTROL_ORCAT_REMOTE_CONTROL 3
109 
111 #define CONTROL_ORCAT_AUTOMATIC_BAY 4
112 
114 #define CONTROL_ORCAT_AUTOMATIC_STATION 5
115 
117 #define CONTROL_ORCAT_AUTOMATIC_REMOTE 6
118 
120 #define CONTROL_ORCAT_MAINTENANCE 7
121 
123 #define CONTROL_ORCAT_PROCESS 8
124 
134 typedef enum {
164 
174 typedef enum eFunctionalConstraint {
176  ST = 0,
178  MX = 1,
180  SP = 2,
182  SV = 3,
184  CF = 4,
186  DC = 5,
188  SG = 6,
190  SE = 7,
192  SR = 8,
194  OR = 9,
196  BL = 10,
198  EX = 11,
200  CO = 12,
201  ALL = 99,
202  NONE = -1
204 
208 char*
210 
215 FunctionalConstraint_fromString(char* fcString);
216 
226 typedef uint16_t Quality;
227 typedef uint16_t Validity;
228 
229 #define QUALITY_VALIDITY_GOOD 0
230 #define QUALITY_VALIDITY_INVALID 2
231 #define QUALITY_VALIDITY_RESERVED 1
232 #define QUALITY_VALIDITY_QUESTIONABLE 3
233 
234 #define QUALITY_DETAIL_OVERFLOW 4
235 #define QUALITY_DETAIL_OUT_OF_RANGE 8
236 #define QUALITY_DETAIL_BAD_REFERENCE 16
237 #define QUALITY_DETAIL_OSCILLATORY 32
238 #define QUALITY_DETAIL_FAILURE 64
239 #define QUALITY_DETAIL_OLD_DATA 128
240 #define QUALITY_DETAIL_INCONSISTENT 256
241 #define QUALITY_DETAIL_INACCURATE 512
242 
243 #define QUALITY_SOURCE_SUBSTITUTED 1024
244 
245 #define QUALITY_TEST 2048
246 
247 #define QUALITY_OPERATOR_BLOCKED 4096
248 
249 Validity
250 Quality_getValidity(Quality* self);
251 
252 void
253 Quality_setValidity(Quality* self, Validity validity);
254 
255 void
256 Quality_setFlag(Quality* self, int flag);
257 
258 void
259 Quality_unsetFlag(Quality* self, int flag);
260 
261 bool
262 Quality_isFlagSet(Quality* self, int flag);
263 
264 Quality
265 Quality_fromMmsValue(MmsValue* mmsValue);
266 
275 typedef enum {
278  DBPOS_ON = 2,
280 } Dbpos;
281 
282 
290 Dbpos
291 Dbpos_fromMmsValue(MmsValue* mmsValue);
292 
301 MmsValue*
302 Dbpos_toMmsValue(MmsValue* mmsValue, Dbpos dbpos);
303 
312 typedef union {
313  uint8_t val[8];
314 } Timestamp;
315 
316 uint32_t
318 
319 uint64_t
321 
322 bool
324 
325 void
326 Timestamp_setLeapSecondKnown(Timestamp* self, bool value);
327 
328 bool
330 
331 void
332 Timestamp_setClockFailure(Timestamp* self, bool value);
333 
334 bool
336 
337 void
339 
340 int
342 
348 void
349 Timestamp_setSubsecondPrecision(Timestamp* self, int subsecondPrecision);
350 
351 void
352 Timestamp_setTimeInSeconds(Timestamp* self, uint32_t secondsSinceEpoch);
353 
354 void
355 Timestamp_setTimeInMilliseconds(Timestamp* self, uint64_t millisSinceEpoch);
356 
362 char*
364 
365 
370 #ifdef __cplusplus
371 }
372 #endif
373 
374 #endif /* IEC61850_COMMON_H_ */