本文整理匯總了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);
}