本文整理匯總了TypeScript中node-opcua-factory.BaseUAObject.binaryStoreSize方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript BaseUAObject.binaryStoreSize方法的具體用法?TypeScript BaseUAObject.binaryStoreSize怎麽用?TypeScript BaseUAObject.binaryStoreSize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類node-opcua-factory.BaseUAObject
的用法示例。
在下文中一共展示了BaseUAObject.binaryStoreSize方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: encodeMessage
function encodeMessage(msgType: string, messageContent: BaseUAObject, stream: OutputBinaryStream) {
// the length of the message, in bytes. (includes the 8 bytes of the message header)
const totalLength = messageContent.binaryStoreSize() + 8;
writeTCPMessageHeader(msgType, "F", totalLength, stream);
messageContent.encode(stream);
assert(totalLength === stream.length, "invalid message size");
}
示例2: packTcpMessage
export function packTcpMessage(msgType: string, encodableObject: BaseUAObject): Buffer {
assert(is_valid_msg_type(msgType));
const messageChunk = createFastUninitializedBuffer(encodableObject.binaryStoreSize() + 8);
// encode encodeableObject in a packet
const stream = new BinaryStream(messageChunk);
encodeMessage(msgType, encodableObject, stream);
return messageChunk;
}
示例3: analyze_object_binary_encoding
export function analyze_object_binary_encoding(obj: BaseUAObject) {
assert(obj);
const size = obj.binaryStoreSize();
console.log("-------------------------------------------------");
console.log(" size = ", size);
const stream = new BinaryStream(size);
obj.encode(stream);
stream.rewind();
console.log("-------------------------------------------------");
if (stream.buffer.length < 256) {
console.log(hexDump(stream.buffer));
console.log("-------------------------------------------------");
}
const reloadedObject = new (obj.constructor as any)();
analyzePacket(stream.buffer, reloadedObject, 0);
}
示例4: chunkSecureMessage
public chunkSecureMessage(
msgType: string,
options: ChunkMessageOptions,
message: BaseUAObject,
messageChunkCallback: MessageCallbackFunc) {
assert(_.isFunction(messageChunkCallback));
// calculate message size ( with its encodingDefaultBinary)
const binSize = message.binaryStoreSize() + 4;
const stream = new BinaryStream(binSize);
this._stream = stream;
encodeExpandedNodeId(message.schema.encodingDefaultBinary, stream);
message.encode(stream);
let securityHeader;
if (msgType === "OPN") {
securityHeader = this.securityHeader;
} else {
securityHeader = new SymmetricAlgorithmSecurityHeader({tokenId: options.tokenId});
}
const chunkManager = new SecureMessageChunkManager(
msgType, options, securityHeader, this.sequenceNumberGenerator
);
chunkManager
.on("chunk", (messageChunk: Buffer) => {
messageChunkCallback(messageChunk);
})
.on("finished", () => {
messageChunkCallback(null);
});
chunkManager.write(stream.buffer, stream.buffer.length);
chunkManager.end();
}
示例5: encoded
function encoded(obj: BaseUAObject) {
const stream = new BinaryStream(obj.binaryStoreSize());
obj.encode(stream);
return stream.buffer.toString("hex");
}