From 2282741ef663abab3fca317496788590964c5074 Mon Sep 17 00:00:00 2001 From: Michael Zillgith Date: Fri, 29 Dec 2017 09:03:09 +0100 Subject: [PATCH] - updated GOOSE/SV example code --- examples/goose_publisher/goose_publisher_example.c | 10 +++++++++- examples/sv_publisher/sv_publisher_example.c | 5 +++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/examples/goose_publisher/goose_publisher_example.c b/examples/goose_publisher/goose_publisher_example.c index 916be700..7abf6f57 100644 --- a/examples/goose_publisher/goose_publisher_example.c +++ b/examples/goose_publisher/goose_publisher_example.c @@ -16,6 +16,14 @@ int main(int argc, char** argv) { + char* interface; + + if (argc > 1) + interface = argv[1]; + else + interface = "eth0"; + + printf("Using interface %s\n", interface); LinkedList dataSetValues = LinkedList_create(); @@ -41,7 +49,7 @@ main(int argc, char** argv) * is NULL the interface name as defined with CONFIG_ETHERNET_INTERFACE_ID in * stack_config.h is used. */ - GoosePublisher publisher = GoosePublisher_create(&gooseCommParameters, NULL); + GoosePublisher publisher = GoosePublisher_create(&gooseCommParameters, interface); GoosePublisher_setGoCbRef(publisher, "simpleIOGenericIO/LLN0$GO$gcbAnalogValues"); GoosePublisher_setConfRev(publisher, 1); diff --git a/examples/sv_publisher/sv_publisher_example.c b/examples/sv_publisher/sv_publisher_example.c index 280dfee1..1b589f40 100644 --- a/examples/sv_publisher/sv_publisher_example.c +++ b/examples/sv_publisher/sv_publisher_example.c @@ -46,12 +46,13 @@ main(int argc, char** argv) float fVal1 = 1234.5678f; float fVal2 = 0.12345f; - int i; - while (running) { SVPublisher_ASDU_setFLOAT(asdu1, float1, fVal1); SVPublisher_ASDU_setFLOAT(asdu1, float2, fVal2); + SVPublisher_ASDU_setFLOAT(asdu2, float3, fVal1 * 2); + SVPublisher_ASDU_setFLOAT(asdu2, float4, fVal2 * 2); + SVPublisher_ASDU_increaseSmpCnt(asdu1); SVPublisher_ASDU_increaseSmpCnt(asdu2);