These are chat archives for node-opcua/node-opcua

21st
Nov 2017
SchindLuder
@SchindLuder
Nov 21 21:56
image.png

by returning some member from opcua.StatusCodes iwithin the getter of my variable i can set custom status codes. But as of now i was not able to have Value anything else than Null in this case...

here's how i tried:

(the second picture file)
    return creationParentNode.addressSpace.addVariable({
        componentOf: creationParentNode,
        browseName: variableName,
        dataType: variableType,

        // this is the value
        value: {

            // this is the variant
            get: function() {
                // here i can either return a variant or a StatusCode
                let value =  valueResolver.getValue(identifier);
                value.statusCode = opcua.StatusCodes.BadTimeout;
                return value;
            },
            set: function(variant) {
                valueResolver.setValue(identifier,new opcua.Variant({
                    dataType : dataType,
                    value: variant.value
                }));
                // what is this StatusCode used for?
                // A return value for the write access of the client?
                return opcua.StatusCodes.Good;
            }
        },
        minimumSamplingInterval : 5,
        statusCode : opcua.StatusCodes.Bad
    });
how can i set the status code to badtimeout while still displaying the last Value that was written?