當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。