NodeJS OPC UA Client - construct Extension Object |OPC UA Implementation: Stacks, Tools, and Samples|Forum|OPC Foundation

Avatar
Search
Forum Scope


Match



Forum Options



Minimum search word length is 3 characters - maximum search word length is 84 characters
Lost password?
sp_Feed sp_PrintTopic sp_TopicIcon
NodeJS OPC UA Client - construct Extension Object
Avatar
Lorenz Scherrer
New Member
Members
Forum Posts: 1
Member Since:
02/16/2023
sp_UserOfflineSmall Offline
1
02/21/2023 - 05:46
sp_Permalink sp_Print sp_EditHistory

Hello,

I am trying to interface with an RFID reader RFU6xx which implements an OPC-UA server.

 

I am trying to call the method ScanStart which has the inputargument of an extensionobject:

 

async StartScan(aduration: number, acycles: number, adataAvailable: boolean){

const scanSettingsParams = {
duration : aduration,
cycles : acycles,
dataAvailable : adataAvailable,
locationType: 0
}

try {
// NodeID for InputArguments struct type (inherits from ScanSettings)
console.log("Hello1");
const nodeID = new NodeId(NodeIdType.NUMERIC, 3010, 3);
console.log("Hello2");
// Create ExtensionObject for InputArguments
const scanSettingsObj = await this.session.constructExtensionObject(nodeID, scanSettingsParams);
console.log(scanSettingsObj);
// Populate Method call with ExtensionObject as InputArgument
const methodToCall: CallMethodRequestLike = {
methodId: ("ns=4;i=7002"),
objectId: ("ns=4;i=5002"),
inputArguments: [
{
dataType: DataType.ExtensionObject,
value: scanSettingsObj
}
]
};
console.log(methodToCall);
console.log("Hello4");
// Call method, passing ScanSettings as input argument
await this.session.call(methodToCall,(err,results) => {
if (err) {
console.log("Hello8: Error");
console.log(err);
} else {
console.log(results);
console.log("Hello7");
}
});
console.log("Hello5");

} catch (err) {
console.log("Hello6: Error");
console.log(err);
}

}

When the extension object is created, following warnings are displayed in the console:

Hello2

08:58:55.689Z :populate_data_type_manager_104:67 Error Error: Cannot find dataType Definition ! with nodeId =ns=2;i=6522... at C:\Development\Projects\sample_client_ts
ode_modules
ode-opcua-client-dynamic-extension-object\source\private\populate_data_type_manager_104.ts:46:19... at Generator.next ()... at fulfilled (C:\Development\Projects\sample_client_ts
ode_modules
ode-opcua-client-dynamic-extension-object\dist\private\populate_data_type_manager_104.js:5:58)... at processTicksAndRejections (node:internal/process/task_queues:96:5)08:58:55.701Z :populate_data_type_manager_104:67 Error Error: Cannot find dataType Definition ! with nodeId =ns=2;i=6525...

 

How do I construct the extensionobject the right way? 

Avatar
Randy Armstrong
Admin
Forum Posts: 1564
Member Since:
05/30/2017
sp_UserOfflineSmall Offline
2
02/21/2023 - 15:24
sp_Permalink sp_Print

Unfortunately, the best place to ask for help on different SDKs is the place where you got the SDK from.

There should be a way to register your custom type with the stack. This is a trivial step with the .NETStandard codebase.

Forum Timezone: America/Phoenix
Most Users Ever Online: 510
Currently Online: MUHAMMAD Naveed
Guest(s) 37
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Forum Stats:
Groups: 2
Forums: 10
Topics: 1435
Posts: 4855