当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript BinaryStream.writeUInt8方法代码示例

本文整理汇总了TypeScript中node-opcua-binary-stream.BinaryStream.writeUInt8方法的典型用法代码示例。如果您正苦于以下问题:TypeScript BinaryStream.writeUInt8方法的具体用法?TypeScript BinaryStream.writeUInt8怎么用?TypeScript BinaryStream.writeUInt8使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在node-opcua-binary-stream.BinaryStream的用法示例。


在下文中一共展示了BinaryStream.writeUInt8方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: write_header

    public write_header(finalC: string, buffer: Buffer, length: number): void {
        assert(buffer.length > 12);
        assert(finalC.length === 1);
        assert(buffer instanceof Buffer);

        const stream = new BinaryStream(buffer);

        // message header --------------------------
        // ---------------------------------------------------------------
        // OPC UA Secure Conversation Message Header : Part 6 page 36
        // MessageType     Byte[3]
        // IsFinal         Byte[1]  C : intermediate, F: Final , A: Final with Error
        // MessageSize     UInt32   The length of the MessageChunk, in bytes. This value includes size of the message header.
        // SecureChannelId UInt32   A unique identifier for the ClientSecureChannelLayer assigned by the server.

        stream.writeUInt8(this.msgType.charCodeAt(0));
        stream.writeUInt8(this.msgType.charCodeAt(1));
        stream.writeUInt8(this.msgType.charCodeAt(2));
        stream.writeUInt8(finalC.charCodeAt(0));

        stream.writeUInt32(length);
        stream.writeUInt32(this.channelId);

        assert(stream.length === 12);

        // write Security Header -----------------
        this.securityHeader.encode(stream);
        assert(stream.length === this.headerSize);
    }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:29,代码来源:secure_message_chunk_manager.ts

示例2: randomGuid

export  function randomGuid(): Guid {
    const b = new BinaryStream(20);
    for (let i = 0; i < 20; i++) {
        b.writeUInt8(getRandomInt(0, 255));
    }
    b.rewind();
    const value = decodeGuid(b) as Guid;
    return value;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:9,代码来源:guid.ts


注:本文中的node-opcua-binary-stream.BinaryStream.writeUInt8方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。