View Issue Details

IDProjectCategoryView StatusLast Update
0006326Compliance Test Tool (CTT) Unified Architecture1 - Script Issuepublic2021-03-26 14:26
ReporterJochen Baier Assigned ToSebastian Allmendinger  
PrioritylowSeverityminorReproducibilityalways
Status closedResolutionfixed 
Product Version1.04.09.396 
Fixed in Version1.03.341.398 
Summary0006326: MonitoredItem.setValue(BuiltInType.Byte, isArray=true): creates a scalar of type ByteString and not an array of typ Byte
Description

The function setValue() in MonitoredItem (\library\Base\Objects\monitoredItem.js) with Parameter dataType= BuiltInType.Byte and isArray=true
creates a Value of type ByteString . Expected an array of type Byte.

Steps To Reproduce

var monitored_item = MonitoredItem.fromNodeIds(UaNodeId.fromString('ns=2;s=Demo.Static.Arrays.Byte'))[0];

var byte_array = new UaBytes();
byte_array[0] = 42;
byte_array[1] = 43;

monitored_item.SafelySetArrayTypeKnown(byte_array, BuiltInType.Byte);
var as_string= monitored_item.Value.toString();

actual: as_string="Value: size=4, data=0x34323433, StatusCode: Good (0x00000000), ..."
expected: as_string="Value: Size: 2 [0] = 42|[1] = 43, StatusCode: Good (0x00000000), ..."

Additional Information

Proposed fix:

in MonitoredItem, function setValue() , in switch (dataType) (array):

current:

case BuiltInType.Byte:
var str = "";
for( var s=0; s<newValue.length; s++ ) str += newValue[s];
node.Value.Value.setByteString( UaByteString.fromStringData( str ) );
break;

proposed:

case BuiltInType.Byte:
var x = new UaBytes();
for( var i=0; i<newValue.length; i++ ){ x[i] = newValue[i]; }
node.Value.Value.setByteArray( x );
break;

TagsNo tags attached.
Files Affected

Activities

Paul Hunkar

2021-01-08 15:19

administrator   ~0013505

In OPC UA (On the wire) byte arrays and byte string are the same - so not sure if any change is actually needed. Need to also review how the change would affect all of the existing test if it were made.

Sebastian Allmendinger

2021-02-24 13:52

developer   ~0013803

The function is not used for a ByteArray in any of the released test scripts.
But because receiving a ByteString as result of that function can not be expected by a user creating its own test script, the function has been updated as suggested.

Paul Hunkar

2021-03-26 14:26

administrator   ~0014084

Reviewed in CMP call - Agreed to changes and closed

Issue History

Date Modified Username Field Change
2020-12-28 10:22 Jochen Baier New Issue
2021-01-08 15:17 Paul Hunkar Assigned To => Alexander Allmendinger
2021-01-08 15:17 Paul Hunkar Status new => assigned
2021-01-08 15:19 Paul Hunkar Note Added: 0013505
2021-02-24 13:52 Sebastian Allmendinger Assigned To Alexander Allmendinger => Sebastian Allmendinger
2021-02-24 13:52 Sebastian Allmendinger Status assigned => resolved
2021-02-24 13:52 Sebastian Allmendinger Resolution open => fixed
2021-02-24 13:52 Sebastian Allmendinger Fixed in Version => 1.03.341.398
2021-02-24 13:52 Sebastian Allmendinger Note Added: 0013803
2021-03-26 14:26 Paul Hunkar Status resolved => closed
2021-03-26 14:26 Paul Hunkar Note Added: 0014084