- fixed bug in IedConnection_createDataSet function

pull/6/head
Michael Zillgith 11 years ago
parent 90f26bcf84
commit 0941e2a971

@ -60,7 +60,6 @@ namespace datasets
Console.WriteLine(" DS value: " + value + " type: " + value.GetType()); Console.WriteLine(" DS value: " + value + " type: " + value.GetType());
} }
// delete the data set // delete the data set
con.DeleteDataSet("simpleIOGenericIO/LLN0.ds1"); con.DeleteDataSet("simpleIOGenericIO/LLN0.ds1");
@ -68,7 +67,7 @@ namespace datasets
} }
catch (IedConnectionException e) catch (IedConnectionException e)
{ {
Console.WriteLine(e.Message); Console.WriteLine(e.Message + " reason: " + e.GetIedClientError().ToString());
} }
} }

@ -101,7 +101,7 @@ namespace report_new_dataset
} }
catch (IedConnectionException e) catch (IedConnectionException e)
{ {
Console.WriteLine(e.Message); Console.WriteLine(e.Message + " reason: " + e.GetIedClientError().ToString());
} }
} }

@ -65,8 +65,9 @@ int main(int argc, char** argv) {
if (error != IED_ERROR_OK) if (error != IED_ERROR_OK)
printf("failed to write simpleIOGenericIO/GGIO1.NamPlt.vendor!\n"); printf("failed to write simpleIOGenericIO/GGIO1.NamPlt.vendor!\n");
else
MmsValue_delete(value);
MmsValue_delete(value);
/* read data set */ /* read data set */
ClientDataSet clientDataSet = IedConnection_readDataSetValues(con, &error, "simpleIOGenericIO/LLN0.Events", NULL); ClientDataSet clientDataSet = IedConnection_readDataSetValues(con, &error, "simpleIOGenericIO/LLN0.Events", NULL);
@ -76,10 +77,15 @@ int main(int argc, char** argv) {
/* Read RCB values */ /* Read RCB values */
ClientReportControlBlock rcb = 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 */ /* 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); reportCallbackFunction, NULL);
/* Set trigger options and enable report */ /* Set trigger options and enable report */
@ -111,6 +117,8 @@ int main(int argc, char** argv) {
ClientDataSet_destroy(clientDataSet); ClientDataSet_destroy(clientDataSet);
close_connection:
IedConnection_close(con); IedConnection_close(con);
} }
else { else {

@ -1,7 +1,7 @@
/* /*
* ied_connection.c * ied_connection.c
* *
* Copyright 2013 Michael Zillgith * Copyright 2013, 2014 Michael Zillgith
* *
* This file is part of libIEC61850. * This file is part of libIEC61850.
* *
@ -1868,6 +1868,11 @@ IedConnection_createDataSet(IedConnection self, IedClientError* error, const cha
MmsVariableAccessSpecification* dataSetEntry = MmsVariableAccessSpecification* dataSetEntry =
MmsMapping_ObjectReferenceToVariableAccessSpec((char*) dataSetElement->data); MmsMapping_ObjectReferenceToVariableAccessSpec((char*) dataSetElement->data);
if (dataSetEntry == NULL) {
*error = IED_ERROR_OBJECT_REFERENCE_INVALID;
goto cleanup_list;
}
LinkedList_add(dataSetEntries, (void*) dataSetEntry); LinkedList_add(dataSetEntries, (void*) dataSetEntry);
dataSetElement = LinkedList_getNext(dataSetElement); dataSetElement = LinkedList_getNext(dataSetElement);
@ -1880,11 +1885,12 @@ IedConnection_createDataSet(IedConnection self, IedClientError* error, const cha
MmsConnection_defineNamedVariableList(self->connection, &mmsError, MmsConnection_defineNamedVariableList(self->connection, &mmsError,
domainId, itemId, dataSetEntries); domainId, itemId, dataSetEntries);
*error = iedConnection_mapMmsErrorToIedError(mmsError);
cleanup_list:
/* delete list and all elements */ /* delete list and all elements */
LinkedList_destroyDeep(dataSetEntries, (LinkedListValueDeleteFunction) MmsVariableAccessSpecification_destroy); LinkedList_destroyDeep(dataSetEntries, (LinkedListValueDeleteFunction) MmsVariableAccessSpecification_destroy);
*error = iedConnection_mapMmsErrorToIedError(mmsError);
exit_function: exit_function:
return; return;
} }

@ -771,8 +771,8 @@ MmsConnection_create()
self->isoParameters = IsoConnectionParameters_create(); self->isoParameters = IsoConnectionParameters_create();
/* Load default values for connection parameters */ /* Load default values for connection parameters */
TSelector selector1 = { 2, { 0, 0 } }; TSelector selector1 = { 2, { 0, 1 } };
TSelector selector2 = { 2, { 0, 0 } }; TSelector selector2 = { 2, { 0, 1 } };
IsoConnectionParameters_setLocalAddresses(self->isoParameters, 1, 1, selector1); IsoConnectionParameters_setLocalAddresses(self->isoParameters, 1, 1, selector1);
IsoConnectionParameters_setLocalApTitle(self->isoParameters, "1.1.1.999", 12); IsoConnectionParameters_setLocalApTitle(self->isoParameters, "1.1.1.999", 12);

Loading…
Cancel
Save