本文整理汇总了TypeScript中node-opcua-binary-stream.BinaryStream.readUInt16方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BinaryStream.readUInt16方法的具体用法?TypeScript BinaryStream.readUInt16怎么用?TypeScript BinaryStream.readUInt16使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类node-opcua-binary-stream.BinaryStream
的用法示例。
在下文中一共展示了BinaryStream.readUInt16方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: _decodeNodeId
function _decodeNodeId(encodingByte: number, stream: BinaryStream): NodeId {
let value;
let namespace;
let nodeIdType;
/*jslint bitwise: true */
encodingByte &= 0x3f; // 1 to 5
switch (encodingByte) {
case EnumNodeIdEncoding.TwoBytes:
value = stream.readUInt8();
nodeIdType = NodeIdType.NUMERIC;
break;
case EnumNodeIdEncoding.FourBytes:
namespace = stream.readUInt8();
value = stream.readUInt16();
nodeIdType = NodeIdType.NUMERIC;
break;
case EnumNodeIdEncoding.Numeric:
namespace = stream.readUInt16();
value = stream.readUInt32();
nodeIdType = NodeIdType.NUMERIC;
break;
case EnumNodeIdEncoding.String:
namespace = stream.readUInt16();
value = decodeString(stream);
nodeIdType = NodeIdType.STRING;
break;
case EnumNodeIdEncoding.ByteString:
namespace = stream.readUInt16();
value = decodeByteString(stream);
nodeIdType = NodeIdType.BYTESTRING;
break;
default:
if (encodingByte !== EnumNodeIdEncoding.Guid) {
/*jslint bitwise: true */
// console.log(" encoding_byte = 0x" + encodingByte.toString(16),
// " bin=", ("0000000000000000" + encodingByte.toString(2)).substr(-16),
// encodingByte, encodingByte & 0x3f);
throw new Error(" encoding_byte = " + encodingByte.toString(16));
}
namespace = stream.readUInt16();
value = decodeGuid(stream);
nodeIdType = NodeIdType.GUID;
assert(isValidGuid(value));
break;
}
return new NodeId(nodeIdType, value, namespace);
}
示例2: read_UInt16
function read_UInt16() {
return toHex(stream.readUInt16(), 4);
}
示例3: decodeUInt16
export function decodeUInt16(stream: BinaryStream): UInt16 {
return stream.readUInt16() as UInt16;
}