AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
Public Member Functions | Protected Member Functions | Private Attributes | Friends | List of all members
isobus::TransportProtocolManager::TransportProtocolSession Class Reference

A storage object to keep track of session information internally. More...

#include <can_transport_protocol.hpp>

Inheritance diagram for isobus::TransportProtocolManager::TransportProtocolSession:
[legend]
Collaboration diagram for isobus::TransportProtocolManager::TransportProtocolSession:
[legend]

Public Member Functions

 TransportProtocolSession (TransportProtocolSessionBase::Direction direction, std::unique_ptr< CANMessageData > data, std::uint32_t parameterGroupNumber, std::uint16_t totalMessageSize, std::uint8_t clearToSendPacketMax, std::shared_ptr< ControlFunction > source, std::shared_ptr< ControlFunction > destination, TransmitCompleteCallback sessionCompleteCallback, void *parentPointer)
 The constructor for a session, for advanced use only. In most cases, you should use the CANNetworkManager::send_can_message() function to transmit messages.
 
StateMachineState get_state () const
 Get the state of the session.
 
std::uint16_t get_message_length () const
 Get the total number of bytes that will be sent or received in this session.
 
bool is_broadcast () const
 Get whether or not this session is a broadcast session (BAM)
 
std::uint32_t get_total_bytes_transferred () const override
 Get the number of bytes that have been sent or received in this session.
 
- Public Member Functions inherited from isobus::TransportProtocolSessionBase
 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.
 
 TransportProtocolSessionBase (TransportProtocolSessionBase &&other)=default
 The move constructor.
 
TransportProtocolSessionBaseoperator= (TransportProtocolSessionBase &&other)=default
 The move assignment operator.
 
virtual ~TransportProtocolSessionBase ()=default
 The destructor for a session.
 
Direction get_direction () const
 Get the direction of the session.
 
bool operator== (const TransportProtocolSessionBase &obj) const
 A useful way to compare session objects to each other for equality,.
 
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.
 
CANMessageDataget_data () const
 Get 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.
 
float get_percentage_bytes_transferred () const
 Get the percentage of bytes that have been sent or received in this session.
 
std::shared_ptr< ControlFunctionget_source () const
 Get the control function that is sending the message.
 
std::shared_ptr< ControlFunctionget_destination () const
 Get the control function that is receiving the message.
 
std::uint32_t get_parameter_group_number () const
 Get the parameter group number of the message.
 

Protected Member Functions

void set_state (StateMachineState value)
 Set the state of the session.
 
std::uint8_t get_cts_number_of_packets_remaining () const
 Get the number of packets to be sent in response to the current CTS.
 
void set_cts_number_of_packets (std::uint8_t value)
 Set the number of packets to be sent in response to the curent CTS.
 
std::uint8_t get_cts_number_of_packets () const
 Get the number of packets that can be sent in response to the current CTS.
 
std::uint8_t get_rts_number_of_packet_limit () const
 Get the maximum number of packets that can be sent per CTS as indicated by the RTS message.
 
std::uint8_t get_last_sequence_number () const
 Get the last sequence number that was processed.
 
std::uint8_t get_last_packet_number () const
 Get the last packet number that was processed.
 
void set_last_sequency_number (std::uint8_t value)
 Set the last sequence number that will be processed.
 
void set_acknowledged_packet_number (std::uint8_t value)
 Set the last acknowledged packet number by the receiver.
 
std::uint8_t get_number_of_remaining_packets () const
 Get the number of packets that remain to be sent or received in this session.
 
std::uint8_t get_total_number_of_packets () const
 Get the total number of packets that will be sent or received in this session.
 
- Protected Member Functions inherited from isobus::TransportProtocolSessionBase
void update_timestamp ()
 Update the timestamp of the session.
 
std::uint32_t get_time_since_last_update () const
 Get the time that has passed since the last update of the timestamp.
 
void complete (bool success) const
 Complete the session.
 

Private Attributes

StateMachineState state = StateMachineState::None
 The state machine state for this session.
 
std::uint8_t lastSequenceNumber = 0
 The last processed sequence number for this set of packets.
 
std::uint8_t lastAcknowledgedPacketNumber = 0
 The last acknowledged packet number by the receiver.
 
std::uint8_t clearToSendPacketCount = 0
 The number of packets to be sent in response to one CTS.
 
std::uint8_t clearToSendPacketCountMax = 0xFF
 The max packets that can be sent per CTS as indicated by the RTS message.
 

Friends

class TransportProtocolManager
 Allows the TP manager full access.
 

Additional Inherited Members

- Public Types inherited from isobus::TransportProtocolSessionBase
enum class  Direction { Transmit , Receive }
 Enumerates the possible session directions. More...
 

Detailed Description

A storage object to keep track of session information internally.

Definition at line 64 of file can_transport_protocol.hpp.

Constructor & Destructor Documentation

◆ TransportProtocolSession()

isobus::TransportProtocolManager::TransportProtocolSession::TransportProtocolSession ( TransportProtocolSessionBase::Direction direction,
std::unique_ptr< CANMessageData > data,
std::uint32_t parameterGroupNumber,
std::uint16_t totalMessageSize,
std::uint8_t clearToSendPacketMax,
std::shared_ptr< ControlFunction > source,
std::shared_ptr< ControlFunction > destination,
TransmitCompleteCallback sessionCompleteCallback,
void * parentPointer )

The constructor for a session, for advanced use only. In most cases, you should use the CANNetworkManager::send_can_message() function to transmit messages.

