本文整理汇总了TypeScript中node-opcua-data-model.makeNodeClassMask函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeNodeClassMask函数的具体用法?TypeScript makeNodeClassMask怎么用?TypeScript makeNodeClassMask使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeNodeClassMask函数的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: it
it("should browse multiple nodes ", async () => {
const nodeToBrowse = /*BrowseDescription*/ {
browseDirection: BrowseDirection.Forward,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Object"),
nodeId: "i=84",
referenceTypeId: null,
resultMask: makeResultMask("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
};
const browseResults = await session.browse([nodeToBrowse, nodeToBrowse]);
browseResults.should.be.instanceOf(Array);
browseResults[0].constructor.name.should.eql("BrowseResult");
browseResults[0].references!.length.should.eql(3);
browseResults[0].references![0].browseName.toString().should.eql("Objects");
browseResults[0].references![1].browseName.toString().should.eql("Types");
browseResults[0].references![2].browseName.toString().should.eql("Views");
browseResults[1].constructor.name.should.eql("BrowseResult");
browseResults[1].references!.length.should.eql(3);
browseResults[1].references![0].browseName.toString().should.eql("Objects");
browseResults[1].references![1].browseName.toString().should.eql("Types");
browseResults[1].references![2].browseName.toString().should.eql("Views");
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:27,代码来源:test_pseudo_session.ts
示例2: makeNodeClassMask
const nodesToBrowse2 = references.map((ref: ReferenceDescription) => {
return {
browseDirection: BrowseDirection.Inverse,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Object | Variable"),
nodeId: ref.nodeId,
referenceTypeId: resolveNodeId("HasDescription"),
resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
};
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:10,代码来源:client_dynamic_extension_object.ts
示例3: extractNamespaceDataType
export async function extractNamespaceDataType(
session: IBasicSession,
dataTypeManager: ExtraDataTypeManager
) {
// read namespace array
const dataValueNamespaceArray = await session.read({
attributeId: AttributeIds.Value,
nodeId: resolveNodeId("Server_NamespaceArray")
});
if (dataValueNamespaceArray.statusCode === StatusCodes.Good) {
dataTypeManager.setNamespaceArray(dataValueNamespaceArray.value.value as string[]);
}
// DatType/OPCBinary => i=93 [OPCBinarySchema_TypeSystem]
const opcBinaryNodeId = resolveNodeId("OPCBinarySchema_TypeSystem");
const nodeToBrowse = {
browseDirection: BrowseDirection.Forward,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Variable"),
nodeId: opcBinaryNodeId,
referenceTypeId: resolveNodeId("HasComponent"),
resultMask: makeResultMask("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
};
const result = await session.browse(nodeToBrowse);
// filter nodes that have the expected namespace Index
const references = result.references!.filter(
(e: ReferenceDescription) => e.nodeId.namespace !== 0);
/* istanbul ignore next */
if (references.length === 0) {
return;
}
for (const ref of references) {
const typeDictionary = await extractSchema(session, ref.nodeId);
await exploreDataTypeDefinition(session, ref.nodeId, typeDictionary, dataTypeManager.namespaceArray);
dataTypeManager.registerTypeDictionary(ref.nodeId, typeDictionary);
}
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:43,代码来源:client_dynamic_extension_object.ts
示例4: it
it("should return 1 refs for browseNode on Server (BrowseDirection.Forward) and NodeClass set to Method", () => {
const mask = makeNodeClassMask("Method");
const server = rootFolder.objects.server;
server.browseName.toString().should.equal("Server");
const references = server.browseNode({
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
nodeClassMask: mask, // <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
referenceTypeId: "HierarchicalReferences",
resultMask: 0x3F
});
const browseNames = references.map((r) => r.browseName.name);
references.length.should.equal(1);
const expectedBrowseNames = ["GetMonitoredItems"];
_.intersection(browseNames, expectedBrowseNames).length.should.eql(expectedBrowseNames.length);
});
开发者ID:node-opcua,项目名称:node-opcua,代码行数:23,代码来源:test_referencetype.ts
示例5: exploreDataTypeDefinition
export async function exploreDataTypeDefinition(
session: IBasicSession,
dataTypeDictionaryTypeNode: NodeId,
typeDictionary: TypeDictionary,
namespaces: string[]
) {
const nodeToBrowse = {
browseDirection: BrowseDirection.Forward,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Variable"),
nodeId: dataTypeDictionaryTypeNode,
referenceTypeId: resolveNodeId("HasComponent"),
resultMask: makeResultMask("ReferenceType | IsForward | BrowseName | NodeClass | TypeDefinition")
};
const result = await session.browse(nodeToBrowse);
const references = result.references || [];
/* istanbul ignore next */
if (references.length === 0) {
return;
}
// request the Definition of each not
const nodesToBrowse2 = references.map((ref: ReferenceDescription) => {
return {
browseDirection: BrowseDirection.Inverse,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Object | Variable"),
nodeId: ref.nodeId,
referenceTypeId: resolveNodeId("HasDescription"),
resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
};
});
const results2 = await session.browse(nodesToBrowse2);
const binaryEncodingNodeIds = results2.map((br: BrowseResult) => {
const defaultBin = br.references!.filter((r: ReferenceDescription) => r.browseName.toString() === "Default Binary");
/* istanbul ignore next */
if (defaultBin.length < 1) {
return ExpandedNodeId;
}
return ExpandedNodeId.fromNodeId(defaultBin[0].nodeId, namespaces[defaultBin[0].nodeId.namespace]);
});
const tuples = _.zip(references, binaryEncodingNodeIds);
for (const [ref, defaultBinary] of tuples) {
const name = ref.browseName!.name!.toString();
const constructor = getOrCreateConstructor(name, typeDictionary, defaultBinary);
/* istanbul ignore next */
if (doDebug) {
try {
const testObject = new constructor();
debugLog(testObject.toString());
} catch (err) {
debugLog(err.message);
}
}
}
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:63,代码来源:client_dynamic_extension_object.ts
示例6: getDataTypeDefinition
export async function getDataTypeDefinition(session: IBasicSession, dataTypeNodeId: NodeId): Promise<void> {
// DataType
// | 1
// | n
// +- HasEncoding-> "Default Binary"
// |
// +-- HasDescription -> "MyItemType"
// +- ComponentOf -> Schema
//
// Note that in 1.04 compliant server, DataType definition might be available
// in a DataTypeDefinition attributes of the DataType object
// However this is a brand new aspect of the specification and is not widely implemented
// it is also optional
// It will takes time for old opcua server to be refurbished and we may have to
// keep the current method to access type definition from embedded xsd.
//
const nodeToBrowse1 = {
browseDirection: BrowseDirection.Forward,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Object"),
nodeId: dataTypeNodeId,
referenceTypeId: resolveNodeId("HasEncoding"),
resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
};
const result1 = await session.browse(nodeToBrowse1);
assert(result1.references && result1.references.length === 1);
const encodingReference = result1.references![0]!;
assert(encodingReference.browseName.toString() === "Default Binary");
// Xx console.log("Has Encoding ", encodingReference.browseName.toString(), encodingReference.nodeId.toString());
const nodeToBrowse2 = {
browseDirection: BrowseDirection.Forward,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Variable"),
nodeId: encodingReference.nodeId,
referenceTypeId: resolveNodeId("HasDescription"),
resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
};
const result2 = await session.browse(nodeToBrowse2);
assert(result2.references && result2.references.length === 1);
const definitionRef = result2.references![0]!;
// xx console.log("HasDefinition ", definitionRef.browseName.toString(), definitionRef.nodeId.toString());
const nameDataValue = await session.read({
attributeId: AttributeIds.Value,
nodeId: definitionRef.nodeId
});
const name = nameDataValue.value.value as string;
// xx console.log("name ", name);
// find parent node to access the xsd File
const nodeToBrowse3 = {
browseDirection: BrowseDirection.Inverse,
includeSubtypes: false,
nodeClassMask: makeNodeClassMask("Variable"),
nodeId: definitionRef.nodeId,
referenceTypeId: resolveNodeId("HasComponent"),
resultMask: makeResultMask("NodeId | ReferenceType | BrowseName | NodeClass | TypeDefinition")
};
const result3 = await session.browse(nodeToBrowse3);
assert(result3.references && result3.references.length === 1);
const schemaNode = result3.references![0]!.nodeId;
const typeDictionary = await extractSchema(session, schemaNode);
return (typeDictionary.structuredTypes as any)[name];
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:69,代码来源:client_dynamic_extension_object.ts
示例7: readUAStructure
export function readUAStructure(
proxyManager: UAProxyManager,
obj: any,
callback: ErrorCallback
) {
const session = proxyManager.session;
// 0 Object
// 1 Variable
// 2 Method
const nodeId = obj.nodeId;
const nodesToBrowse = [
// Components (except Methods)
{
// BrowseDescription
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
nodeClassMask: makeNodeClassMask("Object | Variable"), // we don't want Method here
nodeId,
referenceTypeId: makeRefId("HasComponent"),
resultMask,
},
// Properties
{
// BrowseDescription
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
// nodeClassMask: makeNodeClassMask("Variable"),
nodeId,
referenceTypeId: makeRefId("HasProperty"),
resultMask
},
// Methods
{
// BrowseDescription
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
nodeClassMask: makeNodeClassMask("Method"),
nodeId,
referenceTypeId: makeRefId("HasComponent"),
resultMask
},
// TypeDefinition
{
// BrowseDescription
browseDirection: BrowseDirection.Both,
includeSubtypes: true,
nodeId,
referenceTypeId: makeRefId("HasTypeDefinition"),
resultMask
},
// FromState
{
// BrowseDescription
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
nodeId,
referenceTypeId: makeRefId("FromState"),
resultMask
},
// ToState
{
// BrowseDescription
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
nodeId,
referenceTypeId: makeRefId("ToState"),
resultMask
},
// (for folders ) Organizes
{
// BrowseDescription
browseDirection: BrowseDirection.Forward,
includeSubtypes: true,
nodeId,
referenceTypeId: makeRefId("Organizes"),
resultMask
}
];
session.browse(nodesToBrowse, (err: Error | null, browseResults?: BrowseResult[]) => {
function t(references: ReferenceDescription[]) {
return references.map((r: ReferenceDescription) => r.browseName.name + " " + r.nodeId.toString());
}
browseResults = browseResults || [];
// istanbul ignore next
if (err) {
return callback(err);
}
// xx console.log("Components", t(results[0].references));
// xx console.log("Properties", t(results[1].references));
// xx console.log("Methods", t(results[2].references));
async.parallel([
//.........这里部分代码省略.........
开发者ID:node-opcua,项目名称:node-opcua,代码行数:101,代码来源:object_explorer.ts
注:本文中的node-opcua-data-model.makeNodeClassMask函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论