|
AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
|
An interface for using a Rusoku TouCAN device via the VSCP CANAL api. More...
#include <toucan_vscp_canal.hpp>
Public Member Functions | |
| TouCANPlugin (std::int16_t deviceID, std::uint32_t serialNumber, std::uint16_t baudRate=250) | |
| Constructor for a TouCAN hardware plugin object. | |
| TouCANPlugin (std::string deviceName) | |
| Constructor for a TouCAN hardware plugin object. | |
| virtual | ~TouCANPlugin () |
| The destructor for TouCANPlugin. | |
| bool | get_is_valid () const override |
| Returns if the connection with the hardware is valid. | |
| void | close () override |
| Closes the connection to the hardware. | |
| void | open () override |
| Connects to the hardware. | |
| bool | read_frame (isobus::CANMessageFrame &canFrame) override |
Returns a frame from the hardware (synchronous), or false if no frame can be read. | |
| bool | write_frame (const isobus::CANMessageFrame &canFrame) override |
| Writes a frame to the bus (synchronous) | |
| bool | reconfigure (std::int16_t deviceID, std::uint32_t serialNumber, std::uint16_t baudRate=250) |
| Changes previously set configuration parameters. Only works if the device is not open. | |
| std::uint32_t | get_serial_number () const |
| Returns the currently configured serial number of the device which will be used to connect to the hardware. | |
Private Member Functions | |
| void | generate_device_name (std::int16_t deviceID, std::uint32_t serialNumber, std::uint16_t baudRate) |
| Generates a device name string for the TouCAN device. | |
Private Attributes | |
| std::string | name |
| A configuration string that is used to connect to the hardware through the CANAL api. | |
| std::uint32_t | handle = 0 |
| The handle that the driver returns to us for the open hardware. | |
| std::uint32_t | openResult = CANAL_ERROR_NOT_OPEN |
| Stores the result of the call to begin CAN communication. Used for is_valid check later. | |
| std::uint32_t | currentlyConfiguredSerialNumber = 0 |
| The serial number of the device that is being used. | |
An interface for using a Rusoku TouCAN device via the VSCP CANAL api.
Definition at line 28 of file toucan_vscp_canal.hpp.
| isobus::TouCANPlugin::TouCANPlugin | ( | std::int16_t | deviceID, |
| std::uint32_t | serialNumber, | ||
| std::uint16_t | baudRate = 250 ) |
Constructor for a TouCAN hardware plugin object.
| [in] | deviceID | The id to use for this device |
| [in] | serialNumber | The serial number of the CAN adapter to connect with |
| [in] | baudRate | The baud rate in thousands (250K baud would mean you need to pass in 250) |
Definition at line 20 of file toucan_vscp_canal.cpp.
|
explicit |
Constructor for a TouCAN hardware plugin object.
| [in] | deviceName | The channel to use. This string has a very specific structure that isn't defined anywhere except the source code for this specific CANAL implementation. |
Definition at line 25 of file toucan_vscp_canal.cpp.
|
virtual |
The destructor for TouCANPlugin.
Definition at line 30 of file toucan_vscp_canal.cpp.
|
overridevirtual |
Closes the connection to the hardware.
Implements isobus::CANHardwarePlugin.
Definition at line 39 of file toucan_vscp_canal.cpp.
|
private |
Generates a device name string for the TouCAN device.
| [in] | deviceID | The id to use for this device |
| [in] | serialNumber | The serial number of the CAN adapter to connect with |
| [in] | baudRate | The baud rate in thousands (250K baud would mean you need to pass in 250) |
Definition at line 114 of file toucan_vscp_canal.cpp.
|
overridevirtual |
Returns if the connection with the hardware is valid.
true if connected, false if not connected Implements isobus::CANHardwarePlugin.
Definition at line 34 of file toucan_vscp_canal.cpp.
| std::uint32_t isobus::TouCANPlugin::get_serial_number | ( | ) | const |
Returns the currently configured serial number of the device which will be used to connect to the hardware.
Definition at line 109 of file toucan_vscp_canal.cpp.
|
overridevirtual |
Connects to the hardware.
Implements isobus::CANHardwarePlugin.
Definition at line 45 of file toucan_vscp_canal.cpp.
|
overridevirtual |
Returns a frame from the hardware (synchronous), or false if no frame can be read.
| [in,out] | canFrame | The CAN frame that was read |
true if a CAN frame was read, otherwise false Implements isobus::CANHardwarePlugin.
Definition at line 60 of file toucan_vscp_canal.cpp.
| bool isobus::TouCANPlugin::reconfigure | ( | std::int16_t | deviceID, |
| std::uint32_t | serialNumber, | ||
| std::uint16_t | baudRate = 250 ) |
Changes previously set configuration parameters. Only works if the device is not open.
| [in] | deviceID | The id to use for this device |
| [in] | serialNumber | The serial number of the CAN adapter to connect with |
| [in] | baudRate | The baud rate in thousands (250K baud would mean you need to pass in 250) |
Definition at line 97 of file toucan_vscp_canal.cpp.
|
overridevirtual |
Writes a frame to the bus (synchronous)
| [in] | canFrame | The frame to write to the bus |
true if the frame was written, otherwise false Implements isobus::CANHardwarePlugin.
Definition at line 82 of file toucan_vscp_canal.cpp.
|
private |
The serial number of the device that is being used.
Definition at line 87 of file toucan_vscp_canal.hpp.
|
private |
The handle that the driver returns to us for the open hardware.
Definition at line 85 of file toucan_vscp_canal.hpp.
|
private |
A configuration string that is used to connect to the hardware through the CANAL api.
Definition at line 84 of file toucan_vscp_canal.hpp.
|
private |
Stores the result of the call to begin CAN communication. Used for is_valid check later.
Definition at line 86 of file toucan_vscp_canal.hpp.