使用 CANoe COM Api 读取当前通道分配

Read the current channel assignment using the CANoe COM Api

我们正在使用 CANoe 的 COM API 和 Python comtypes 在复杂的测试环境中自动化 CANoe。在某些时候,CANoe 通道分配不是 stable,我们问自己是否可以自动读取 CANoe 通道分配,以便我们可以检查我们的测试环境是否是 stable。

CANoe 的完整 COM Object Hierarchy 可以在 CANoe 联机帮助中看到,但我完全迷失了,需要调用哪些函数来重现屏幕截图下方的 table。

以下是我本地 PC 上的对话示例,因为我不允许在这道题中展示真正的作业。一切都是灰色的,因为我的本地 PC 上没有安装真正的硬件,也没有许可证。

您可以使用Application.Networks获取每个通道,然后使用XL中的xlGetApplConfig函数Driver Library 获取CANoe工程的通道分配。 这里是Manual of the XL Driver Library

下面是 xlGetApplConfig 函数的定义。使用“CANoe”作为appName的输入。

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