Search in sources :

Example 6 with Array

use of ucar.ma2.Array in project Protocol-Adapter-IEC61850 by OSGP.

the class NodeContainer method writeDateArray.

public void writeDateArray(final SubDataAttribute child, final Date[] values) throws NodeWriteException {
    final Array array = (Array) this.parent.getChild(child.getDescription());
    if (array.size() != values.length) {
        throw new NodeWriteException(String.format("Invalid array size %d. Size on device is %d", values.length, array.size()));
    }
    for (int i = 0; i < values.length; i++) {
        final BdaTimestamp bdaTimestamp = (BdaTimestamp) array.getChild(i);
        bdaTimestamp.setDate(values[i]);
        this.writeNode(bdaTimestamp);
    }
// Unfortunately writing an array using "this.writeNode(array);"
// doesn't seem to work...
// Therefore the items are written in individual calls...
}
Also used : Array(org.openmuc.openiec61850.Array) NodeWriteException(com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException) BdaTimestamp(org.openmuc.openiec61850.BdaTimestamp)

Aggregations

Array (org.openmuc.openiec61850.Array)4 NodeWriteException (com.alliander.osgp.adapter.protocol.iec61850.exceptions.NodeWriteException)2 IOException (java.io.IOException)2 Array (ucar.ma2.Array)2 Date (java.util.Date)1 BdaFloat32 (org.openmuc.openiec61850.BdaFloat32)1 BdaTimestamp (org.openmuc.openiec61850.BdaTimestamp)1