How to use the node-opcua-status-code.StatusCode.makeStatusCode function in node-opcua-status-code

To help you get started, we’ve selected a few node-opcua-status-code 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-aggregates / source / interpolate.ts View on Github external
// find the first non-Bad Raw value before the timestamp;

    // find previous good value
    const before = interval.beforeStartDataValue(bTreatUncertainAsBad);
    if (isBad(before.dataValue.statusCode)) {
        return new DataValue({
            sourceTimestamp: interval.startTime,
            statusCode: StatusCodes.BadNoData
        });
    }

    if (options.stepped) {
        if (before.index + 1 === interval.index) {
            return new DataValue({
                sourceTimestamp: interval.startTime,
                statusCode: StatusCode.makeStatusCode(before.dataValue.statusCode, "HistorianInterpolated"),
                value: before.dataValue.value
            });
        }
        return steppedValue(before.dataValue);
    }
    // find the first non-Bad Raw value after the timestamp;
    const next = interval.nextStartDataValue(bTreatUncertainAsBad);

    //  draw a line between before value and after value;
    // use point where the line crosses the timestamp as an estimate of the bounding value.
    //   The calculation can be expressed with the following formula:
    //    V bound = (T bound – T before)x( V after – V before)/( T after – T before) + V before
    //    where V
    //   x is a value at ‘x’ and Tx is the timestamp associated with Vx.
    const interpolatedDataValue = interpolateValue(before.dataValue, next.dataValue, interval.startTime);
github node-opcua / node-opcua / packages / node-opcua-server / source / monitored_item.ts View on Github external
function setSemanticChangeBit(notification: any) {
  if (notification && notification.hasOwnProperty("value")) {
    notification.value.statusCode =
      StatusCode.makeStatusCode(notification.value.statusCode, "SemanticChanged");
  }
}
github node-opcua / node-opcua / packages / node-opcua-server / source / monitored_item.ts View on Github external
private _setOverflowBit(notification: any) {

    if (notification.hasOwnProperty("value")) {
      assert(notification.value.statusCode.equals(StatusCodes.Good));
      notification.value.statusCode =
        StatusCode.makeStatusCode(notification.value.statusCode, "Overflow | InfoTypeDataValue");
      assert(_.isEqual(notification.value.statusCode, StatusCodes.GoodWithOverflowBit));
      assert(notification.value.statusCode.hasOverflowBit);
    }
    if (this.$subscription && this.$subscription.subcriptionDiagnosticInfo) {
      this.$subscription.subcriptionDiagnosticInfo.monitoringQueueOverflowCount++;
    }
  }
github node-opcua / node-opcua / packages / node-opcua-aggregates / source / minmax.ts View on Github external
if (!selectedValue) {
        return new DataValue({
            sourceTimestamp: interval.startTime,
            statusCode: StatusCodes.BadNoData
        });
    }
    if (isRaw) {
        if (hasBad) {
            statusCode = StatusCodes.UncertainDataSubNormal;
        } else {
            statusCode = StatusCodes.Good;
        }
    } else if (hasBad) {
        statusCode = StatusCode.makeStatusCode(StatusCodes.UncertainDataSubNormal, "HistorianCalculated");
    } else {
        statusCode = StatusCode.makeStatusCode(StatusCodes.Good, "HistorianCalculated");
    }

    if (counter > 1) {
        statusCode = StatusCode.makeStatusCode(statusCode, "HistorianMultiValue");
    }
    if (isPartial || interval.isPartial) {
        statusCode = StatusCode.makeStatusCode(statusCode, "HistorianPartial");
    }

    return new DataValue({
        sourceTimestamp: interval.startTime,
        statusCode: statusCode as StatusCode,
        value: selectedValue!
    });
}
github node-opcua / node-opcua / packages / node-opcua-aggregates / source / minmax.ts View on Github external
if (hasBad) {
            statusCode = StatusCodes.UncertainDataSubNormal;
        } else {
            statusCode = StatusCodes.Good;
        }
    } else if (hasBad) {
        statusCode = StatusCode.makeStatusCode(StatusCodes.UncertainDataSubNormal, "HistorianCalculated");
    } else {
        statusCode = StatusCode.makeStatusCode(StatusCodes.Good, "HistorianCalculated");
    }

    if (counter > 1) {
        statusCode = StatusCode.makeStatusCode(statusCode, "HistorianMultiValue");
    }
    if (isPartial || interval.isPartial) {
        statusCode = StatusCode.makeStatusCode(statusCode, "HistorianPartial");
    }

    return new DataValue({
        sourceTimestamp: interval.startTime,
        statusCode: statusCode as StatusCode,
        value: selectedValue!
    });
}
github node-opcua / node-opcua / packages / node-opcua-aggregates / source / minmax.ts View on Github external
});
    }
    if (isRaw) {
        if (hasBad) {
            statusCode = StatusCodes.UncertainDataSubNormal;
        } else {
            statusCode = StatusCodes.Good;
        }
    } else if (hasBad) {
        statusCode = StatusCode.makeStatusCode(StatusCodes.UncertainDataSubNormal, "HistorianCalculated");
    } else {
        statusCode = StatusCode.makeStatusCode(StatusCodes.Good, "HistorianCalculated");
    }

    if (counter > 1) {
        statusCode = StatusCode.makeStatusCode(statusCode, "HistorianMultiValue");
    }
    if (isPartial || interval.isPartial) {
        statusCode = StatusCode.makeStatusCode(statusCode, "HistorianPartial");
    }

    return new DataValue({
        sourceTimestamp: interval.startTime,
        statusCode: statusCode as StatusCode,
        value: selectedValue!
    });
}