libIEC61850  1.0.1
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 
92 typedef struct sSVClientASDU* SVClientASDU;
93 
101 typedef struct sSVSubscriber* SVSubscriber;
102 
112 typedef void (*SVUpdateListener)(SVSubscriber subscriber, void* parameter, SVClientASDU asdu);
113 
117 typedef struct sSVReceiver* SVReceiver;
118 
128 SVReceiver
129 SVReceiver_create(void);
130 
140 void
141 SVReceiver_disableDestAddrCheck(SVReceiver self);
142 
153 void
154 SVReceiver_setInterfaceId(SVReceiver self, const char* interfaceId);
155 
164 void
165 SVReceiver_addSubscriber(SVReceiver self, SVSubscriber subscriber);
166 
173 void
174 SVReceiver_removeSubscriber(SVReceiver self, SVSubscriber subscriber);
175 
183 void
184 SVReceiver_start(SVReceiver self);
185 
191 void
192 SVReceiver_stop(SVReceiver self);
193 
199 void
200 SVReceiver_destroy(SVReceiver self);
201 
202 /***************************************
203  * Functions for non-threaded operation
204  ***************************************/
205 
206 void
207 SVReceiver_startThreadless(SVReceiver self);
208 
209 void
210 SVReceiver_stopThreadless(SVReceiver self);
211 
212 bool
213 SVReceiver_tick(SVReceiver self);
214 
215 /*
216  * Subscriber
217  */
218 
219 SVSubscriber
220 SVSubscriber_create(const uint8_t* ethAddr, uint16_t appID);
221 
234 void
235 SVSubscriber_setListener(SVSubscriber self, SVUpdateListener listener, void* parameter);
236 
237 void
238 SVSubscriber_destroy(SVSubscriber self);
239 
240 /*************************************************************************
241  * SVClientASDU object methods
242  **************************************************************************/
243 
252 uint16_t
253 SVClientASDU_getSmpCnt(SVClientASDU self);
254 
260 const char*
261 SVClientASDU_getSvId(SVClientASDU self);
262 
268 uint32_t
269 SVClientASDU_getConfRev(SVClientASDU self);
270 
279 int8_t
280 SVClientASDU_getINT8(SVClientASDU self, int index);
281 
290 int16_t
291 SVClientASDU_getINT16(SVClientASDU self, int index);
292 
301 int32_t
302 SVClientASDU_getINT32(SVClientASDU self, int index);
303 
312 uint8_t
313 SVClientASDU_getINT8U(SVClientASDU self, int index);
314 
323 uint16_t
324 SVClientASDU_getINT16U(SVClientASDU self, int index);
325 
334 uint32_t
335 SVClientASDU_getINT32U(SVClientASDU self, int index);
336 
345 float
346 SVClientASDU_getFLOAT32(SVClientASDU self, int index);
347 
356 double
357 SVClientASDU_getFLOAT64(SVClientASDU self, int index);
358 
366 int
367 SVClientASDU_getDataSize(SVClientASDU self);
368 
371 #ifdef __cplusplus
372 }
373 #endif
374 
375 
376 #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)
void SVReceiver_removeSubscriber(SVReceiver self, SVSubscriber subscriber)
Disconnect subscriber and receiver.
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)
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:117
uint8_t SVClientASDU_getINT8U(SVClientASDU self, int index)
Get an INT8U data value in the data part of the 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:101
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:112
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:92
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)