Transport Protocol API
-
std::list<std::shared_ptr<TransportProtocolSessionBase>> isobus::CANNetworkManager::get_active_transport_protocol_sessions(std::uint8_t canPortIndex) const
Gets all the active transport protocol sessions that are currently active.
Note
The list returns pointers to the transport protocol sessions, but they can disappear at any time
- Parameters:
canPortIndex – [in] The CAN channel index to get the transport protocol sessions for
- Returns:
A list of all the active transport protocol sessions
-
class TransportProtocolSessionBase
An object to keep track of session information internally.
Subclassed by isobus::ExtendedTransportProtocolManager::ExtendedTransportProtocolSession, isobus::FastPacketProtocol::FastPacketProtocolSession, isobus::TransportProtocolManager::TransportProtocolSession
Public Types
Public Functions
The constructor for a session.
- Parameters:
direction – [in] The direction of the session
data – [in] Data buffer (will be moved into the session)
parameterGroupNumber – [in] The PGN of the message
totalMessageSize – [in] The total size of the message in bytes
source – [in] The source control function
destination – [in] The destination control function
sessionCompleteCallback – [in] A callback for when the session completes
parentPointer – [in] A generic context object for the tx complete and chunk callbacks
-
TransportProtocolSessionBase(TransportProtocolSessionBase &&other) = default
The move constructor.
- Parameters:
other – [in] The object to move
-
TransportProtocolSessionBase &operator=(TransportProtocolSessionBase &&other) = default
The move assignment operator.
- Parameters:
other – [in] The object to move
- Returns:
A reference to the moved object
-
virtual ~TransportProtocolSessionBase() = default
The destructor for a session.
-
Direction get_direction() const
Get the direction of the session.
- Returns:
The direction of the session
-
bool operator==(const TransportProtocolSessionBase &obj) const
A useful way to compare session objects to each other for equality,.
A session is considered equal when the source and destination control functions and parameter group number match. Note that we don’t compare the super class, so this should only be used to compare sessions of the same type.
- Parameters:
obj – [in] The object to compare to
- Returns:
true if the objects are equal, false if not
Checks if the source and destination control functions match the given control functions.
- Parameters:
other_source – [in] The control function to compare with the source control function.
other_destination – [in] The control function to compare with the destination control function.
- Returns:
True if the source and destination control functions match the given control functions, false otherwise.
-
CANMessageData &get_data() const
Get the data buffer for the session.
- Returns:
The data buffer for the session
-
std::uint32_t get_message_length() const
Get the total number of bytes that will be sent or received in this session.
- Returns:
The length of the message in number of bytes
-
virtual std::uint32_t get_total_bytes_transferred() const = 0
Get the number of bytes that have been sent or received in this session.
- Returns:
The number of bytes that have been sent or received
-
float get_percentage_bytes_transferred() const
Get the percentage of bytes that have been sent or received in this session.
- Returns:
The percentage of bytes that have been sent or received (between 0 and 100)
-
std::shared_ptr<ControlFunction> get_source() const
Get the control function that is sending the message.
- Returns:
The source control function
-
std::shared_ptr<ControlFunction> get_destination() const
Get the control function that is receiving the message.
- Returns:
The destination control function
-
std::uint32_t get_parameter_group_number() const
Get the parameter group number of the message.
- Returns:
The PGN of the message