Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
(innerCallback: ErrorCallback) => {
const methodToCall: CallMethodRequestLike = {
inputArguments: [
new Variant({ dataType: DataType.UInt32, value: subscriptionId })
],
methodId: conditionRefreshId,
objectId: conditionTypeNodeId
};
debugLog("xxxxx Calling method ", methodToCall.toString());
theSession.call(methodToCall, (err: Error | null, result?: CallMethodResult) => {
if (err) {
return innerCallback(err);
}
result = result!;
// istanbul ignore next
if (result.statusCode !== StatusCodes.Good) {
return innerCallback(new Error("Error " + result.statusCode.toString()));
}
return engine.serverCapabilities.maxHistoryContinuationPoints;
});
// added by DI : Server-specific period of time in milliseconds until the Server will revoke a lock.
// TODO bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxInactiveLockTime,
// TODO DataType.UInt16, function () {
// TODO return self.serverCapabilities.maxInactiveLockTime;
// TODO });
bindStandardArray(VariableIds.Server_ServerCapabilities_SoftwareCertificates,
DataType.ExtensionObject, "SoftwareCertificates", () => {
return engine.serverCapabilities.softwareCertificates;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxArrayLength,
DataType.UInt32, () => {
return engine.serverCapabilities.maxArrayLength;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxStringLength,
DataType.UInt32, () => {
return engine.serverCapabilities.maxStringLength;
});
bindStandardScalar(VariableIds.Server_ServerCapabilities_MaxByteStringLength,
DataType.UInt32, () => {
return engine.serverCapabilities.maxByteStringLength;
});
function bindOperationLimits(operationLimits: OperationLimits) {
assert(_.isObject(operationLimits));
case AttributeIds.BrowseName: // QualifiedName
assert(this.browseName instanceof QualifiedName);
options.value = {dataType: DataType.QualifiedName, value: this.browseName};
break;
case AttributeIds.DisplayName: // LocalizedText
options.value = {dataType: DataType.LocalizedText, value: this.displayName[0]};
break;
case AttributeIds.Description: // LocalizedText
options.value = {dataType: DataType.LocalizedText, value: this.description};
break;
case AttributeIds.WriteMask:
options.value = {dataType: DataType.UInt32, value: this.getWriteMask()};
break;
case AttributeIds.UserWriteMask:
options.value = {dataType: DataType.UInt32, value: this.getUserWriteMask()};
break;
default:
options.value = null;
//xx debugLog("class Name ", this.constructor.name, (" BaseNode : '" + this.browseName + "' nodeid=" + this.nodeId.toString()).yellow, " cannot get attribute ", AttributeNameById[attributeId], "(", attributeId, ")");
options.statusCode = StatusCodes.BadAttributeIdInvalid;
break;
}
//xx options.serverTimestamp = new Date();
return new DataValue(options);
};
ClientSession.prototype.getMonitoredItems = function (subscriptionId, callback) {
//
//
//
const self = this;
const methodsToCall =
new call_service.CallMethodRequest({
objectId: coerceNodeId("ns=0;i=2253"), // ObjectId.Server
methodId: coerceNodeId("ns=0;i=11492"), // MethodIds.Server_GetMonitoredItems;
inputArguments: [
// BaseDataType
{dataType: DataType.UInt32, value: subscriptionId}
]
});
self.call([methodsToCall], function (err, result) {
/* istanbul ignore next */
if (err) {
return callback(err);
}
result = result[0];
if (result.statusCode.isNot(StatusCodes.Good)) {
callback(new Error(result.statusCode.toString()), result);
const setFunc = function(variant) {
value = variant.value;
const server = addressSpace.rootFolder.objects.server;
server.raiseEvent("3:MyEventType", {
message: {
dataType: DataType.LocalizedText,
value: { text: "Hello World" }
},
severity: {
dataType: DataType.UInt32,
value: 32
}
});
};
get: () => {
if (!usage_result) {
return StatusCodes.BadResourceUnavailable;
}
return new Variant({dataType: DataType.UInt32, value: usage_result.memory});
}
}
View.prototype.readAttribute = function (context, attributeId) {
assert(context instanceof SessionContext);
const options = {};
switch (attributeId) {
case AttributeIds.EventNotifier:
options.value = {dataType: DataType.UInt32, value: this.eventNotifier};
options.statusCode = StatusCodes.Good;
break;
case AttributeIds.ContainsNoLoops:
options.value = {dataType: DataType.Boolean, value: this.containsNoLoops};
options.statusCode = StatusCodes.Good;
break;
default:
return BaseNode.prototype.readAttribute.call(this, context, attributeId);
}
return new DataValue(options);
};
exports.View = View;
public async getPosition(): Promise {
await this.ensureInitialized();
if (!this.fileHandle) {
throw new Error("File has node been opened yet");
}
const result = await this.session.call({
inputArguments: [
{ dataType: DataType.UInt32, value: this.fileHandle }
],
methodId: this.getPositionNodeId,
objectId: this.fileNodeId
});
if (result.statusCode !== StatusCodes.Good) {
throw new Error("Error " + result.statusCode.toString());
}
return result.outputArguments![0].value as UInt64;
}
function prepareVariantValue(dataType, value) {
if ((dataType === DataType.Int32 || dataType === DataType.UInt32) && value && value.key) {
value = value.value;
}
return value;
}