libiec61850  1.6.0
sv_publisher.h
Go to the documentation of this file.
1 /*
2  * sv_publisher.h
3  *
4  * Copyright 2016-2022 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 #include "r_session.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 
80 LIB61850_API SVPublisher
81 SVPublisher_create(CommParameters* parameters, const char* interfaceId);
82 
91 LIB61850_API SVPublisher
92 SVPublisher_createEx(CommParameters* parameters, const char* interfaceId, bool useVlanTag);
93 
102 LIB61850_API SVPublisher
103 SVPublisher_createRemote(RSession session, uint16_t appId);
104 
113 LIB61850_API SVPublisher_ASDU
114 SVPublisher_addASDU(SVPublisher self, const char* svID, const char* datset, uint32_t confRev);
115 
123 LIB61850_API void
125 
131 LIB61850_API void
133 
139 LIB61850_API void
141 
155 LIB61850_API void
157 
164 LIB61850_API int
166 
174 LIB61850_API void
175 SVPublisher_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value);
176 
183 LIB61850_API int
185 
193 LIB61850_API void
194 SVPublisher_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value);
195 
202 LIB61850_API int
204 
212 LIB61850_API void
213 SVPublisher_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value);
214 
221 LIB61850_API int
223 
231 LIB61850_API void
232 SVPublisher_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value);
233 
240 LIB61850_API int
242 
250 LIB61850_API void
251 SVPublisher_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value);
252 
259 LIB61850_API int
261 
269 LIB61850_API void
271 
280 LIB61850_API int
282 
290 LIB61850_API void
292 
299 LIB61850_API void
301 
307 LIB61850_API uint16_t
309 
319 LIB61850_API void
321 
329 LIB61850_API void
331 
339 LIB61850_API void
341 
348 LIB61850_API void
349 SVPublisher_ASDU_setRefrTmNs(SVPublisher_ASDU self, nsSinceEpoch refrTmNs);
350 
357 LIB61850_API void
358 SVPublisher_ASDU_setRefrTm(SVPublisher_ASDU self, msSinceEpoch refrTm);
359 
369 LIB61850_API void
371 
383 LIB61850_API void
385 
397 LIB61850_API void
399 
414 LIB61850_API void
416 
419 #ifndef DEPRECATED
420 #if defined(__GNUC__) || defined(__clang__)
421  #define DEPRECATED __attribute__((deprecated))
422 #else
423  #define DEPRECATED
424 #endif
425 #endif
426 
434 typedef struct sSVPublisher* SampledValuesPublisher;
435 
436 typedef struct sSV_ASDU* SV_ASDU;
437 
438 LIB61850_API DEPRECATED SVPublisher
439 SampledValuesPublisher_create(CommParameters* parameters, const char* interfaceId);
440 
441 LIB61850_API DEPRECATED SVPublisher_ASDU
442 SampledValuesPublisher_addASDU(SVPublisher self, char* svID, char* datset, uint32_t confRev);
443 
444 LIB61850_API DEPRECATED void
446 
447 LIB61850_API DEPRECATED void
449 
450 LIB61850_API DEPRECATED void
452 
453 LIB61850_API DEPRECATED void
455 
456 LIB61850_API DEPRECATED int
458 
459 LIB61850_API DEPRECATED void
460 SV_ASDU_setINT8(SVPublisher_ASDU self, int index, int8_t value);
461 
462 LIB61850_API DEPRECATED int
464 
465 LIB61850_API DEPRECATED void
466 SV_ASDU_setINT32(SVPublisher_ASDU self, int index, int32_t value);
467 
468 LIB61850_API DEPRECATED int
470 
471 LIB61850_API DEPRECATED void
472 SV_ASDU_setINT64(SVPublisher_ASDU self, int index, int64_t value);
473 
474 LIB61850_API DEPRECATED int
476 
477 LIB61850_API DEPRECATED void
478 SV_ASDU_setFLOAT(SVPublisher_ASDU self, int index, float value);
479 
480 LIB61850_API DEPRECATED int
482 
483 LIB61850_API DEPRECATED void
484 SV_ASDU_setFLOAT64(SVPublisher_ASDU self, int index, double value);
485 
486 LIB61850_API DEPRECATED void
487 SV_ASDU_setSmpCnt(SVPublisher_ASDU self, uint16_t value);
488 
489 LIB61850_API DEPRECATED uint16_t
491 
492 LIB61850_API DEPRECATED void
494 
495 LIB61850_API DEPRECATED void
496 SV_ASDU_setRefrTm(SVPublisher_ASDU self, uint64_t refrTm);
497 
498 LIB61850_API DEPRECATED void
499 SV_ASDU_setSmpMod(SVPublisher_ASDU self, uint8_t smpMod);
500 
501 LIB61850_API DEPRECATED void
502 SV_ASDU_setSmpRate(SVPublisher_ASDU self, uint16_t smpRate);
503 
506 #ifdef __cplusplus
507 }
508 #endif
509 
510 #endif /* LIBIEC61850_SRC_SAMPLED_VALUES_SV_PUBLISHER_H_ */
uint16_t Quality
Definition: iec61850_common.h:326
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.
uint16_t vlanId
Definition: sv_publisher.h:40
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:68
LIB61850_API void SVPublisher_publish(SVPublisher self)
Publish all registered ASDUs.
LIB61850_API void SVPublisher_setupComplete(SVPublisher self)
Prepare the publisher for publishing.
uint8_t vlanPriority
Definition: sv_publisher.h:39
LIB61850_API SVPublisher SVPublisher_createRemote(RSession session, uint16_t appId)
Create a new SVPublisher instance for R-SMV.
LIB61850_API SVPublisher SVPublisher_create(CommParameters *parameters, const char *interfaceId)
Create a new IEC61850-9-2 Sampled Values publisher.
uint16_t appId
Definition: sv_publisher.h:41
#define DEPRECATED
Definition: sv_publisher.h:423
struct sSVPublisher * SVPublisher
An opaque type representing an IEC 61850-9-2 Sampled Values publisher.
Definition: sv_publisher.h:63
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:436
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:434
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: sv_publisher.h:38
Definition: iec61850_common.h:417