Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private _readSingleNode(
context: SessionContext,
nodeToRead: ReadValueIdOptions,
timestampsToReturn?: TimestampsToReturn
): DataValue {
assert(context instanceof SessionContext);
const engine = this;
const nodeId = nodeToRead.nodeId!;
const attributeId = nodeToRead.attributeId!;
const indexRange = nodeToRead.indexRange;
const dataEncoding = nodeToRead.dataEncoding;
if (timestampsToReturn === TimestampsToReturn.Invalid) {
return new DataValue({ statusCode: StatusCodes.BadTimestampsToReturnInvalid });
}
timestampsToReturn = (timestampsToReturn !== undefined) ? timestampsToReturn : TimestampsToReturn.Neither;
const obj = engine.__findObject(nodeId!);
let dataValue;
if (!obj) {
// may be return BadNodeIdUnknown in dataValue instead ?
// Object Not Found
return new DataValue({ statusCode: StatusCodes.BadNodeIdUnknown });
} else {
// check access
// BadUserAccessDenied