IOControl¶
-
class
canlib.canlib.IOControl(channel)[source]¶ Helper object for using
canIoCtlProvides a variety of functionality, some of which are represented as attributes of this object and some as functions. See the respective entries below for more information.
Variables: - brlimit – An
intwith the hardware bitrate limit, or zero for the device’s default. Write-only. - bus_type – A member of the
BusTypeGroupenum. Not implemented in Linux. Read-only. - buson_time_auto_reset – A
boolfor whether the CAN clock is reset at bus-on. Not implemented in Linux. Write-only. - channel_quality – An
intbetween 0 and 100 (inclusively) with the quality of the channel in percent. Not implemented in Linux. Read-only. - devname_ascii – A
strwith the current device name. Not implemented in Linux. Read-only. - driverhandle – The windows handle related to the CANlib handle. Not implemented in Linux. Read-only.
- error_frames_reporting – A
boolfor whether error frames are reported. Not implemented in Linux. Write-only. - eventhandle – An
intwith the windows event handle. Not implemented in Linux. Read-only. - local_txecho – A
boolfor whether local transmit echo is turned on. Write-only. - report_access_errors – A
boolfor whether Access Reporting is turned on - roundtrip_time – An
intwith the roundtrip time in milliseconds. Not implemented in Linux. Read-only. - rx_buffer_level – An
intwith the approximate receive queue level. Read-only. - rx_queue_size – An
intwith the size of the receive buffer. Can only be used off-bus. Not implemented in Linux. Write-only. - throttle_scaled – An
intbetween 0 and 100 (inclusively) where 0 means the device is very responsive but generates more CPU load and 100 means the device is less responsive with less CPU load. Note that not all devices support setting this. Some hardware will accept this command but neglect it. Not implemented in Linux. - time_since_last_seen – An
intwith the time in milliseconds since the last communication occured. Not implemented in Linux. Read-only. - timer_scale – An
intwith the time-stamp clock resolution in microseconds. - tx_buffer_level – An
intwith the approximate transmit queue level. Read-only. - tx_interval – An
intwith the number of microseconds with the minimum CAN message transmit interval. - txack – 0 for Transmit Acknowledges off, 1 for Transmit Acknowledges on, and 2 for Transmit Acknowledges off, even for the driver’s internal usage (this will break parts of the library).
- txrq – A
boolfor whether Transmit Requests are turned on. Write-only.
-
connect_to_virtual_bus(value)¶ Connects the channel to the virtual bus number
value.
-
disconnect_from_virtual_bus(value)¶ Disconnects the channel to the virtual bus number
value.
-
flush_rx_buffer()¶ Discard the current contents of the RX queue.
-
flush_tx_buffer()¶ Discard the current contents of the TX queue.
-
prefer_ext()¶ Tells CANlib to assume
MessageFlag.EXTwhen sending messages if neitherMessageFlag.EXTorMessageFlag.STDis specified. Not implemented in Linux.
-
prefer_std()¶ Tells CANlib to assume
MessageFlag.STDwhen sending messages if neitherMessageFlag.EXTorMessageFlag.STDis specified. Not implemented in Linux.
-
reset_overrun_count()¶ Resets overrun count and flags.
-
raw(item, value=None, ctype=<class 'ctypes.c_ulong'>)[source]¶ A raw call to
canIoCtlParameters: - item (
IOControlItem) – The “function code” to be passed tocanIoCtl. - value – The value sent to
canIoCtlorNoneif no value should be given. Must be compatible with thectypeargument. - ctype – The
ctypestype that should be used to when sending thevalueargument and when interpreting the result ofcanIoCtl.
- item (
- brlimit – An