chaitu-ycr / py_canoe

Python 🐍 Package for controlling Vector CANoe 🛶 Tool
https://chaitu-ycr.github.io/py_canoe/
MIT License
58 stars 34 forks source link

call_capl_func ERROR & Requesting Usage Example with any of the Existing Configuration #50

Closed NKP190599 closed 6 months ago

NKP190599 commented 6 months ago

Describe the bug we have added a CAPL Test node named "MyFunc" with function defined with no arguments and named as "MyFunc". We are trying to call it using the latest py_canoe Package as below:

canoe_int = CANoe(user_capl_functions=('MyFunc'))
canoe_int.open(canoe_cfg=r"C:\Users\Public\Documents\Vector\CANoe\Sample_Configurations_17.3.91\XCP_AMD\XCP_FlexRay\FlexRayXCP.cfg")
canoe_int.start_measurement()
#Tried a few combinations:
canoe_int.call_capl_function("MyFunc")
canoe_int.call_capl_function("MyFunc.MyFunc")
canoe_int.call_capl_function("MyFunc:MyFunc")
canoe_int.call_capl_function("MyFunc::MyFunc")

The MyFunc.can contains :

/*@!Encoding:65001*/

int MyFunc(){
return timeNow();
}

To Reproduce Steps to reproduce the behavior:

  1. Go to Default Path for the XCPFlexray.cfg in "C:\Users\Public\Documents\Vector\CANoe\Sample_Configurations_17.3.91\XCP_AMD\XCP_FlexRay\FlexRayXCP.cfg"

  2. Goto Simulation setup

  3. Add Capl Test Node

  4. Click on Edit - which will open a CAPL Browser

  5. Then Enter the code as above

  6. Open Cmd Prompt

  7. pip install py_canoe - downloads the latest version of package

  8. Run the above python code

Error :

*File "c:\Users\KXR1KOR\AppData\Local\Programs\Python\Python39\lib\site-packages\py_canoe.py", line 831, in call_capl_function exec_sts = capl_obj.call_capl_function(self.application.measurement.user_capl_function_obj_dict[name], arguments) KeyError: 'MyFunc::MyFunc'**

The Ket Error is for all the above combinations mentioned.

Expected behavior Run the command and print the time in message console as:

[*] [Program / Model] 17032

py_canoe Verison : py_canoe==2.1.3

OS and Vector CANoe (please complete the following information):

We want an Example for the Function use : "call_capl_function"

Thank You in Advance!

Thank You Mate

NKP190599 commented 6 months ago

My bad: The clear documentation is there under Test Folder