Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
}
}
*/
}
if (context.currentTime && !dataValue.serverTimestamp) {
dataValue.serverTimestamp = context.currentTime;
dataValue.serverPicoseconds = 0;
}
assert(context instanceof SessionContext);
// adjust arguments if optional indexRange Parameter is not given
let indexRange: NumericRange | null = null;
let callback: StatusCodeCallBack;
if (args.length === 1) {
indexRange = new NumericRange();
callback = args[0];
} else if (args.length === 2) {
indexRange = args[0];
callback = args[1];
} else {
throw new Error("Invalid Number of args");
}
assert(_.isFunction(callback));
assert(dataValue instanceof DataValue);
// index range could be string
indexRange = NumericRange.coerce(indexRange);
// test write permission
if (!this.isWritable(context)) {
return callback!(null, StatusCodes.BadNotWritable);
dataValue.sourceTimestamp = clock.timestamp;
dataValue.sourcePicoseconds = clock.picoseconds;
}
}
if (context.currentTime && !dataValue.serverTimestamp) {
dataValue.serverTimestamp = context.currentTime;
dataValue.serverPicoseconds = 0;
}
assert(context instanceof SessionContext);
// adjust arguments if optional indexRange Parameter is not given
if (!_.isFunction(callback) && _.isFunction(indexRange)) {
callback = indexRange;
indexRange = new NumericRange();
}
assert(_.isFunction(callback));
assert(dataValue instanceof DataValue);
indexRange = NumericRange.coerce(indexRange);
// test write permission
if (!self.isWritable(context)) {
return callback(null, StatusCodes.BadNotWritable);
}
if (!self.isUserWritable(context)) {
return callback(null, StatusCodes.BadUserAccessDenied);
}
// adjust special case
const variant = adjustVariant(self, dataValue.value);
public get binaryEncodingDefinition(): string {
const indexRange = new NumericRange();
const descriptionNode = this.binaryEncoding.findReferencesAsObject("HasDescription")[0];
const structureVar = descriptionNode.findReferencesAsObject(
"HasComponent", false)[0] as any as UAVariable;
const dataValue = structureVar.readValue(SessionContext.defaultContext, indexRange);
// xx if (!dataValue || !dataValue.value || !dataValue.value.value) { return "empty";}
return dataValue.value.value.toString();
}
public get xmlEncodingDefinition(): string {
const indexRange = new NumericRange();
const descriptionNode = this.xmlEncoding.findReferencesAsObject("HasDescription")[0];
const structureVar = descriptionNode.findReferencesAsObject(
"HasComponent", false)[0] as any as UAVariable;
const dataValue = structureVar.readValue(SessionContext.defaultContext, indexRange);
if (!dataValue || !dataValue.value || !dataValue.value.value) {
return "empty";
}
return dataValue.value.value.toString();
}
UADataType.prototype.__defineGetter__("xmlEncodingDefinition", function () {
const indexRange = new NumericRange();
const descriptionNode = this.xmlEncoding.findReferencesAsObject("HasDescription")[0];
const structureVar = descriptionNode.findReferencesAsObject("HasComponent",false)[0];
const dataValue = structureVar.readValue(SessionContext.defaultContext, indexRange);
if (!dataValue || !dataValue.value || !dataValue.value.value) {
return "empty";
}
return dataValue.value.value.toString();
});