How to use the node-opcua-service-write.WriteValue function in node-opcua-service-write

To help you get started, we’ve selected a few node-opcua-service-write examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github node-opcua / node-opcua / packages / node-opcua-address-space / src / ua_variable.ts View on Github external
public writeAttribute(
        context: SessionContext,
        writeValueOptions: WriteValueOptions | WriteValue,
        callback?: (err: Error | null, statusCode?: StatusCode) => void
    ): any {

        if (!callback) {
            throw new Error("Internal error");
        }
        const writeValue: WriteValue = writeValueOptions instanceof WriteValue
            ? writeValueOptions as WriteValue
            : new WriteValue(writeValueOptions);

        assert(context instanceof SessionContext);
        assert(writeValue instanceof WriteValue);
        assert(writeValue.value instanceof DataValue);
        assert(writeValue.value!.value instanceof Variant);
        assert(_.isFunction(callback));

        // Spec 1.0.2 Part 4 page 58
        // If the SourceTimestamp or the ServerTimestamp is specified, the Server shall
        // use these values.

        // xx _apply_default_timestamps(writeValue.value);

        switch (writeValue.attributeId) {
            case AttributeIds.Value:
                this.writeValue(context, writeValue.value!, writeValue.indexRange!, callback);

node-opcua-service-write

pure nodejs OPCUA SDK - module service-write

MIT
Latest version published 1 day ago

Package Health Score

84 / 100
Full package analysis