Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
public writeAttribute(
context: SessionContext,
writeValueOptions: WriteValueOptions | WriteValue,
callback?: (err: Error | null, statusCode?: StatusCode) => void
): any {
if (!callback) {
throw new Error("Internal error");
}
const writeValue: WriteValue = writeValueOptions instanceof WriteValue
? writeValueOptions as WriteValue
: new WriteValue(writeValueOptions);
assert(context instanceof SessionContext);
assert(writeValue instanceof WriteValue);
assert(writeValue.value instanceof DataValue);
assert(writeValue.value!.value instanceof Variant);
assert(_.isFunction(callback));
// Spec 1.0.2 Part 4 page 58
// If the SourceTimestamp or the ServerTimestamp is specified, the Server shall
// use these values.
// xx _apply_default_timestamps(writeValue.value);
switch (writeValue.attributeId) {
case AttributeIds.Value:
this.writeValue(context, writeValue.value!, writeValue.indexRange!, callback);