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


TypeScript node-opcua-factory.constructObject函数代码示例

本文整理汇总了TypeScript中node-opcua-factory.constructObject函数的典型用法代码示例。如果您正苦于以下问题:TypeScript constructObject函数的具体用法?TypeScript constructObject怎么用?TypeScript constructObject使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: constructObject

 public constructObject(id: ExpandedNodeId): ExtensionObject {
     const obj = constructObject(id);
     if (!(obj instanceof ExtensionObject)) {
         throw new Error("Internal Error constructObject");
     }
     return obj as ExtensionObject;
 }
开发者ID:node-opcua,项目名称:node-opcua,代码行数:7,代码来源:factory.ts

示例2: resolveDynamicExtensionObject

export async function resolveDynamicExtensionObject(
  variant: Variant,
  extraDataType: ExtraDataTypeManager
) {

    if (variant.dataType !== DataType.ExtensionObject) {
        return;
    }
    if (!(variant.value instanceof OpaqueStructure)) {
        return;
    }

    const opaque = variant.value as OpaqueStructure;

    const namespaceUri = extraDataType.namespaceArray[opaque.nodeId.namespace];
    const exapndedNodeId  = ExpandedNodeId.fromNodeId(opaque.nodeId, namespaceUri);

    const object = constructObject(exapndedNodeId);

    const stream = new BinaryStream(opaque.buffer);
    object.decode(stream);

    variant.value = object;

}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:25,代码来源:resolve_dynamic_extension_object.ts

示例3: encode_decode_round_trip_test

export function encode_decode_round_trip_test(obj: any, options: any, callback_buffer?: any) {

    if (!callback_buffer && _.isFunction(options)) {
        callback_buffer = options;
        options = {};
    }

    callback_buffer = callback_buffer || dump_block_in_debug_mode;

    should.exist(obj);

    const size = obj.binaryStoreSize(options);

    const stream = new BinaryStream(Buffer.alloc(size));

    obj.encode(stream, options);

    callback_buffer(stream.buffer, obj.encodingDefaultBinary, options);

    stream.rewind();

    // reconstruct a object ( some object may not have a default Binary and should be recreated
    const expandedNodeId = obj.encodingDefaultBinary;
    const objReloaded = expandedNodeId ? constructObject(expandedNodeId) : new obj.constructor();

    objReloaded.decode(stream, options);

    redirectToNull(() => analyze_object_binary_encoding(obj));
    compare(objReloaded, obj);
    return objReloaded;
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:31,代码来源:encode_decode_round_trip_test.ts

示例4: analyseExtensionObject

export function analyseExtensionObject(buffer: Buffer, padding: number, offset: number, customOptions?: AnalyzePacketOptions) {

    const stream = new BinaryStream(buffer);
    let id;
    let objMessage;
    try {

        id = decodeExpandedNodeId(stream);
        objMessage = constructObject(id);
    } catch (err) {
        console.log(id);
        console.log(err);
        console.log("Cannot read decodeExpandedNodeId  on stream " + stream.buffer.toString("hex"));
    }
    _internalAnalyzePacket(buffer, stream, objMessage, padding, customOptions, offset);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:16,代码来源:packet_analyzer.ts

示例5: BinaryStream

 messageBuilder.once("full_message_body", (fullMessageBody: Buffer) => {
     const stream = new BinaryStream(fullMessageBody);
     const id = decodeExpandedNodeId(stream);
     objMessage = constructObject(id);
     objMessage.decode(stream);
 });
开发者ID:node-opcua,项目名称:node-opcua,代码行数:6,代码来源:test_x509_signature.ts

示例6: constructEmptyExtensionObject

function constructEmptyExtensionObject(expandedNodeId: NodeId): any {
    return constructObject(expandedNodeId as ExpandedNodeId);
}
开发者ID:node-opcua,项目名称:node-opcua,代码行数:3,代码来源:extension_object.ts


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