libIEC61850  1.1.2
Open-source IEC 61850 MMS/GOOSE/SV server and client library
sv_subscriber.h
Go to the documentation of this file.
1 /*
2  * sv_subscriber_api.h
3  *
4  * Copyright 2015 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 SAMPLED_VALUES_SV_SUBSCRIBER_H_
25 #define SAMPLED_VALUES_SV_SUBSCRIBER_H_
26 
27 #include "libiec61850_common_api.h"
28 
29 #ifdef __cplusplus
30 extern "C" {
31 #endif
32 
93 typedef struct sSVClientASDU* SVClientASDU;
94 
102 typedef struct sSVSubscriber* SVSubscriber;
103 
113 typedef void (*SVUpdateListener)(SVSubscriber subscriber, void* parameter, SVClientASDU asdu);
114 
118 typedef struct sSVReceiver* SVReceiver;
119 
129 SVReceiver
130 SVReceiver_create(void);
131 
141 void
142 SVReceiver_disableDestAddrCheck(SVReceiver self);
143 
154 void
155 SVReceiver_setInterfaceId(SVReceiver self, const char* interfaceId);
156 
165 void
166 SVReceiver_addSubscriber(SVReceiver self, SVSubscriber subscriber);
167 
174 void
175 SVReceiver_removeSubscriber(SVReceiver self, SVSubscriber subscriber);
176 
184 void
185 SVReceiver_start(SVReceiver self);
186 
192 void
193 SVReceiver_stop(SVReceiver self);
194 
200 void
201 SVReceiver_destroy(SVReceiver self);
202 
203 /***************************************
204  * Functions for non-threaded operation
205  ***************************************/
206 
207 void
208 SVReceiver_startThreadless(SVReceiver self);
209 
210 void
211 SVReceiver_stopThreadless(SVReceiver self);
212 
213 bool
214 SVReceiver_tick(SVReceiver self);
215 
216 /*
217  * Subscriber
218  */
219 
220 SVSubscriber
221 SVSubscriber_create(const uint8_t* ethAddr, uint16_t appID);
222 
235 void
236 SVSubscriber_setListener(SVSubscriber self, SVUpdateListener listener, void* parameter);
237 
238 void
239 SVSubscriber_destroy(SVSubscriber self);
240 
241 /*************************************************************************
242  * SVClientASDU object methods
243  **************************************************************************/
244 
253 uint16_t
254 SVClientASDU_getSmpCnt(SVClientASDU self);
255 
261 const char*
262 SVClientASDU_getSvId(SVClientASDU self);
263 
269 uint32_t
270 SVClientASDU_getConfRev(SVClientASDU self);
271 
279 bool
280 SVClientASDU_hasRefrTm(SVClientASDU self);
281 
289 uint64_t
290 SVClientASDU_getRefrTmAsMs(SVClientASDU self);
291 
300 int8_t
301 SVClientASDU_getINT8(SVClientASDU self, int index);
302 
311 int16_t
312 SVClientASDU_getINT16(SVClientASDU self, int index);
313 
322 int32_t
323 SVClientASDU_getINT32(SVClientASDU self, int index);
324 
333 int64_t
334 SVClientASDU_getINT64(SVClientASDU self, int index);
335 
344 uint8_t
345 SVClientASDU_getINT8U(SVClientASDU self, int index);
346 
355 uint16_t
356 SVClientASDU_getINT16U(SVClientASDU self, int index);
357 
366 uint32_t
367 SVClientASDU_getINT32U(SVClientASDU self, int index);
368 
377 uint64_t
378 SVClientASDU_getINT64U(SVClientASDU self, int index);
379 
388 float
389 SVClientASDU_getFLOAT32(SVClientASDU self, int index);
390 
399 double
400 SVClientASDU_getFLOAT64(SVClientASDU self, int index);
401 
409 int
410 SVClientASDU_getDataSize(SVClientASDU self);
411 
414 #ifdef __cplusplus
415 }
416 #endif
417 
418 
419 #endif /* SAMPLED_VALUES_SV_SUBSCRIBER_ */
int16_t SVClientASDU_getINT16(SVClientASDU self, int index)
Get an INT16 data value in the data part of the ASDU.
int32_t SVClientASDU_getINT32(SVClientASDU self, int index)
Get an INT32 data value in the data part of the ASDU.
uint16_t SVClientASDU_getINT16U(SVClientASDU self, int index)
Get an INT16U data value in the data part of the ASDU.
uint16_t SVClientASDU_getSmpCnt(SVClientASDU self)
return the SmpCnt value included in the SV ASDU
bool SVReceiver_tick(SVReceiver self)
void SVSubscriber_destroy(SVSubscriber self)
uint64_t SVClientASDU_getRefrTmAsMs(SVClientASDU self)
Get the RefrTim value included in SV ASDU as ms timestamp.
void SVReceiver_removeSubscriber(SVReceiver self, SVSubscriber subscriber)
Disconnect subscriber and receiver.
int64_t SVClientASDU_getINT64(SVClientASDU self, int index)
Get an INT64 data value in the data part of the ASDU.
int8_t SVClientASDU_getINT8(SVClientASDU self, int index)
Get an INT8 data value in the data part of the ASDU.
uint32_t SVClientASDU_getINT32U(SVClientASDU self, int index)
Get an INT32U data value in the data part of the ASDU.
void SVReceiver_disableDestAddrCheck(SVReceiver self)
Disable check for destination address of the received SV messages.
const char * SVClientASDU_getSvId(SVClientASDU self)
return the SvID value included in the SV ASDU
void SVReceiver_destroy(SVReceiver self)
Destroy receiver instance (cleanup resources)
uint64_t SVClientASDU_getINT64U(SVClientASDU self, int index)
Get an INT64U data value in the data part of the ASDU.
void SVSubscriber_setListener(SVSubscriber self, SVUpdateListener listener, void *parameter)
Set a callback handler to process received SV messages.
struct sSVReceiver * SVReceiver
opaque handle to a SV receiver instance
Definition: sv_subscriber.h:118
uint8_t SVClientASDU_getINT8U(SVClientASDU self, int index)
Get an INT8U data value in the data part of the ASDU.
bool SVClientASDU_hasRefrTm(SVClientASDU self)
Check if RefrTm value is included in the SV ASDU.
void SVReceiver_stop(SVReceiver self)
Receiver stops listening for SV messages.
SVReceiver SVReceiver_create(void)
Create a new SV receiver instance.
struct sSVSubscriber * SVSubscriber
opaque handle to a SV subscriber instance
Definition: sv_subscriber.h:102
void SVReceiver_startThreadless(SVReceiver self)
double SVClientASDU_getFLOAT64(SVClientASDU self, int index)
Get an FLOAT64 data value in the data part of the ASDU.
int SVClientASDU_getDataSize(SVClientASDU self)
Returns the size of the data part of the ASDU.
void SVReceiver_start(SVReceiver self)
Receiver starts listening for SV messages.
void SVReceiver_setInterfaceId(SVReceiver self, const char *interfaceId)
Set the Ethernet interface ID for the receiver instance.
void(* SVUpdateListener)(SVSubscriber subscriber, void *parameter, SVClientASDU asdu)
Callback function for received SV messages.
Definition: sv_subscriber.h:113
SVSubscriber SVSubscriber_create(const uint8_t *ethAddr, uint16_t appID)
struct sSVClientASDU * SVClientASDU
opaque handle to a SV ASDU (Application service data unit) instance.
Definition: sv_subscriber.h:93
void SVReceiver_addSubscriber(SVReceiver self, SVSubscriber subscriber)
Add a subscriber instance to the receiver.
float SVClientASDU_getFLOAT32(SVClientASDU self, int index)
Get an FLOAT32 data value in the data part of the ASDU.
uint32_t SVClientASDU_getConfRev(SVClientASDU self)
return the ConfRev value included in the SV ASDU
void SVReceiver_stopThreadless(SVReceiver self)