pythoncomcanoecomtypes

Read the current channel assignment using the CANoe COM Api


We are using the COM API of CANoe together with Python comtypes automize CANoe in a complex test environment. At some point the CANoe channel assignment was not stable and we asked ourselves if it might be possible to read the CANoe channel assignment automatically, so that we can check if our test environment is stable.

The complete COM Object Hierarchy of CANoe is visible in the CANoe online help, but I'm completely lost, which functions needs to called to reproduce the table found underneath in the screenshot.

Below is a sample of the dialogue on my local PC, as I'm not allowed to show the real assignment in this question. Everythin is gray, as I don't have real hardware on my local PC installed and also no license.

Dialogue of CANoe channel assignment


Solution

  • You can use Application.Networks to get every channel, then use xlGetApplConfig function in the XL Driver Library to get the channel assignment of CANoe project. Here is the Manual of the XL Driver Library.

    Below is the definition of the xlGetApplConfig function. Use "CANoe" as the input of appName.

    XLstatus xlGetApplConfig( 
      char        *appName  
      unsigned int   appChannel, 
      unsigned int   *pHwType,  
      unsigned int   *pHwIndex, 
      unsigned int   *pHwChannel, 
      unsigned int  busType)