- added error handling code to client_example_log.c

- fixed bug in ClientSVControlBlock
pull/179/head
Michael Zillgith 7 years ago
parent 0cddcb7d12
commit 26a45a078b

@ -72,7 +72,9 @@ int main(int argc, char** argv) {
LinkedList logs = IedConnection_getLogicalNodeDirectory(con, &error, "simpleIOGenericIO/LLN0", ACSI_CLASS_LOG); LinkedList logs = IedConnection_getLogicalNodeDirectory(con, &error, "simpleIOGenericIO/LLN0", ACSI_CLASS_LOG);
if (error == IED_ERROR_OK) { if (error == IED_ERROR_OK) {
printf("Found log in LN simpleIOGenericIO/LLN0:\n");
if (LinkedList_size(logs) > 0) {
printf("Found logs in LN simpleIOGenericIO/LLN0:\n");
LinkedList log = LinkedList_getNext(logs); LinkedList log = LinkedList_getNext(logs);
@ -83,6 +85,10 @@ int main(int argc, char** argv) {
log = LinkedList_getNext(log); log = LinkedList_getNext(log);
} }
}
else {
printf("No logs found\n");
}
LinkedList_destroy(logs); LinkedList_destroy(logs);
} }
@ -90,7 +96,7 @@ int main(int argc, char** argv) {
/* read log control block (using the generic read function) */ /* read log control block (using the generic read function) */
MmsValue* lcbValue = IedConnection_readObject(con, &error, "simpleIOGenericIO/LLN0.EventLog", IEC61850_FC_LG); MmsValue* lcbValue = IedConnection_readObject(con, &error, "simpleIOGenericIO/LLN0.EventLog", IEC61850_FC_LG);
if (error == IED_ERROR_OK) { if ((error == IED_ERROR_OK) && (MmsValue_getType(lcbValue) != MMS_DATA_ACCESS_ERROR)) {
char printBuf[1024]; char printBuf[1024];

@ -45,17 +45,17 @@ ClientSVControlBlock_create(IedConnection connection, const char* reference)
IedClientError error; IedClientError error;
MmsValue* value = IedConnection_readObject(connection, &error, reference, IEC61850_FC_MS); MmsValue* value = IedConnection_readObject(connection, &error, reference, IEC61850_FC_MS);
if (value != NULL) { if ((error == IED_ERROR_OK) && (MmsValue_getType(value) != MMS_DATA_ACCESS_ERROR)) {
isMulticast = true; isMulticast = true;
MmsValue_delete(value); MmsValue_delete(value);
} }
else { else {
value = IedConnection_readObject(connection, &error, reference, IEC61850_FC_US); value = IedConnection_readObject(connection, &error, reference, IEC61850_FC_US);
if (value == NULL) if ((error == IED_ERROR_OK) && (MmsValue_getType(value) != MMS_DATA_ACCESS_ERROR))
return NULL;
MmsValue_delete(value); MmsValue_delete(value);
else
return NULL;
} }
ClientSVControlBlock self = (ClientSVControlBlock) GLOBAL_CALLOC(1, sizeof(struct sClientSVControlBlock)); ClientSVControlBlock self = (ClientSVControlBlock) GLOBAL_CALLOC(1, sizeof(struct sClientSVControlBlock));

Loading…
Cancel
Save