libiec61850  1.5.3
sv_publisher.h
Go to the documentation of this file.
1 /*
2  * sv_publisher.h
3  *
4  * Copyright 2016-2018 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 "iec61850_common.h"
29 
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33 
34 #ifndef GOOSE_SV_COMM_PARAMETERS
35 #define GOOSE_SV_COMM_PARAMETERS
36 
37 typedef struct sCommParameters {
38  uint8_t vlanPriority;
39  uint16_t vlanId;
40  uint16_t appId;
41  uint8_t dstAddress[6];
43 
44 #endif
45 
51 #define IEC61850_SV_SMPSYNC_NOT_SYNCHRONIZED 0
52 #define IEC61850_SV_SMPSYNC_SYNCED_UNSPEC_LOCAL_CLOCK 1
53 #define IEC61850_SV_SMPSYNC_SYNCED_GLOBAL_CLOCK 2
54 
55 #define IEC61850_SV_SMPMOD_PER_NOMINAL_PERIOD 0
56 #define IEC61850_SV_SMPMOD_SAMPLES_PER_SECOND 1
57 #define IEC61850_SV_SMPMOD_SECONDS_PER_SAMPLE 2
58 
62 typedef struct sSVPublisher* SVPublisher;
63 
67 typedef struct sSVPublisher_ASDU* SVPublisher_ASDU;
68 
79 LIB61850_API SVPublisher
80 SVPublisher_create(CommParameters* parameters, const char* interfaceId);
81 
90 LIB61850_API SVPublisher
91 SVPublisher_createEx(CommParameters* parameters, const char* interfaceId, bool useVlanTag);
92 
101 LIB61850_API SVPublisher_ASDU
102 SVPublisher_addASDU(SVPublisher self, const char* svID, const char* datset, uint32_t confRev);
103 
111 LIB61850_API void
113 
119 LIB61850_API void
121 
127 LIB61850_API void
129 
143 LIB61850_API void
145 
152 LIB61850_API int
154 
162 LIB61850_API void
163 SVPublisher_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value);
164 
171 LIB61850_API int
173 
181 LIB61850_API void
182 SVPublisher_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value);
183 
190 LIB61850_API int
192 
200 LIB61850_API void
201 SVPublisher_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value);
202 
209 LIB61850_API int
211 
219 LIB61850_API void
220 SVPublisher_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value);
221 
228 LIB61850_API int
230 
238 LIB61850_API void
239 SVPublisher_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value);
240 
247 LIB61850_API int
249 
257 LIB61850_API void
259 
268 LIB61850_API int
270 
278 LIB61850_API void
280 
287 LIB61850_API void
289 
295 LIB61850_API uint16_t
297 
307 LIB61850_API void
309 
317 LIB61850_API void
319 
327 LIB61850_API void
329 
336 LIB61850_API void
337 SVPublisher_ASDU_setRefrTmNs(SVPublisher_ASDU self, nsSinceEpoch refrTmNs);
338 
345 LIB61850_API void
346 SVPublisher_ASDU_setRefrTm(SVPublisher_ASDU self, msSinceEpoch refrTm);
347 
357 LIB61850_API void
359 
371 LIB61850_API void
373 
385 LIB61850_API void
387 
402 LIB61850_API void
404 
407 #ifndef DEPRECATED
408 #if defined(__GNUC__) || defined(__clang__)
409  #define DEPRECATED __attribute__((deprecated))
410 #else
411  #define DEPRECATED
412 #endif
413 #endif
414 
422 typedef struct sSVPublisher* SampledValuesPublisher;
423 
424 typedef struct sSV_ASDU* SV_ASDU;
425 
426 LIB61850_API DEPRECATED SVPublisher
427 SampledValuesPublisher_create(CommParameters* parameters, const char* interfaceId);
428 
429 LIB61850_API DEPRECATED SVPublisher_ASDU
430 SampledValuesPublisher_addASDU(SVPublisher self, char* svID, char* datset, uint32_t confRev);
431 
432 LIB61850_API DEPRECATED void
434 
435 LIB61850_API DEPRECATED void
437 
438 LIB61850_API DEPRECATED void
440 
441 LIB61850_API DEPRECATED void
443 
444 LIB61850_API DEPRECATED int
446 
447 LIB61850_API DEPRECATED void
448 SV_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value);
449 
450 LIB61850_API DEPRECATED int
452 
453 LIB61850_API DEPRECATED void
454 SV_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value);
455 
456 LIB61850_API DEPRECATED int
458 
459 LIB61850_API DEPRECATED void
460 SV_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value);
461 
462 LIB61850_API DEPRECATED int
464 
465 LIB61850_API DEPRECATED void
466 SV_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value);
467 
468 LIB61850_API DEPRECATED int
470 
471 LIB61850_API DEPRECATED void
472 SV_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value);
473 
474 LIB61850_API DEPRECATED void
475 SV_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value);
476 
477 LIB61850_API DEPRECATED uint16_t
479 
480 LIB61850_API DEPRECATED void
482 
483 LIB61850_API DEPRECATED void
484 SV_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm);
485 
486 LIB61850_API DEPRECATED void
487 SV_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod);
488 
489 LIB61850_API DEPRECATED void
490 SV_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate);
491 
494 #ifdef __cplusplus
495 }
496 #endif
497 
498 #endif /* LIBIEC61850_SRC_SAMPLED_VALUES_SV_PUBLISHER_H_ */
uint16_t Quality
Definition: iec61850_common.h:330
LIB61850_API 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.
LIB61850_API SVPublisher SVPublisher_createEx(CommParameters *parameters, const char *interfaceId, bool useVlanTag)
Create a new IEC61850-9-2 Sampled Values publisher.
LIB61850_API void SVPublisher_destroy(SVPublisher self)
Destroy an IEC61850-9-2 Sampled Values instance.
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:67
LIB61850_API void SVPublisher_publish(SVPublisher self)
Publish all registered ASDUs.
LIB61850_API void SVPublisher_setupComplete(SVPublisher self)
Prepare the publisher for publishing.
LIB61850_API SVPublisher SVPublisher_create(CommParameters *parameters, const char *interfaceId)
Create a new IEC61850-9-2 Sampled Values publisher.
#define DEPRECATED
Definition: sv_publisher.h:411
struct sSVPublisher * SVPublisher
An opaque type representing an IEC 61850-9-2 Sampled Values publisher.
Definition: sv_publisher.h:62
LIB61850_API int SVPublisher_ASDU_addINT64(SVPublisher_ASDU self)
Reserve memory for a signed 64-bit integer in the ASDU.
LIB61850_API void SVPublisher_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value)
Set the value of a 32-bit integer in the ASDU.
LIB61850_API void SVPublisher_ASDU_enableRefrTm(SVPublisher_ASDU self)
Enables the transmission of refresh time attribute of the ASDU.
LIB61850_API void SVPublisher_ASDU_setSmpCntWrap(SVPublisher_ASDU self, uint16_t value)
Set the roll-over (wrap) limit for the sample counter. When reaching the limit the sample counter wil...
LIB61850_API void SVPublisher_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate)
Set the sample rate attribute of the ASDU.
LIB61850_API uint16_t SVPublisher_ASDU_getSmpCnt(SVPublisher_ASDU self)
Get the sample count attribute of the ASDU.
LIB61850_API void SVPublisher_ASDU_increaseSmpCnt(SVPublisher_ASDU self)
Increment the sample count attribute of the ASDU.
LIB61850_API int SVPublisher_ASDU_addTimestamp(SVPublisher_ASDU self)
Reserve memory for a 64 bit time stamp in the ASDU.
LIB61850_API int SVPublisher_ASDU_addINT8(SVPublisher_ASDU self)
Reserve memory for a signed 8-bit integer in the ASDU.
LIB61850_API int SVPublisher_ASDU_addFLOAT(SVPublisher_ASDU self)
Reserve memory for a single precision floating point number in the ASDU.
LIB61850_API void SVPublisher_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod)
Set the sample mode attribute of the ASDU.
LIB61850_API void SVPublisher_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value)
Set the value of a 8-bit integer in the ASDU.
LIB61850_API void SVPublisher_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value)
Set the value of a 64-bit integer in the ASDU.
LIB61850_API void SVPublisher_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value)
Set the sample count attribute of the ASDU.
LIB61850_API void SVPublisher_ASDU_resetBuffer(SVPublisher_ASDU self)
Reset the internal data buffer of an ASDU.
LIB61850_API void SVPublisher_ASDU_setTimestamp(SVPublisher_ASDU self, int index, Timestamp value)
Set the value of a 64 bit time stamp in the ASDU.
LIB61850_API int SVPublisher_ASDU_addFLOAT64(SVPublisher_ASDU self)
Reserve memory for a double precision floating point number in the ASDU.
LIB61850_API int SVPublisher_ASDU_addQuality(SVPublisher_ASDU self)
Reserve memory for a quality value in the ASDU.
LIB61850_API void SVPublisher_ASDU_setRefrTm(SVPublisher_ASDU self, msSinceEpoch refrTm)
Set the refresh time attribute of the ASDU with millisecond resolution.
LIB61850_API int SVPublisher_ASDU_addINT32(SVPublisher_ASDU self)
Reserve memory for a signed 32-bit integer in the ASDU.
LIB61850_API void SVPublisher_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value)
Set the value of a single precision floating point number in the ASDU.
LIB61850_API void SVPublisher_ASDU_setRefrTmByTimestamp(SVPublisher_ASDU self, Timestamp *refrTm)
Set the refresh time attribute of the ASDU.
LIB61850_API void SVPublisher_ASDU_setQuality(SVPublisher_ASDU self, int index, Quality value)
Set the value of a quality attribute in the ASDU.
LIB61850_API void SVPublisher_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value)
Set the value of a double precision floating pointer number in the ASDU.
LIB61850_API void SVPublisher_ASDU_setSmpSynch(SVPublisher_ASDU self, uint16_t smpSynch)
Set the clock synchronization information.
LIB61850_API void SVPublisher_ASDU_setRefrTmNs(SVPublisher_ASDU self, nsSinceEpoch refrTmNs)
Set the refresh time attribute of the ASDU with nanosecond resolution.
LIB61850_API DEPRECATED void SV_ASDU_resetBuffer(SVPublisher_ASDU self)
LIB61850_API DEPRECATED void SampledValuesPublisher_publish(SVPublisher self)
LIB61850_API DEPRECATED int SV_ASDU_addINT64(SVPublisher_ASDU self)
LIB61850_API DEPRECATED void SV_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value)
LIB61850_API DEPRECATED int SV_ASDU_addINT8(SVPublisher_ASDU self)
LIB61850_API DEPRECATED void SV_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value)
LIB61850_API DEPRECATED int SV_ASDU_addFLOAT64(SVPublisher_ASDU self)
LIB61850_API DEPRECATED void SampledValuesPublisher_setupComplete(SVPublisher self)
LIB61850_API DEPRECATED void SV_ASDU_increaseSmpCnt(SVPublisher_ASDU self)
struct sSV_ASDU * SV_ASDU
Definition: sv_publisher.h:424
LIB61850_API DEPRECATED void SV_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value)
LIB61850_API DEPRECATED void SV_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate)
LIB61850_API DEPRECATED int SV_ASDU_addFLOAT(SVPublisher_ASDU self)
LIB61850_API DEPRECATED SVPublisher_ASDU SampledValuesPublisher_addASDU(SVPublisher self, char *svID, char *datset, uint32_t confRev)
LIB61850_API DEPRECATED int SV_ASDU_addINT32(SVPublisher_ASDU self)
LIB61850_API DEPRECATED SVPublisher SampledValuesPublisher_create(CommParameters *parameters, const char *interfaceId)
struct sSVPublisher * SampledValuesPublisher
Definition: sv_publisher.h:422
LIB61850_API DEPRECATED void SV_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value)
LIB61850_API DEPRECATED uint16_t SV_ASDU_getSmpCnt(SVPublisher_ASDU self)
LIB61850_API DEPRECATED void SampledValuesPublisher_destroy(SVPublisher self)
LIB61850_API DEPRECATED void SV_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod)
LIB61850_API DEPRECATED void SV_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value)
LIB61850_API DEPRECATED void SV_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value)
LIB61850_API DEPRECATED void SV_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm)
Definition: goose_publisher.h:43
Definition: iec61850_common.h:421