- renamed RSession_startlistening to RSession_start to indicate that it is also required for the publisher side

- updates R-GOOSE and R-SMV publisher examples with RSession_start call to bind to an UDP port/interface
v1.6_develop_rgoose_sntp
Michael Zillgith 2 years ago
parent 9b12a7e5bd
commit 885c3176a8

@ -40,6 +40,8 @@ main(int argc, char **argv)
signal(SIGINT, sigint_handler); signal(SIGINT, sigint_handler);
/* Call RSession_setLocalAddress to use a particular interface to send the R-GOOSE messages */
//RSession_setLocalAddress(rSession, "169.254.110.126", -1);
RSession_setRemoteAddress(rSession, dstAddress, 102); RSession_setRemoteAddress(rSession, dstAddress, 102);
LinkedList dataSetValues = LinkedList_create(); LinkedList dataSetValues = LinkedList_create();
@ -67,6 +69,8 @@ main(int argc, char **argv)
GoosePublisher_setDataSetRef(publisher, "simpleIOGenericIO/LLN0$AnalogValues"); GoosePublisher_setDataSetRef(publisher, "simpleIOGenericIO/LLN0$AnalogValues");
GoosePublisher_setTimeAllowedToLive(publisher, 500); GoosePublisher_setTimeAllowedToLive(publisher, 500);
RSession_start(rSession);
while (running) { while (running) {
int i = 0; int i = 0;

@ -23,8 +23,8 @@ main(int argc, char** argv)
if (rSession) { if (rSession) {
//RSession_setRemoteAddress(sessionP, "192.168.56.101", 102); /* Call RSession_setLocalAddress to use a particular interface to send the R-GOOSE messages */
//RSession_setRemoteAddress(rSession, "192.168.2.227", 102); //RSession_setLocalAddress(rSession, "169.254.110.126", -1);
RSession_setRemoteAddress(rSession, "230.0.10.10", 102); RSession_setRemoteAddress(rSession, "230.0.10.10", 102);
SVPublisher svPublisher = SVPublisher_createRemote(rSession, 0x4000); SVPublisher svPublisher = SVPublisher_createRemote(rSession, 0x4000);
@ -61,6 +61,8 @@ main(int argc, char** argv)
float fVal1 = 1234.5678f; float fVal1 = 1234.5678f;
float fVal2 = 0.12345f; float fVal2 = 0.12345f;
RSession_start(rSession);
while (running) { while (running) {
Timestamp ts; Timestamp ts;
Timestamp_clearFlags(&ts); Timestamp_clearFlags(&ts);

@ -1185,7 +1185,7 @@ GooseReceiver_startThreadless(GooseReceiver self)
{ {
#if (CONFIG_IEC61850_R_GOOSE == 1) #if (CONFIG_IEC61850_R_GOOSE == 1)
if (self->session) { if (self->session) {
if (RSession_startListening(self->session) == R_SESSION_ERROR_OK) { if (RSession_start(self->session) == R_SESSION_ERROR_OK) {
self->running = true; self->running = true;
return (EthernetSocket)1; return (EthernetSocket)1;

@ -232,7 +232,7 @@ RSession_setRemoteAddress(RSession self, const char* remoteAddress, int remotePo
} }
RSessionError RSessionError
RSession_startListening(RSession self) RSession_start(RSession self)
{ {
if (self->socket) { if (self->socket) {
@ -254,7 +254,7 @@ RSession_startListening(RSession self)
} }
RSessionError RSessionError
RSession_stopListening(RSession self) RSession_stop(RSession self)
{ {
Semaphore_wait(self->socketLock); Semaphore_wait(self->socketLock);

@ -150,24 +150,24 @@ LIB61850_API RSessionError
RSession_setRemoteAddress(RSession self, const char* remoteAddress, int remotePort); RSession_setRemoteAddress(RSession self, const char* remoteAddress, int remotePort);
/** /**
* \brief Start listening on the local UDP port to receive remote messages (only for subscriber) * \brief Start sending and receiving messages (bind to a local UDP port/interface)
* *
* \param self the RSession instance * \param self the RSession instance
* *
* \return R_SESSION_ERROR_OK on success, error code otherwise * \return R_SESSION_ERROR_OK on success, error code otherwise
*/ */
LIB61850_API RSessionError LIB61850_API RSessionError
RSession_startListening(RSession self); RSession_start(RSession self);
/** /**
* \brief Stop listening on the local UDP port (only for subscriber) * \brief Stop sending and receiving messages.
* *
* \param self the RSession instance * \param self the RSession instance
* *
* \return R_SESSION_ERROR_OK on success, error code otherwise * \return R_SESSION_ERROR_OK on success, error code otherwise
*/ */
LIB61850_API RSessionError LIB61850_API RSessionError
RSession_stopListening(RSession self); RSession_stop(RSession self);
/** /**
* \brief Manually add a key to the RSession instance * \brief Manually add a key to the RSession instance

@ -312,7 +312,7 @@ SVReceiver_startThreadless(SVReceiver self)
{ {
#if (CONFIG_IEC61850_R_SMV == 1) #if (CONFIG_IEC61850_R_SMV == 1)
if (self->session) { if (self->session) {
if (RSession_startListening(self->session) == R_SESSION_ERROR_OK) { if (RSession_start(self->session) == R_SESSION_ERROR_OK) {
self->running = true; self->running = true;
return true; return true;
@ -352,7 +352,7 @@ SVReceiver_stopThreadless(SVReceiver self)
#if (CONFIG_IEC61850_R_SMV == 1) #if (CONFIG_IEC61850_R_SMV == 1)
if (self->session) { if (self->session) {
RSession_stopListening(self->session); RSession_stop(self->session);
} }
#endif /* (CONFIG_IEC61850_R_SMV == 1) */ #endif /* (CONFIG_IEC61850_R_SMV == 1) */

Loading…
Cancel
Save