- sampled values - WIP
parent
ae3ddfd89c
commit
a4730069ff
@ -0,0 +1,17 @@
|
|||||||
|
|
||||||
|
set(iec61850_sv_client_example_SRCS
|
||||||
|
sv_client_example.c
|
||||||
|
)
|
||||||
|
|
||||||
|
IF(WIN32)
|
||||||
|
set_source_files_properties(${iec61850_sv_client_example_SRCS}
|
||||||
|
PROPERTIES LANGUAGE CXX)
|
||||||
|
ENDIF(WIN32)
|
||||||
|
|
||||||
|
add_executable(iec61850_sv_client_example
|
||||||
|
${iec61850_sv_client_example_SRCS}
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(iec61850_sv_client_example
|
||||||
|
iec61850
|
||||||
|
)
|
@ -0,0 +1,17 @@
|
|||||||
|
LIBIEC_HOME=../..
|
||||||
|
|
||||||
|
PROJECT_BINARY_NAME = sv_client_example
|
||||||
|
PROJECT_SOURCES = sv_client_example.c
|
||||||
|
|
||||||
|
include $(LIBIEC_HOME)/make/target_system.mk
|
||||||
|
include $(LIBIEC_HOME)/make/stack_includes.mk
|
||||||
|
|
||||||
|
all: $(PROJECT_BINARY_NAME)
|
||||||
|
|
||||||
|
include $(LIBIEC_HOME)/make/common_targets.mk
|
||||||
|
|
||||||
|
$(PROJECT_BINARY_NAME): $(PROJECT_SOURCES) $(LIB_NAME)
|
||||||
|
$(CC) $(CFLAGS) $(LDFLAGS) -o $(PROJECT_BINARY_NAME) $(PROJECT_SOURCES) $(INCLUDES) $(LIB_NAME) $(LDLIBS)
|
||||||
|
|
||||||
|
clean:
|
||||||
|
rm -f $(PROJECT_BINARY_NAME)
|
@ -0,0 +1,74 @@
|
|||||||
|
/*
|
||||||
|
* sv_client_example.c
|
||||||
|
*
|
||||||
|
* This example is intended to show how SV control blocks are accessed
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "iec61850_client.h"
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
|
||||||
|
#include "hal_thread.h"
|
||||||
|
|
||||||
|
|
||||||
|
int main(int argc, char** argv) {
|
||||||
|
|
||||||
|
char* hostname;
|
||||||
|
int tcpPort = 102;
|
||||||
|
|
||||||
|
if (argc > 1)
|
||||||
|
hostname = argv[1];
|
||||||
|
else
|
||||||
|
hostname = "localhost";
|
||||||
|
|
||||||
|
if (argc > 2)
|
||||||
|
tcpPort = atoi(argv[2]);
|
||||||
|
|
||||||
|
IedClientError error;
|
||||||
|
|
||||||
|
IedConnection con = IedConnection_create();
|
||||||
|
|
||||||
|
IedConnection_connect(con, &error, hostname, tcpPort);
|
||||||
|
|
||||||
|
if (error == IED_ERROR_OK) {
|
||||||
|
|
||||||
|
char* svcbRef = "simpleIOGenericIO/LLN0.Volt";
|
||||||
|
|
||||||
|
ClientSVControlBlock svcb = ClientSVControlBlock_create(con, svcbRef);
|
||||||
|
|
||||||
|
if (svcb != NULL) {
|
||||||
|
if (ClientSVControlBlock_isMulticast(svcb))
|
||||||
|
printf("SVCB is multicast\n");
|
||||||
|
else
|
||||||
|
printf("SVCB is unicast\n");
|
||||||
|
|
||||||
|
if (ClientSVControlBlock_setSvEna(svcb, true))
|
||||||
|
printf("SVCB enabled\n");
|
||||||
|
else
|
||||||
|
printf("Failed to enable SVCB\n");
|
||||||
|
|
||||||
|
printf("SvEna state: %i\n", ClientSVControlBlock_getSvEna(svcb));
|
||||||
|
|
||||||
|
char* msvID = ClientSVControlBlock_getMsvID(svcb);
|
||||||
|
|
||||||
|
if (msvID != NULL) {
|
||||||
|
printf("MsvID: %s\n", msvID);
|
||||||
|
free(msvID);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("SVCB %s does not exist on server!\n", svcbRef);
|
||||||
|
}
|
||||||
|
|
||||||
|
IedConnection_close(con);
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
printf("Failed to connect to %s:%i\n", hostname, tcpPort);
|
||||||
|
}
|
||||||
|
|
||||||
|
IedConnection_destroy(con);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue