libiec61850  1.2.0
sv_publisher.h
Go to the documentation of this file.
1 /*
2  * sv_publisher.h
3  *
4  * Copyright 2016 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 
25 #ifndef LIBIEC61850_SRC_SAMPLED_VALUES_SV_PUBLISHER_H_
26 #define LIBIEC61850_SRC_SAMPLED_VALUES_SV_PUBLISHER_H_
27 
28 #include "libiec61850_platform_includes.h"
29 #include "iec61850_common.h"
30 
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
34 
35 #ifndef GOOSE_SV_COMM_PARAMETERS
36 #define GOOSE_SV_COMM_PARAMETERS
37 
38 typedef struct sCommParameters {
39  uint8_t vlanPriority;
40  uint16_t vlanId;
41  uint16_t appId;
42  uint8_t dstAddress[6];
44 
45 #endif
46 
52 #define IEC61850_SV_SMPSYNC_NOT_SYNCHRONIZED 0
53 #define IEC61850_SV_SMPSYNC_SYNCED_UNSPEC_LOCAL_CLOCK 1
54 #define IEC61850_SV_SMPSYNC_SYNCED_GLOBAL_CLOCK 2
55 
56 #define IEC61850_SV_SMPMOD_PER_NOMINAL_PERIOD 0
57 #define IEC61850_SV_SMPMOD_SAMPLES_PER_SECOND 1
58 #define IEC61850_SV_SMPMOD_SECONDS_PER_SAMPLE 2
59 
63 typedef struct sSVPublisher* SVPublisher;
64 
68 typedef struct sSVPublisher_ASDU* SVPublisher_ASDU;
69 
77 SVPublisher
78 SVPublisher_create(CommParameters* parameters, const char* interfaceId);
79 
88 SVPublisher_ASDU
89 SVPublisher_addASDU(SVPublisher self, const char* svID, const char* datset, uint32_t confRev);
90 
98 void
99 SVPublisher_setupComplete(SVPublisher self);
100 
106 void
107 SVPublisher_publish(SVPublisher self);
108 
114 void
115 SVPublisher_destroy(SVPublisher self);
116 
130 void
131 SVPublisher_ASDU_resetBuffer(SVPublisher_ASDU self);
132 
139 int
140 SVPublisher_ASDU_addINT8(SVPublisher_ASDU self);
141 
149 void
150 SVPublisher_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value);
151 
158 int
159 SVPublisher_ASDU_addINT32(SVPublisher_ASDU self);
160 
168 void
169 SVPublisher_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value);
170 
177 int
178 SVPublisher_ASDU_addINT64(SVPublisher_ASDU self);
179 
187 void
188 SVPublisher_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value);
189 
196 int
197 SVPublisher_ASDU_addFLOAT(SVPublisher_ASDU self);
198 
206 void
207 SVPublisher_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value);
208 
215 int
216 SVPublisher_ASDU_addFLOAT64(SVPublisher_ASDU self);
217 
225 void
226 SVPublisher_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value);
227 
234 int
235 SVPublisher_ASDU_addTimestamp(SVPublisher_ASDU self);
236 
244 void
245 SVPublisher_ASDU_setTimestamp(SVPublisher_ASDU self, int index, Timestamp value);
246 
255 int
256 SVPublisher_ASDU_addQuality(SVPublisher_ASDU self);
257 
265 void
266 SVPublisher_ASDU_setQuality(SVPublisher_ASDU self, int index, Quality value);
267 
274 void
275 SVPublisher_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value);
276 
282 uint16_t
283 SVPublisher_ASDU_getSmpCnt(SVPublisher_ASDU self);
284 
294 void
295 SVPublisher_ASDU_increaseSmpCnt(SVPublisher_ASDU self);
296 
302 void
303 SVPublisher_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm);
304 
314 void
315 SVPublisher_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod);
316 
326 void
327 SVPublisher_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate);
328 
331 #ifndef DEPRECATED
332 #if defined(__GNUC__) || defined(__clang__)
333  #define DEPRECATED __attribute__((deprecated))
334 #else
335  #define DEPRECATED
336 #endif
337 #endif
338 
346 typedef struct sSVPublisher* SampledValuesPublisher;
347 
348 typedef struct sSV_ASDU* SV_ASDU;
349 
350 DEPRECATED SVPublisher
351 SampledValuesPublisher_create(CommParameters* parameters, const char* interfaceId);
352 
353 DEPRECATED SVPublisher_ASDU
354 SampledValuesPublisher_addASDU(SVPublisher self, char* svID, char* datset, uint32_t confRev);
355 
356 DEPRECATED void
357 SampledValuesPublisher_setupComplete(SVPublisher self);
358 
359 DEPRECATED void
360 SampledValuesPublisher_publish(SVPublisher self);
361 
362 DEPRECATED void
363 SampledValuesPublisher_destroy(SVPublisher self);
364 
365 DEPRECATED void
366 SV_ASDU_resetBuffer(SVPublisher_ASDU self);
367 
368 DEPRECATED int
369 SV_ASDU_addINT8(SVPublisher_ASDU self);
370 
371 DEPRECATED void
372 SV_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value);
373 
374 DEPRECATED int
375 SV_ASDU_addINT32(SVPublisher_ASDU self);
376 
377 DEPRECATED void
378 SV_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value);
379 
380 DEPRECATED int
381 SV_ASDU_addINT64(SVPublisher_ASDU self);
382 
383 DEPRECATED void
384 SV_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value);
385 
386 DEPRECATED int
387 SV_ASDU_addFLOAT(SVPublisher_ASDU self);
388 
389 DEPRECATED void
390 SV_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value);
391 
392 DEPRECATED int
393 SV_ASDU_addFLOAT64(SVPublisher_ASDU self);
394 
395 DEPRECATED void
396 SV_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value);
397 
398 void DEPRECATED
399 SV_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value);
400 
401 DEPRECATED uint16_t
402 SV_ASDU_getSmpCnt(SVPublisher_ASDU self);
403 
404 DEPRECATED void
405 SV_ASDU_increaseSmpCnt(SVPublisher_ASDU self);
406 
407 DEPRECATED void
408 SV_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm);
409 
410 DEPRECATED void
411 SV_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod);
412 
413 DEPRECATED void
414 SV_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate);
415 
418 #ifdef __cplusplus
419 }
420 #endif
421 
422 #endif /* LIBIEC61850_SRC_SAMPLED_VALUES_SV_PUBLISHER_H_ */
DEPRECATED void SV_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm)
DEPRECATED void SV_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value)
struct sSVPublisher_ASDU * SVPublisher_ASDU
An opaque type representing an IEC 61850-9-2 Sampled Values Application Service Data Unit (ASDU)...
Definition: sv_publisher.h:68
struct sSVPublisher * SampledValuesPublisher
Definition: sv_publisher.h:346
void SVPublisher_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value)
Set the value of a 8-bit integer in the ASDU.
DEPRECATED uint16_t SV_ASDU_getSmpCnt(SVPublisher_ASDU self)
SVPublisher_ASDU SVPublisher_addASDU(SVPublisher self, const char *svID, const char *datset, uint32_t confRev)
Create an Application Service Data Unit (ASDU) and add it to an existing Sampled Values publisher...
void DEPRECATED SV_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value)
uint16_t Quality
Definition: iec61850_common.h:266
DEPRECATED int SV_ASDU_addINT32(SVPublisher_ASDU self)
void SVPublisher_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value)
Set the value of a single precision floating point number in the ASDU.
uint16_t SVPublisher_ASDU_getSmpCnt(SVPublisher_ASDU self)
Get the sample count attribute of the ASDU.
void SVPublisher_publish(SVPublisher self)
Publish all registered ASDUs.
void SVPublisher_ASDU_resetBuffer(SVPublisher_ASDU self)
Reset the internal data buffer of an ASDU.
int SVPublisher_ASDU_addFLOAT(SVPublisher_ASDU self)
Reserve memory for a single precision floating point number in the ASDU.
DEPRECATED void SV_ASDU_increaseSmpCnt(SVPublisher_ASDU self)
void SVPublisher_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod)
Set the sample mode attribute of the ASDU.
int SVPublisher_ASDU_addFLOAT64(SVPublisher_ASDU self)
Reserve memory for a double precision floating point number in the ASDU.
Definition: iec61850_common.h:352
SVPublisher SVPublisher_create(CommParameters *parameters, const char *interfaceId)
Create a new IEC61850-9-2 Sampled Values publisher.
#define DEPRECATED
Definition: sv_publisher.h:335
DEPRECATED int SV_ASDU_addINT8(SVPublisher_ASDU self)
int SVPublisher_ASDU_addINT64(SVPublisher_ASDU self)
Reserve memory for a signed 64-bit integer in the ASDU.
DEPRECATED void SV_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value)
struct sSVPublisher * SVPublisher
An opaque type representing an IEC 61850-9-2 Sampled Values publisher.
Definition: sv_publisher.h:63
DEPRECATED void SV_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate)
void SVPublisher_setupComplete(SVPublisher self)
Prepare the publisher for publishing.
uint16_t appId
Definition: sv_publisher.h:41
DEPRECATED void SV_ASDU_resetBuffer(SVPublisher_ASDU self)
DEPRECATED int SV_ASDU_addFLOAT64(SVPublisher_ASDU self)
int SVPublisher_ASDU_addQuality(SVPublisher_ASDU self)
Reserve memory for a quality value in the ASDU.
void SVPublisher_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value)
Set the sample count attribute of the ASDU.
DEPRECATED int SV_ASDU_addINT64(SVPublisher_ASDU self)
void SVPublisher_ASDU_setQuality(SVPublisher_ASDU self, int index, Quality value)
Set the value of a quality attribute in the ASDU.
DEPRECATED void SampledValuesPublisher_setupComplete(SVPublisher self)
DEPRECATED int SV_ASDU_addFLOAT(SVPublisher_ASDU self)
DEPRECATED void SampledValuesPublisher_destroy(SVPublisher self)
DEPRECATED void SV_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value)
int SVPublisher_ASDU_addINT8(SVPublisher_ASDU self)
Reserve memory for a signed 8-bit integer in the ASDU.
void SVPublisher_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value)
Set the value of a double precision floating pointer number in the ASDU.
int SVPublisher_ASDU_addINT32(SVPublisher_ASDU self)
Reserve memory for a signed 32-bit integer in the ASDU.
struct sSV_ASDU * SV_ASDU
Definition: sv_publisher.h:348
void SVPublisher_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value)
Set the value of a 32-bit integer in the ASDU.
DEPRECATED void SampledValuesPublisher_publish(SVPublisher self)
int SVPublisher_ASDU_addTimestamp(SVPublisher_ASDU self)
Reserve memory for a 64 bit time stamp in the ASDU.
void SVPublisher_destroy(SVPublisher self)
Destroy an IEC61850-9-2 Sampled Values instance.
uint8_t vlanPriority
Definition: sv_publisher.h:39
DEPRECATED void SV_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value)
void SVPublisher_ASDU_setTimestamp(SVPublisher_ASDU self, int index, Timestamp value)
Set the value of a 64 bit time stamp in the ASDU.
void SVPublisher_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate)
Set the sample rate attribute of the ASDU.
Definition: sv_publisher.h:38
DEPRECATED SVPublisher_ASDU SampledValuesPublisher_addASDU(SVPublisher self, char *svID, char *datset, uint32_t confRev)
DEPRECATED void SV_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value)
DEPRECATED SVPublisher SampledValuesPublisher_create(CommParameters *parameters, const char *interfaceId)
void SVPublisher_ASDU_increaseSmpCnt(SVPublisher_ASDU self)
Increment the sample count attribute of the ASDU.
void SVPublisher_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm)
Set the refresh time attribute of the ASDU.
uint16_t vlanId
Definition: sv_publisher.h:40
void SVPublisher_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value)
Set the value of a 64-bit integer in the ASDU.
DEPRECATED void SV_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod)