本文整理匯總了TypeScript中node-opcua-nodeid.NodeId.hasOwnProperty方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript NodeId.hasOwnProperty方法的具體用法?TypeScript NodeId.hasOwnProperty怎麽用?TypeScript NodeId.hasOwnProperty使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類node-opcua-nodeid.NodeId
的用法示例。
在下文中一共展示了NodeId.hasOwnProperty方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: nodeID_encodingByte
function nodeID_encodingByte(nodeId: NodeId): number {
if (!nodeId) {
return 0;
}
assert(nodeId.hasOwnProperty("identifierType"));
let encodingByte = 0;
if (nodeId.identifierType === NodeIdType.NUMERIC) {
if (isUInt8(nodeId.value as number) &&
!nodeId.namespace &&
!(nodeId as ExpandedNodeId).namespaceUri &&
!(nodeId as ExpandedNodeId).serverIndex) {
encodingByte = encodingByte | EnumNodeIdEncoding.TwoBytes;
} else if (
isUInt16(nodeId.value as number) &&
isUInt8(nodeId.namespace) &&
!(nodeId as ExpandedNodeId).namespaceUri &&
!(nodeId as ExpandedNodeId).serverIndex
) {
encodingByte = encodingByte | EnumNodeIdEncoding.FourBytes;
} else {
encodingByte = encodingByte | EnumNodeIdEncoding.Numeric;
}
} else if (nodeId.identifierType === NodeIdType.STRING) {
encodingByte = encodingByte | EnumNodeIdEncoding.String;
} else if (nodeId.identifierType === NodeIdType.BYTESTRING) {
encodingByte = encodingByte | EnumNodeIdEncoding.ByteString;
} else if (nodeId.identifierType === NodeIdType.GUID) {
encodingByte = encodingByte | EnumNodeIdEncoding.Guid;
}
if (nodeId.hasOwnProperty("namespaceUri") && (nodeId as ExpandedNodeId).namespaceUri) {
encodingByte = encodingByte | EnumNodeIdEncoding.NamespaceUriFlag;
}
if (nodeId.hasOwnProperty("serverIndex") && (nodeId as ExpandedNodeId).serverIndex) {
encodingByte = encodingByte | EnumNodeIdEncoding.ServerIndexFlag;
}
return encodingByte;
}