How to use the node-opcua-client.AttributeIds.EventNotifier function in node-opcua-client

To help you get started, we’ve selected a few node-opcua-client 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 / playground / sample2Subscriptions.ts View on Github external
})
        };
        const itemToMonitor1: ReadValueIdLike = {
            attributeId: AttributeIds.Value,
            nodeId: "ns=1;s=FanSpeed"
        };

        const item1 = await subscription.monitor(itemToMonitor1, parameters1, TimestampsToReturn.Both);

        console.log(" Item1 = ", item1.result!.statusCode.toString());

        item1.on("changed", (dataValue: DataValue) => {
            console.log(" Value1 has changed : ", dataValue.toString());
        });
        const itemToMonitor2: ReadValueIdLike = {
            attributeId: AttributeIds.EventNotifier,
            nodeId: "i=2258"
        };
        const parameters2: MonitoringParametersOptions = {
            discardOldest: true,
            filter: new EventFilter({}),
            queueSize: 100,
            samplingInterval: 0
        };
        const item2 = subscription.monitor(itemToMonitor2, parameters2, TimestampsToReturn.Both);

        await timeout(20000);

        await subscription.terminate();

        await client.disconnect();
github node-opcua / opcua-commander / lib / model / model.ts View on Github external
function toString1(attribute: AttributeIds, dataValue: DataValue | null) {

    if (!dataValue || !dataValue.value || !dataValue.value.hasOwnProperty("value")) {
        return "";
    }
    switch (attribute) {
        case AttributeIds.DataType:
            return DataTypeIdsToString[dataValue.value.value.value] + " (" + dataValue.value.value.toString() + ")";
        case AttributeIds.NodeClass:
            return NodeClass[dataValue.value.value] + " (" + dataValue.value.value + ")";
        case AttributeIds.IsAbstract:
        case AttributeIds.Historizing:
        case AttributeIds.EventNotifier:
            return dataValue.value.value ? "true" : "false"
        case AttributeIds.WriteMask:
        case AttributeIds.UserWriteMask:
            return " (" + dataValue.value.value + ")";
        case AttributeIds.NodeId:
        case AttributeIds.BrowseName:
        case AttributeIds.DisplayName:
        case AttributeIds.Description:
        case AttributeIds.ValueRank:
        case AttributeIds.ArrayDimensions:
        case AttributeIds.Executable:
        case AttributeIds.UserExecutable:
        case AttributeIds.MinimumSamplingInterval:
            if (!dataValue.value.value) {
                return "null";
            }