Parameters
[in]directionThe direction of the session
[in]dataData buffer (will be moved into the session)
[in]parameterGroupNumberThe PGN of the message
[in]totalMessageSizeThe total size of the message in bytes
[in]clearToSendPacketMaxThe maximum number of packets that can be sent per CTS as indicated by the RTS message
[in]sourceThe source control function
[in]destinationThe destination control function
[in]sessionCompleteCallbackA callback for when the session completes
[in]parentPointerA generic context object for the tx complete and chunk callbacks

Definition at line 26 of file can_transport_protocol.cpp.

Member Function Documentation

◆ get_cts_number_of_packets()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_cts_number_of_packets ( ) const
protected

Get the number of packets that can be sent in response to the current CTS.

Returns
The number of packets that can be sent in response to the current CTS

Definition at line 76 of file can_transport_protocol.cpp.

◆ get_cts_number_of_packets_remaining()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_cts_number_of_packets_remaining ( ) const
protected

Get the number of packets to be sent in response to the current CTS.

Returns
The number of packets to be sent in response to the current CTS

Definition at line 64 of file can_transport_protocol.cpp.

◆ get_last_packet_number()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_last_packet_number ( ) const
protected

Get the last packet number that was processed.

Returns
The last packet number that was processed

Definition at line 91 of file can_transport_protocol.cpp.

◆ get_last_sequence_number()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_last_sequence_number ( ) const
protected

Get the last sequence number that was processed.

Returns
The last sequence number that was processed

Definition at line 86 of file can_transport_protocol.cpp.

◆ get_message_length()

std::uint16_t isobus::TransportProtocolManager::TransportProtocolSession::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

Definition at line 37 of file can_transport_protocol.cpp.

Here is the call graph for this function:

◆ get_number_of_remaining_packets()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_number_of_remaining_packets ( ) const
protected

Get the number of packets that remain to be sent or received in this session.

Returns
The number of packets that remain to be sent or received in this session

Definition at line 108 of file can_transport_protocol.cpp.

◆ get_rts_number_of_packet_limit()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_rts_number_of_packet_limit ( ) const
protected

Get the maximum number of packets that can be sent per CTS as indicated by the RTS message.

Returns
The maximum number of packets that can be sent per CTS as indicated by the RTS message

Definition at line 81 of file can_transport_protocol.cpp.

◆ get_state()

TransportProtocolManager::StateMachineState isobus::TransportProtocolManager::TransportProtocolSession::get_state ( ) const

Get the state of the session.

Returns
The state of the session

Definition at line 32 of file can_transport_protocol.cpp.

◆ get_total_bytes_transferred()

std::uint32_t isobus::TransportProtocolManager::TransportProtocolSession::get_total_bytes_transferred ( ) const
overridevirtual

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

Implements isobus::TransportProtocolSessionBase.

Definition at line 48 of file can_transport_protocol.cpp.

◆ get_total_number_of_packets()

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::get_total_number_of_packets ( ) const
protected

Get the total number of packets that will be sent or received in this session.

Returns
The total number of packets that will be sent or received in this session

Definition at line 113 of file can_transport_protocol.cpp.

◆ is_broadcast()

bool isobus::TransportProtocolManager::TransportProtocolSession::is_broadcast ( ) const

Get whether or not this session is a broadcast session (BAM)

Returns
True if this session is a broadcast session, false if not

Definition at line 43 of file can_transport_protocol.cpp.

◆ set_acknowledged_packet_number()

void isobus::TransportProtocolManager::TransportProtocolSession::set_acknowledged_packet_number ( std::uint8_t value)
protected

Set the last acknowledged packet number by the receiver.

Parameters
[in]valueThe last acknowledged packet number by the receiver

Definition at line 102 of file can_transport_protocol.cpp.

◆ set_cts_number_of_packets()

void isobus::TransportProtocolManager::TransportProtocolSession::set_cts_number_of_packets ( std::uint8_t value)
protected

Set the number of packets to be sent in response to the curent CTS.

Parameters
[in]valueThe number of packets to be sent in response to the curent CTS

Definition at line 70 of file can_transport_protocol.cpp.

◆ set_last_sequency_number()

void isobus::TransportProtocolManager::TransportProtocolSession::set_last_sequency_number ( std::uint8_t value)
protected

Set the last sequence number that will be processed.

Parameters
[in]valueThe last sequence number that will be processed

Definition at line 96 of file can_transport_protocol.cpp.

◆ set_state()

void isobus::TransportProtocolManager::TransportProtocolSession::set_state ( StateMachineState value)
protected

Set the state of the session.

Parameters
[in]valueThe state to set the session to

Definition at line 58 of file can_transport_protocol.cpp.

Friends And Related Symbol Documentation

◆ TransportProtocolManager

friend class TransportProtocolManager
friend

Allows the TP manager full access.

Definition at line 105 of file can_transport_protocol.hpp.

Member Data Documentation

◆ clearToSendPacketCount

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::clearToSendPacketCount = 0
private

The number of packets to be sent in response to one CTS.

Definition at line 156 of file can_transport_protocol.hpp.

◆ clearToSendPacketCountMax

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::clearToSendPacketCountMax = 0xFF
private

The max packets that can be sent per CTS as indicated by the RTS message.

Definition at line 157 of file can_transport_protocol.hpp.

◆ lastAcknowledgedPacketNumber

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::lastAcknowledgedPacketNumber = 0
private

The last acknowledged packet number by the receiver.

Definition at line 155 of file can_transport_protocol.hpp.

◆ lastSequenceNumber

std::uint8_t isobus::TransportProtocolManager::TransportProtocolSession::lastSequenceNumber = 0
private

The last processed sequence number for this set of packets.

Definition at line 154 of file can_transport_protocol.hpp.

◆ state

StateMachineState isobus::TransportProtocolManager::TransportProtocolSession::state = StateMachineState::None
private

The state machine state for this session.

Definition at line 152 of file can_transport_protocol.hpp.


The documentation for this class was generated from the following files: