8:17, EET
February 19, 2020
Hello, How can I make a CALL EXECUTE to send a string in a simple way ?
Which call method might I need therefore ?
Right now in a simple way I set a parameter with:
NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;s=M_00:L_01:Speed’);
Label6.Caption:=UAClient.ReadValue(NodeID).ValueAsString;
UAClient.WriteValue(NodeID,Uint16(333));
I have now the NodeId for the Execute: Ns=1;i=8223 for the Execute ….
How can I send here the string “sendDig1 500” ?
Or do I need to use here the InputArguments which is i=82750 []
I need only to set this command, this is why I kept it relative simple (same for sending Uinz as per upper simple way).
Thanks alot !
10:32, EET
February 19, 2020
This is my NodeID: of the Execute (where I want to send the Command): ns=1;i=8223
Because I think, it will not work like this:
…
NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;i=8223’);
UAClient.WriteValue(NodeId, String(‘SendDig1 500’));
…
Or might I need to do this with a kind of call(execute) routine ?
Thanks alot for any help.
11:37, EET
November 28, 2018
Hi,
Indeed, WriteValue function is used for writing a value to a specific Node. To call a method, use TUaClient.Call. This is explained in the Delphi SDK’s online help: https://downloads.prosysopc.com/sentrol/opcua/tutorials/Prosys_OPC_UA_Delphi_SDK_Client_Tutorial.html#call-methods
Hope this helps and let us know if there are more questions 🙂
16:25, EET
February 19, 2020
Thanks alot for your help !
How might I need to declare this call ? UaClient.Call(ObjectId, MethodId, InputArguments);
In a simple way (due to it is only for 1 command – repsectievly to execute the call of SendDig1 500), would it be something like:
NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;i=8223’);
UAClient.Call(NodeID, NodeID, String(‘SendDig1 500’));
(I could send you a picture how it looks like in the UAexpert)
Thanks alot !
19:21, EET
November 28, 2018
Getting close! Some changes still. The first argument is the NodeId of the object that your method is part of. Also, the type of input arguments is TArray. The same type is also used for method call result output arguments in case there are any. You should be able to make the call for example like this:
ObjectId: TUaNodeId;
Refs: TArray<IUaReferenceDescription>;
InputArgs: TArray<TUaVariant>;
OutputArgs: TArray<TUaVariant>;
begin
Refs := UAClient.AddressSpace.Browse(NodeId, bdInverse, Id_HasComponent, False, [ncObject]);
ObjectId := Refs[0].NodeId;
SetLength(InputArgs, 1);
InputArgs[0] := ‘SendDig1 500’;
OutputArgs := UAClient.Call(ObjectId, NodeId, InputArgs);
For more code examples, see UaSampleClient project that’s a part of Delphi SDK and check out unit UaCallMethodDlgs 🙂
19:07, EET
February 19, 2020
Hello, sorry to bother, I tried it but I will receive a Violation Exception:
Seems, I do not understand the routine call proper
I just wanted to add also: According the UaExpert: the BrowserName is: 1,”execute” and the NoteClass is: Method, NodeId is listed (for the Execute): ns=1;i=8467 and NamespaceIndex is: 1
(Something with the ObjectId, I make wrong…)
Here the code:
procedure TForm1.Button5Click(Sender: TObject);
var
ObjectId: TUaNodeId;
NodeId: TUaNodeId;
Refs: TArray;
InputArgs: TArray;
OutputArgs: TArray;
begin
NodeID:=UAClient.NamespaceTable.ParseNodeId(‘ns=1;i=8467’);
Refs := UAClient.AddressSpace.Browse(NodeId, bdInverse, Id_HasComponent, False, [ncObject]);
ObjectId :=Refs[0].NodeId;
SetLength(InputArgs, 1);
InputArgs[0] := ‘SetParam1 100’;
OutputArgs :=UAClient.Call(ObjectId, NodeId, InputArgs);
end;
12:03, EET
December 21, 2011
13:18, EET
February 19, 2020
15:38, EET
December 21, 2011
Please try with the Delphi sample and verify what you are doing differently by debugging the parameters that it sends to the server in Delphi.
You can also use Wireshark to compare the parameter values on wire. See this for help:
Most Users Ever Online: 1919
Currently Online:
13 Guest(s)
Currently Browsing this Page:
1 Guest(s)
Top Posters:
Heikki Tahvanainen: 402
hbrackel: 144
rocket science: 88
pramanj: 86
Francesco Zambon: 83
Ibrahim: 78
Sabari: 62
kapsl: 57
gjevremovic: 49
Xavier: 43
Member Stats:
Guest Posters: 0
Members: 730
Moderators: 7
Admins: 1
Forum Stats:
Groups: 3
Forums: 15
Topics: 1529
Posts: 6471
Newest Members:
rickykennion, PromotionToold, HypromeImpupe, toneylapham544, rondawolinski7, Marypof5711, roycedelargie91, kourtneyquisenbe, ellis87832073466, zkxwilliemaeModerators: Jouni Aro: 1026, Pyry: 1, Petri: 0, Bjarne Boström: 1032, Jimmy Ni: 26, Matti Siponen: 349, Lusetti: 0
Administrators: admin: 1