How to use the node-opcua-date-time.isMinDate function in node-opcua-date-time

To help you get started, we’ve selected a few node-opcua-date-time 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 / historical_access / address_space_historical_data_node.ts View on Github external
historyData: new HistoryData({ dataValues }),
      statusCode: StatusCodes.Good
    });
    return callback(null, result2);
  }

  // todo add special treatment for when startTime > endTime
  // ( in this case series must be return in reverse order )

  let maxNumberToExtract = 0;
  let isReversed = false;
  let reverseDataValue = false;
  if (isMinDate(historyReadRawModifiedDetails.endTime!)) {
    // end time is not specified
    maxNumberToExtract = historyReadRawModifiedDetails.numValuesPerNode;
    if (isMinDate(historyReadRawModifiedDetails.startTime!)) {
      // end start and start time are not specified, this is invalid
      const result = new HistoryReadResult({
        statusCode: StatusCodes.BadHistoryOperationUnsupported // should be an error
      });
      return callback(null, result);
    }

  } else if (isMinDate(historyReadRawModifiedDetails.startTime!)) {
    // start time is not specified
    // end time is specified
    maxNumberToExtract = historyReadRawModifiedDetails.numValuesPerNode;
    isReversed = true;
    reverseDataValue = false;

    if (historyReadRawModifiedDetails.numValuesPerNode === 0) {
      // when start time is not specified
github node-opcua / node-opcua / packages / node-opcua-address-space / src / historical_access / address_space_historical_data_node.ts View on Github external
return callback(err);
      }

      // now make sure that only the requested number of value is returned
      if (historyReadRawModifiedDetails.numValuesPerNode >= 1) {
        if (dataValues.length === 0) {
          const result1 = new HistoryReadResult({
            historyData: new HistoryData({ dataValues: [] }),
            statusCode: StatusCodes.GoodNoData
          });
          return callback(null, result1);
        } else {
          const remaining = dataValues;
          dataValues = remaining.splice(0, historyReadRawModifiedDetails.numValuesPerNode);

          if (remaining.length > 0 && !isMinDate(historyReadRawModifiedDetails.endTime)) {
            continuationPoint = createContinuationPoint();
            context.continuationPoints = context.continuationPoints || {};
            context.continuationPoints[continuationPoint.toString("hex")] = {
              dataValues: remaining
            };
          }
        }
      }
      const result = new HistoryReadResult({
        continuationPoint: continuationPoint || undefined,
        historyData: new HistoryData({ dataValues }),
        statusCode: StatusCodes.Good
      });
      callback(null, result);
    });
github node-opcua / node-opcua / packages / node-opcua-address-space / src / historical_access / address_space_historical_data_node.ts View on Github external
function inInTimeRange2(
  historyReadDetails: any,
  dataValue: DataValue
): boolean {
  if (historyReadDetails.endTime &&
    !isMinDate(historyReadDetails.endTime) &&
    dataValue.sourceTimestamp! > historyReadDetails.endTime) {
    return false;
  }
  return !(historyReadDetails.startTime &&
    !isMinDate(historyReadDetails.startTime) &&
    dataValue.sourceTimestamp! < historyReadDetails.startTime);
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / historical_access / address_space_historical_data_node.ts View on Github external
function inInTimeRange2(
  historyReadDetails: any,
  dataValue: DataValue
): boolean {
  if (historyReadDetails.endTime &&
    !isMinDate(historyReadDetails.endTime) &&
    dataValue.sourceTimestamp! > historyReadDetails.endTime) {
    return false;
  }
  return !(historyReadDetails.startTime &&
    !isMinDate(historyReadDetails.startTime) &&
    dataValue.sourceTimestamp! < historyReadDetails.startTime);
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / historical_access / address_space_historical_data_node.ts View on Github external
function inInTimeRange(
  historyReadDetails: any,
  dataValue: DataValue
): boolean {

  if (historyReadDetails.startTime &&
    !isMinDate(historyReadDetails.startTime)
    && dataValue.sourceTimestamp! < historyReadDetails.startTime) {
    return false;
  }
  if (historyReadDetails.endTime
    && !isMinDate(historyReadDetails.endTime)
    && dataValue.sourceTimestamp! > historyReadDetails.endTime) {
    return false;
  }
  return true;
}
github node-opcua / node-opcua / packages / node-opcua-address-space / src / historical_access / address_space_historical_data_node.ts View on Github external
function inInTimeRange(
  historyReadDetails: any,
  dataValue: DataValue
): boolean {

  if (historyReadDetails.startTime &&
    !isMinDate(historyReadDetails.startTime)
    && dataValue.sourceTimestamp! < historyReadDetails.startTime) {
    return false;
  }
  if (historyReadDetails.endTime
    && !isMinDate(historyReadDetails.endTime)
    && dataValue.sourceTimestamp! > historyReadDetails.endTime) {
    return false;
  }
  return true;
}

node-opcua-date-time

pure nodejs OPCUA SDK - module date-time

MIT
Latest version published 3 months ago

Package Health Score

83 / 100
Full package analysis