本文整理汇总了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;
}
示例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;
}
示例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;
}
示例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);
}
示例5: BinaryStream
messageBuilder.once("full_message_body", (fullMessageBody: Buffer) => {
const stream = new BinaryStream(fullMessageBody);
const id = decodeExpandedNodeId(stream);
objMessage = constructObject(id);
objMessage.decode(stream);
});
示例6: constructEmptyExtensionObject
function constructEmptyExtensionObject(expandedNodeId: NodeId): any {
return constructObject(expandedNodeId as ExpandedNodeId);
}