How to use the node-opcua-numeric-range.NumericRange.overlap function in node-opcua-numeric-range

To help you get started, we’ve selected a few node-opcua-numeric-range 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-server / src / monitored_item.js View on Github external
assert(dataValue !== self.oldDataValue,               "recordValue expects different dataValue to be provided");
    assert(!dataValue.value || dataValue.value !== self.oldDataValue.value,   "recordValue expects different dataValue.value to be provided");
    assert(!dataValue.value  || dataValue.value.isValid(),"expecting a valid variant value");

    const hasSemanticChanged = self.node && (self.node.semantic_version !== self._semantic_version);

    //xx   console.log("`\n----------------------------",skipChangeTest,self.clientHandle,
    //             self.node.listenerCount("value_changed"),self.node.nodeId.toString());
    //xx   console.log("events ---- ",self.node.eventNames().join("-"));
    //xx    console.log("indexRange = ",indexRange ? indexRange.toString() :"");
    //xx    console.log("self.itemToMonitor.indexRange = ",self.itemToMonitor.indexRange.toString());

    if (!hasSemanticChanged && indexRange && self.itemToMonitor.indexRange) {
        // we just ignore changes that do not fall within our range
        // ( unless semantic bit has changed )
        if (!NumericRange.overlap(indexRange,self.itemToMonitor.indexRange)) {
            return; // no overlap !
        }
    }

    assert( self.itemToMonitor,"must have a valid itemToMonitor(have this monitoredItem been disposed already ?");
    // extract the range that we are interested with
    dataValue = extractRange(dataValue, self.itemToMonitor.indexRange);

    // istanbul ignore next
    if (doDebug) {
        debugLog("MonitoredItem#recordValue", self.node.nodeId.toString(), self.node.browseName.toString(), " has Changed = ", !sameDataValue(dataValue, self.oldDataValue));
    }

    // if semantic has changed, value need to be enqueued regardless of other assumptions
    if (hasSemanticChanged) {
        return self._enqueue_value(dataValue);
github node-opcua / node-opcua / packages / node-opcua-server / source / monitored_item.ts View on Github external
assert(!dataValue.value || dataValue.value.isValid(),
      "expecting a valid variant value");

    const hasSemanticChanged = this.node && ((this.node as any).semantic_version !== this._semantic_version);

    // xx   console.log("`\n----------------------------",skipChangeTest,this.clientHandle,
    //             this.node.listenerCount("value_changed"),this.node.nodeId.toString());
    // xx   console.log("events ---- ",this.node.eventNames().join("-"));
    // xx    console.log("indexRange = ",indexRange ? indexRange.toString() :"");
    // xx    console.log("this.itemToMonitor.indexRange = ",this.itemToMonitor.indexRange.toString());

    if (!hasSemanticChanged && indexRange && this.itemToMonitor.indexRange) {
      // we just ignore changes that do not fall within our range
      // ( unless semantic bit has changed )
      if (!NumericRange.overlap(indexRange as NumericalRange0, this.itemToMonitor.indexRange)) {
        return; // no overlap !
      }
    }

    assert(this.itemToMonitor, "must have a valid itemToMonitor(have this monitoredItem been disposed already ?");
    // extract the range that we are interested with
    dataValue = extractRange(dataValue, this.itemToMonitor.indexRange);

    // istanbul ignore next
    if (doDebug) {
      debugLog("MonitoredItem#recordValue",
        this.node!.nodeId.toString(),
        this.node!.browseName.toString(), " has Changed = ", !sameDataValue(dataValue, this.oldDataValue!));
    }

    // if semantic has changed, value need to be enqueued regardless of other assumptions

node-opcua-numeric-range

pure nodejs OPCUA SDK - module numeric-range

MIT
Latest version published 1 month ago

Package Health Score

84 / 100
Full package analysis