diff --git a/dotnet/datasets/DataSetExample.cs b/dotnet/datasets/DataSetExample.cs index a9af7267..e0da9d10 100644 --- a/dotnet/datasets/DataSetExample.cs +++ b/dotnet/datasets/DataSetExample.cs @@ -60,7 +60,6 @@ namespace datasets Console.WriteLine(" DS value: " + value + " type: " + value.GetType()); } - // delete the data set con.DeleteDataSet("simpleIOGenericIO/LLN0.ds1"); @@ -68,7 +67,7 @@ namespace datasets } catch (IedConnectionException e) { - Console.WriteLine(e.Message); + Console.WriteLine(e.Message + " reason: " + e.GetIedClientError().ToString()); } } diff --git a/dotnet/report_new_dataset/Main.cs b/dotnet/report_new_dataset/Main.cs index ce6ad8c4..06cd78e1 100644 --- a/dotnet/report_new_dataset/Main.cs +++ b/dotnet/report_new_dataset/Main.cs @@ -101,7 +101,7 @@ namespace report_new_dataset } catch (IedConnectionException e) { - Console.WriteLine(e.Message); + Console.WriteLine(e.Message + " reason: " + e.GetIedClientError().ToString()); } } diff --git a/examples/iec61850_client_example1/client_example1.c b/examples/iec61850_client_example1/client_example1.c index b8429a09..4ddea92b 100644 --- a/examples/iec61850_client_example1/client_example1.c +++ b/examples/iec61850_client_example1/client_example1.c @@ -65,8 +65,9 @@ int main(int argc, char** argv) { if (error != IED_ERROR_OK) printf("failed to write simpleIOGenericIO/GGIO1.NamPlt.vendor!\n"); + else + MmsValue_delete(value); - MmsValue_delete(value); /* read data set */ ClientDataSet clientDataSet = IedConnection_readDataSetValues(con, &error, "simpleIOGenericIO/LLN0.Events", NULL); @@ -76,10 +77,15 @@ int main(int argc, char** argv) { /* Read RCB values */ ClientReportControlBlock rcb = - IedConnection_getRCBValues(con, &error, "simpleIOGenericIO/LLN0.RP.EventsRCB", NULL); + IedConnection_getRCBValues(con, &error, "simpleIOGenericIO/LLN0.RP.EventsRCB01", NULL); + + + bool rptEna = ClientReportControlBlock_getRptEna(rcb); + + printf("RptEna = %i\n", rptEna); /* Install handler for reports */ - IedConnection_installReportHandler(con, "simpleIOGenericIO/LLN0.RP.EventsRCB", ClientReportControlBlock_getRptId(rcb), + IedConnection_installReportHandler(con, "simpleIOGenericIO/LLN0.RP.EventsRCB01", ClientReportControlBlock_getRptId(rcb), reportCallbackFunction, NULL); /* Set trigger options and enable report */ @@ -111,6 +117,8 @@ int main(int argc, char** argv) { ClientDataSet_destroy(clientDataSet); + close_connection: + IedConnection_close(con); } else { diff --git a/src/iec61850/client/ied_connection.c b/src/iec61850/client/ied_connection.c index c8f39820..490f3cf9 100644 --- a/src/iec61850/client/ied_connection.c +++ b/src/iec61850/client/ied_connection.c @@ -1,7 +1,7 @@ /* * ied_connection.c * - * Copyright 2013 Michael Zillgith + * Copyright 2013, 2014 Michael Zillgith * * This file is part of libIEC61850. * @@ -1868,6 +1868,11 @@ IedConnection_createDataSet(IedConnection self, IedClientError* error, const cha MmsVariableAccessSpecification* dataSetEntry = MmsMapping_ObjectReferenceToVariableAccessSpec((char*) dataSetElement->data); + if (dataSetEntry == NULL) { + *error = IED_ERROR_OBJECT_REFERENCE_INVALID; + goto cleanup_list; + } + LinkedList_add(dataSetEntries, (void*) dataSetEntry); dataSetElement = LinkedList_getNext(dataSetElement); @@ -1880,11 +1885,12 @@ IedConnection_createDataSet(IedConnection self, IedClientError* error, const cha MmsConnection_defineNamedVariableList(self->connection, &mmsError, domainId, itemId, dataSetEntries); + *error = iedConnection_mapMmsErrorToIedError(mmsError); + +cleanup_list: /* delete list and all elements */ LinkedList_destroyDeep(dataSetEntries, (LinkedListValueDeleteFunction) MmsVariableAccessSpecification_destroy); - *error = iedConnection_mapMmsErrorToIedError(mmsError); - exit_function: return; } diff --git a/src/mms/iso_mms/client/mms_client_connection.c b/src/mms/iso_mms/client/mms_client_connection.c index 793d50d7..0e5e91bf 100644 --- a/src/mms/iso_mms/client/mms_client_connection.c +++ b/src/mms/iso_mms/client/mms_client_connection.c @@ -771,8 +771,8 @@ MmsConnection_create() self->isoParameters = IsoConnectionParameters_create(); /* Load default values for connection parameters */ - TSelector selector1 = { 2, { 0, 0 } }; - TSelector selector2 = { 2, { 0, 0 } }; + TSelector selector1 = { 2, { 0, 1 } }; + TSelector selector2 = { 2, { 0, 1 } }; IsoConnectionParameters_setLocalAddresses(self->isoParameters, 1, 1, selector1); IsoConnectionParameters_setLocalApTitle(self->isoParameters, "1.1.1.999", 12);