Vector XL Driver Library Wrapper for Python.
- Vector XL Driver Library inlclude dlls for C/C++, C# but not for Python.
- pyxldrv makes the dll for C/C++ an importable library(vxlapi).
- To wrap C/C++ dll, pyxldrv uses Cython.
- Cython generates a library for Python("vxlapi.xxxxxx.pyd") from Cython codes(vxlapi.pxd and vxlapi.pyx).
import vxlapi as xl
ret = xl.OpenDriver()
....
msgs = []
msgs.append({"flags":0, "id":0x321, "dlc":8, "data":bytearray([0x12,0x34,0x56,0x78,0x9A,0xBC,0xDE,0xF0])})
message_count = [len(msgs)]
status = xl.CanTransmit(portHandle[0], accessMask, message_count, msgs)
...
ret = xl.CloseDriver()
- and there is an additional wrapper class for CAN(can.py).
- Get XL Driver Library and Vector Driver Setup from Vector Download-Center and install them.
-
Get Cython via pip at first.
-
For Python 3.6
name | support | remark |
---|---|---|
xlOpenDriver | yes | |
xlCloseDriver | yes | |
xlGetApplConfig | yes | |
xlSetApplConfig | yes | |
xlGetDriverConfig | yes | |
xlGetRemoteDriverConfig | yes | not tested. |
xlGetChannelIndex | yes | not tested. |
xlGetChannelMask | yes | |
xlOpenPort | yes | |
xlClosePort | yes | |
xlSetTimerRate | yes | not tested. |
xlSetTimerRateAndChannel | yes | not tested. |
xlResetClock | yes | not tested. |
xlSetNotification | yes | |
xlFlushReceiveQueue | yes | not tested. |
xlGetReceiveQueueLevel | yes | not tested. |
xlActivateChannel | yes | |
xlReceive | yes | |
xlGetEventString | yes | xlReceive and xlGetEventString are intergrated into vxlapi.Receive. |
xlGetErrorString | yes | |
xlGetSyncTime | yes | not tested. |
xlGetChannelTime | yes | not tested. |
xlGenerateSyncPulse | yes | not tested. |
xlPopupHwConfig | yes | |
xlDeactivateChannel | yes | |
xlGetLicenseInfo | yes | not tested. |
xlSetGlobalTimeSync | yes | not tested. |
xlGetKeymanBoxes | yes | not tested. |
xlGetKeymanInfo | yes | not tested. |
name | support | remark |
---|---|---|
xlCanSetChannelMode | yes | not tested. |
xlCanSetChannelOutput | yes | not tested. |
xlCanSetReceiveMode | yes | not tested. |
xlCanSetChannelTransceiver | yes | not tested. |
xlCanSetChannelParams | yes | not tested. |
xlCanSetChannelParamsC200 | yes | not tested. |
xlCanSetChannelBitrate | yes | |
xlCanSetChannelAcceptance | yes | not tested. |
xlCanAddAcceptanceRange | yes | not tested. |
xlCanRemoveAcceptanceRange | yes | not tested. |
xlCanResetAcceptance | yes | not tested. |
xlCanRequestChipState | yes | not tested. |
xlCanTransmit | yes | |
xlCanFlushTransmitQueue | yes | not tested. |
name | support | remark |
---|---|---|
xlCanFdSetConfiguration | yes | not tested. |
xlCanTransmitEx | yes | not tested. |
xlCanReceive | no | |
xlCanGetEventString | no |
to be suported. 3rd
to be suported. 4th
not to be supported at this moment.
For debugging vxlapi.pyx, DebugView for Windows can be used. Because DebugView for Windows shows native side(vxlapi.dll) function's status, "debug print" can be reduced.
See XL Driver Library - Description.pdf
The XL Driver Library supports debug prints which can be enabled in the Vector Hardware Configuration tool. In section General information, select Settings and double-click on Configuration flags. Enter the required flag (see table below). To activate the flags, restart the PC.
Flags | Supported Bus Type |
---|---|
0x400000 | CAN, LIN, DAIO |
0x002000 | MOST |
0x010000 | FlexRay |
python setup.py build_ext -i --compiler=msvc
setup.py supports only for 64bit version but you can use
python -m unittest tests.test_basic