12#include "isobus/utility/system_timing.hpp"
17 std::unique_ptr<CANMessageData> data,
18 std::uint32_t parameterGroupNumber,
19 std::uint32_t totalMessageSize,
20 std::shared_ptr<ControlFunction> source,
21 std::shared_ptr<ControlFunction> destination,
23 void *parentPointer) :
25 parameterGroupNumber(parameterGroupNumber),
26 data(std::move(data)),
28 destination(destination),
29 totalMessageSize(totalMessageSize),
30 sessionCompleteCallback(sessionCompleteCallback),
86 timestamp_ms = SystemTiming::get_timestamp_ms();
100 std::static_pointer_cast<InternalControlFunction>(
source),
A representation of an ISOBUS ECU that we can send from. Use this class when defining your own contro...
Abstract base class for CAN transport protocols.
A interface class that represents data payload of a CAN message of arbitrary length.
An object to keep track of session information internally.
std::shared_ptr< ControlFunction > destination
The destination control function.
std::uint32_t get_time_since_last_update() const
Get the time that has passed since the last update of the timestamp.
std::uint32_t get_message_length() const
Get the total number of bytes that will be sent or received in this session.
std::shared_ptr< ControlFunction > get_destination() const
Get the control function that is receiving the message.
bool operator==(const TransportProtocolSessionBase &obj) const
A useful way to compare session objects to each other for equality,.
CANMessageData & get_data() const
Get the data buffer for the session.
Direction get_direction() const
Get the direction of the session.
std::uint32_t get_parameter_group_number() const
Get the parameter group number of the message.
Direction direction
The direction of the session.
bool matches(std::shared_ptr< ControlFunction > other_source, std::shared_ptr< ControlFunction > other_destination) const
Checks if the source and destination control functions match the given control functions.
std::shared_ptr< ControlFunction > get_source() const
Get the control function that is sending the message.
Direction
Enumerates the possible session directions.
@ Transmit
We are transmitting a message.
std::shared_ptr< ControlFunction > source
The source control function.
virtual std::uint32_t get_total_bytes_transferred() const =0
Get the number of bytes that have been sent or received in this session.
TransportProtocolSessionBase(TransportProtocolSessionBase::Direction direction, std::unique_ptr< CANMessageData > data, std::uint32_t parameterGroupNumber, std::uint32_t totalMessageSize, std::shared_ptr< ControlFunction > source, std::shared_ptr< ControlFunction > destination, TransmitCompleteCallback sessionCompleteCallback, void *parentPointer)
The constructor for a session.
TransmitCompleteCallback sessionCompleteCallback
A callback that is to be called when the session is completed.
std::uint32_t parameterGroupNumber
The PGN of the message.
std::uint32_t timestamp_ms
A timestamp used to track session timeouts.
std::uint32_t totalMessageSize
The total size of the message in bytes (the maximum size of a message is from ETP and can fit in an u...
void update_timestamp()
Update the timestamp of the session.
std::unique_ptr< CANMessageData > data
The data buffer for the message.
void * parent
A generic context variable that helps identify what object callbacks are destined for....
void complete(bool success) const
Complete the session.
float get_percentage_bytes_transferred() const
Get the percentage of bytes that have been sent or received in this session.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
void(*)(std::uint32_t parameterGroupNumber, std::uint32_t dataLength, std::shared_ptr< InternalControlFunction > sourceControlFunction, std::shared_ptr< ControlFunction > destinationControlFunction, bool successful, void *parentPointer) TransmitCompleteCallback
A callback for when a transmit is completed by the stack.