當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript BaseUAObject.binaryStoreSize方法代碼示例

本文整理匯總了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");
}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:9,代碼來源:tools.ts

示例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;

}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:12,代碼來源:tools.ts

示例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);

}
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:21,代碼來源:packet_analyzer.ts

示例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();
    }
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:40,代碼來源:message_chunker.ts

示例5: encoded

 function encoded(obj: BaseUAObject) {
     const stream = new BinaryStream(obj.binaryStoreSize());
     obj.encode(stream);
     return stream.buffer.toString("hex");
 }
開發者ID:node-opcua,項目名稱:node-opcua,代碼行數:5,代碼來源:compare_obj_by_encoding.ts


注:本文中的node-opcua-factory.BaseUAObject.binaryStoreSize方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。