|
|
|
@ -45,8 +45,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
IedConnection_connect(con, &error, hostname, tcpPort);
|
|
|
|
|
|
|
|
|
|
if (error == IED_ERROR_OK) {
|
|
|
|
|
|
|
|
|
|
if (error == IED_ERROR_OK)
|
|
|
|
|
{
|
|
|
|
|
MmsValue* ctlVal = NULL;
|
|
|
|
|
MmsValue* stVal = NULL;
|
|
|
|
|
|
|
|
|
|
/************************
|
|
|
|
|
* Direct control
|
|
|
|
@ -55,7 +57,9 @@ int main(int argc, char** argv) {
|
|
|
|
|
ControlObjectClient control
|
|
|
|
|
= ControlObjectClient_create("simpleIOGenericIO/GGIO1.SPCSO1", con);
|
|
|
|
|
|
|
|
|
|
MmsValue* ctlVal = MmsValue_newBoolean(true);
|
|
|
|
|
if (control)
|
|
|
|
|
{
|
|
|
|
|
ctlVal = MmsValue_newBoolean(true);
|
|
|
|
|
|
|
|
|
|
ControlObjectClient_setOrigin(control, NULL, 3);
|
|
|
|
|
|
|
|
|
@ -72,7 +76,7 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
/* Check if status value has changed */
|
|
|
|
|
|
|
|
|
|
MmsValue* stVal = IedConnection_readObject(con, &error, "simpleIOGenericIO/GGIO1.SPCSO1.stVal", IEC61850_FC_ST);
|
|
|
|
|
stVal = IedConnection_readObject(con, &error, "simpleIOGenericIO/GGIO1.SPCSO1.stVal", IEC61850_FC_ST);
|
|
|
|
|
|
|
|
|
|
if (error == IED_ERROR_OK) {
|
|
|
|
|
bool state = MmsValue_getBoolean(stVal);
|
|
|
|
@ -84,6 +88,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
printf("Reading status for simpleIOGenericIO/GGIO1.SPCSO1 failed!\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Control object simpleIOGenericIO/GGIO1.SPCSO1 not found in server\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/************************
|
|
|
|
|
* Select before operate
|
|
|
|
@ -91,6 +99,8 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
control = ControlObjectClient_create("simpleIOGenericIO/GGIO1.SPCSO2", con);
|
|
|
|
|
|
|
|
|
|
if (control)
|
|
|
|
|
{
|
|
|
|
|
if (ControlObjectClient_select(control)) {
|
|
|
|
|
|
|
|
|
|
ctlVal = MmsValue_newBoolean(true);
|
|
|
|
@ -109,7 +119,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
ControlObjectClient_destroy(control);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Control object simpleIOGenericIO/GGIO1.SPCSO2 not found in server\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/****************************************
|
|
|
|
|
* Direct control with enhanced security
|
|
|
|
@ -117,6 +130,8 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
control = ControlObjectClient_create("simpleIOGenericIO/GGIO1.SPCSO3", con);
|
|
|
|
|
|
|
|
|
|
if (control)
|
|
|
|
|
{
|
|
|
|
|
ControlObjectClient_setCommandTerminationHandler(control, commandTerminationHandler, NULL);
|
|
|
|
|
|
|
|
|
|
ctlVal = MmsValue_newBoolean(true);
|
|
|
|
@ -149,6 +164,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
else {
|
|
|
|
|
printf("Reading status for simpleIOGenericIO/GGIO1.SPCSO3 failed!\n");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Control object simpleIOGenericIO/GGIO1.SPCSO3 not found in server\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/***********************************************
|
|
|
|
|
* Select before operate with enhanced security
|
|
|
|
@ -156,6 +175,8 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
control = ControlObjectClient_create("simpleIOGenericIO/GGIO1.SPCSO4", con);
|
|
|
|
|
|
|
|
|
|
if (control)
|
|
|
|
|
{
|
|
|
|
|
ControlObjectClient_setCommandTerminationHandler(control, commandTerminationHandler, NULL);
|
|
|
|
|
|
|
|
|
|
ctlVal = MmsValue_newBoolean(true);
|
|
|
|
@ -180,7 +201,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
Thread_sleep(1000);
|
|
|
|
|
|
|
|
|
|
ControlObjectClient_destroy(control);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Control object simpleIOGenericIO/GGIO1.SPCSO4 not found in server\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/*********************************************************************
|
|
|
|
|
* Direct control with enhanced security (expect CommandTermination-)
|
|
|
|
@ -188,6 +212,8 @@ int main(int argc, char** argv) {
|
|
|
|
|
|
|
|
|
|
control = ControlObjectClient_create("simpleIOGenericIO/GGIO1.SPCSO9", con);
|
|
|
|
|
|
|
|
|
|
if (control)
|
|
|
|
|
{
|
|
|
|
|
ControlObjectClient_setCommandTerminationHandler(control, commandTerminationHandler, NULL);
|
|
|
|
|
|
|
|
|
|
ctlVal = MmsValue_newBoolean(true);
|
|
|
|
@ -205,7 +231,10 @@ int main(int argc, char** argv) {
|
|
|
|
|
Thread_sleep(1000);
|
|
|
|
|
|
|
|
|
|
ControlObjectClient_destroy(control);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
printf("Control object simpleIOGenericIO/GGIO1.SPCSO9 not found in server\n");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
IedConnection_close(con);
|
|
|
|
|
}
|
|
|
|
|