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

A helper class to update and track the state of an active working set. More...

#include <isobus_virtual_terminal_client_state_tracker.hpp>

Inheritance diagram for isobus::VirtualTerminalClientStateTracker:
[legend]

Classes

struct  ChangeAttributeCommand
 Data structure to hold the properties of a change attribute command. More...
 

Public Member Functions

 VirtualTerminalClientStateTracker (std::shared_ptr< ControlFunction > client)
 The constructor to track the state of an active working set provided by a client.
 
 ~VirtualTerminalClientStateTracker ()
 The destructor.
 
void initialize ()
 Initializes the state tracker.
 
void terminate ()
 Terminate the state tracker.
 
void add_tracked_numeric_value (std::uint16_t objectId, std::uint32_t initialValue=0)
 TODO: void initialize_with_defaults(ObjectPool &objectPool);.
 
void remove_tracked_numeric_value (std::uint16_t objectId)
 Removes a numeric value from tracking.
 
std::uint32_t get_numeric_value (std::uint16_t objectId) const
 Gets the current numeric value of a tracked object.
 
std::uint16_t get_active_mask () const
 Get the data/alarm mask currently active on the server for this client. It may not be displayed if the working set is not active.
 
const std::deque< std::uint16_t > & get_mask_history () const
 Get the history of data/alarm masks that were active on the server for this client.
 
std::size_t get_max_mask_history_size () const
 Get the maximum size of the data/alarm mask history.
 
void set_max_mask_history_size (std::size_t size)
 Sets the maximum size of the data/alarm mask history (default: 100)
 
void add_tracked_soft_key_mask (std::uint16_t dataOrAlarmMaskId, std::uint16_t initialSoftKeyMaskId=0)
 Adds a data/alarm mask to track the soft key mask for.
 
void remove_tracked_soft_key_mask (std::uint16_t dataOrAlarmMaskId)
 Removes a data/alarm mask from tracking the soft key mask for.
 
std::uint16_t get_active_soft_key_mask () const
 Get the soft key mask currently active on thse server for this client. It may not be displayed if the working set is not active.
 
std::uint16_t get_soft_key_mask (std::uint16_t dataOrAlarmMaskId) const
 Get the soft key mask currently associated with a data/alarm mask.
 
bool is_working_set_active () const
 Get whether the working set of the client is active on the server.
 
void add_tracked_attribute (std::uint16_t objectId, std::uint8_t attribute, std::uint32_t initialValue=0)
 Adds an attribute to track.
 
void remove_tracked_attribute (std::uint16_t objectId, std::uint8_t attribute)
 Removes an attribute from tracking.
 
std::uint32_t get_attribute (std::uint16_t objectId, std::uint8_t attribute) const
 Get the value of an attribute of a tracked object.
 

Protected Attributes

std::shared_ptr< ControlFunctionclient
 The control function of the virtual terminal client to track.
 
std::shared_ptr< ControlFunctionserver
 The control function of the server the client is connected to.
 
std::map< std::uint16_t, std::uint32_t > numericValueStates
 
std::uint16_t activeDataOrAlarmMask = NULL_OBJECT_ID
 Holds the data/alarm mask currently visible on the server for this client.
 
std::deque< std::uint16_t > dataAndAlarmMaskHistory
 Holds the history of data/alarm masks that were active on the server for this client.
 
std::size_t maxDataAndAlarmMaskHistorySize = 100
 Holds the maximum size of the data/alarm mask history.
 
std::uint8_t activeWorkingSetAddress = NULL_CAN_ADDRESS
 Holds the address of the control function that currently has.
 
std::map< std::uint16_t, std::uint16_t > softKeyMasks
 Holds the data/alarms masks with their associated soft keys masks for tracked objects.
 
std::map< std::uint16_t, std::map< std::uint8_t, std::uint32_t > > attributeStates
 

Private Member Functions

void cache_active_mask (std::uint16_t maskId)
 Cache a mask as the active mask on the server.
 
void process_status_message (const CANMessage &message)
 Processes a status message from a VT server.
 
void process_message_from_connected_server (const CANMessage &message)
 Processes a VT->ECU message received by any client, sent from the connected server.
 
void process_message_to_connected_server (const CANMessage &message)
 Processes a ECU->VT message received by the connected server, sent from any control function.
 

Static Private Member Functions

static void process_rx_or_tx_message (const CANMessage &message, void *parentPointer)
 Processes a received or transmitted message.
 

Private Attributes

std::map< std::shared_ptr< ControlFunction >, ChangeAttributeCommandpendingChangeAttributeCommands
 Holds the pending change attribute command for a control function.
 

Detailed Description

A helper class to update and track the state of an active working set.

The state is from the client's perspective. It might not be the same as the state of the server, but tries to be as close as possible.

Definition at line 26 of file isobus_virtual_terminal_client_state_tracker.hpp.

Constructor & Destructor Documentation

◆ VirtualTerminalClientStateTracker()

isobus::VirtualTerminalClientStateTracker::VirtualTerminalClientStateTracker ( std::shared_ptr< ControlFunction > client)
explicit

The constructor to track the state of an active working set provided by a client.

Parameters
[in]clientThe control function of the client. May be external.

Definition at line 20 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ ~VirtualTerminalClientStateTracker()

isobus::VirtualTerminalClientStateTracker::~VirtualTerminalClientStateTracker ( )

The destructor.

Definition at line 25 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:

Member Function Documentation

◆ add_tracked_attribute()

void isobus::VirtualTerminalClientStateTracker::add_tracked_attribute ( std::uint16_t objectId,
std::uint8_t attribute,
std::uint32_t initialValue = 0 )

Adds an attribute to track.

Parameters
[in]objectIdThe object id of the attribute to track.
[in]attributeThe attribute to track.
[in]initialValueThe initial value of the attribute to track.

Definition at line 146 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ add_tracked_numeric_value()

void isobus::VirtualTerminalClientStateTracker::add_tracked_numeric_value ( std::uint16_t objectId,
std::uint32_t initialValue = 0 )

TODO: void initialize_with_defaults(ObjectPool &objectPool);.

Adds a numeric value to track.

Parameters
[in]objectIdThe object id of the numeric value to track.
[in]initialValueThe initial value of the numeric value to track.

Definition at line 44 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ add_tracked_soft_key_mask()

void isobus::VirtualTerminalClientStateTracker::add_tracked_soft_key_mask ( std::uint16_t dataOrAlarmMaskId,
std::uint16_t initialSoftKeyMaskId = 0 )

Adds a data/alarm mask to track the soft key mask for.

Parameters
[in]dataOrAlarmMaskIdThe data/alarm mask to track the soft key mask for.
[in]initialSoftKeyMaskIdThe initial soft key mask to associate with the data/alarm mask.

Definition at line 97 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ cache_active_mask()

void isobus::VirtualTerminalClientStateTracker::cache_active_mask ( std::uint16_t maskId)
private

Cache a mask as the active mask on the server.

TODO: std::map<std::uint16_t, std::uint8_t> alarmMaskPrioritiesStates; ///< Holds the 'alarm mask priority' state of tracked objects. TODO: std::map<std::uint16_t, std::pair<std::uint8_t, std::uint16_t>> listItemStates; ///< Holds the 'list item' state of tracked objects. TODO: add lock/unlock mask state TODO: add object label state TODO: add polygon point state TODO: add polygon scale state TODO: add graphics context state TODO: std::uint16_t currentColourMap; ///< Holds the current colour map/palette object.

Parameters
[in]maskIdThe mask to cache as the active mask on the server.

Definition at line 199 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the caller graph for this function:

◆ get_active_mask()

std::uint16_t isobus::VirtualTerminalClientStateTracker::get_active_mask ( ) const

Get the data/alarm mask currently active on the server for this client. It may not be displayed if the working set is not active.

Returns
The data/alarm mask currently active on the server for this client.

Definition at line 77 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ get_active_soft_key_mask()

std::uint16_t isobus::VirtualTerminalClientStateTracker::get_active_soft_key_mask ( ) const

Get the soft key mask currently active on thse server for this client. It may not be displayed if the working set is not active.

Returns
The soft key mask currently active on the server for this client.

Definition at line 119 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ get_attribute()

std::uint32_t isobus::VirtualTerminalClientStateTracker::get_attribute ( std::uint16_t objectId,
std::uint8_t attribute ) const

Get the value of an attribute of a tracked object.

Parameters
[in]objectIdThe object id of the attribute to get.
[in]attributeThe attribute to get.
Returns
The value of the attribute of the tracked object.

Definition at line 181 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ get_mask_history()

const std::deque< std::uint16_t > & isobus::VirtualTerminalClientStateTracker::get_mask_history ( ) const

Get the history of data/alarm masks that were active on the server for this client.

Returns
The history of data/alarm masks that were active on the server for this client.

Definition at line 82 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ get_max_mask_history_size()

std::size_t isobus::VirtualTerminalClientStateTracker::get_max_mask_history_size ( ) const

Get the maximum size of the data/alarm mask history.

Returns
The maximum size of the data/alarm mask history.

Definition at line 87 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ get_numeric_value()

std::uint32_t isobus::VirtualTerminalClientStateTracker::get_numeric_value ( std::uint16_t objectId) const

Gets the current numeric value of a tracked object.

Parameters
[in]objectIdThe object id of the numeric value to get.
Returns
The current numeric value of the tracked object.

Definition at line 66 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the caller graph for this function:

◆ get_soft_key_mask()

std::uint16_t isobus::VirtualTerminalClientStateTracker::get_soft_key_mask ( std::uint16_t dataOrAlarmMaskId) const

Get the soft key mask currently associated with a data/alarm mask.

Parameters
[in]dataOrAlarmMaskIdThe data/alarm mask to get the currently associated soft key mask for.
Returns
The soft key mask currently associated with the supplied mask.

Definition at line 130 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ initialize()

void isobus::VirtualTerminalClientStateTracker::initialize ( )

Initializes the state tracker.

Definition at line 30 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:

◆ is_working_set_active()

bool isobus::VirtualTerminalClientStateTracker::is_working_set_active ( ) const

Get whether the working set of the client is active on the server.

Returns
True if the working set is active, false otherwise.

Definition at line 141 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the caller graph for this function:

◆ process_message_from_connected_server()

void isobus::VirtualTerminalClientStateTracker::process_message_from_connected_server ( const CANMessage & message)
private

Processes a VT->ECU message received by any client, sent from the connected server.

Parameters
[in]messageThe message to process.

Definition at line 260 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:

◆ process_message_to_connected_server()

void isobus::VirtualTerminalClientStateTracker::process_message_to_connected_server ( const CANMessage & message)
private

Processes a ECU->VT message received by the connected server, sent from any control function.

Parameters
[in]messageThe message to process.

Definition at line 369 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:

◆ process_rx_or_tx_message()

void isobus::VirtualTerminalClientStateTracker::process_rx_or_tx_message ( const CANMessage & message,
void * parentPointer )
staticprivate

Processes a received or transmitted message.

Parameters
[in]messageThe message to process.
[in]parentPointerThe pointer to the parent object, which should be the VirtualTerminalClientStateTracker.

Definition at line 217 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_status_message()

void isobus::VirtualTerminalClientStateTracker::process_status_message ( const CANMessage & message)
private

Processes a status message from a VT server.

Parameters
[in]messageThe message to process.

Definition at line 242 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ remove_tracked_attribute()

void isobus::VirtualTerminalClientStateTracker::remove_tracked_attribute ( std::uint16_t objectId,
std::uint8_t attribute )

Removes an attribute from tracking.

Parameters
[in]objectIdThe object id of the attribute to remove from tracking.
[in]attributeThe attribute to remove from tracking.

Definition at line 163 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ remove_tracked_numeric_value()

void isobus::VirtualTerminalClientStateTracker::remove_tracked_numeric_value ( std::uint16_t objectId)

Removes a numeric value from tracking.

Parameters
[in]objectIdThe object id of the numeric value to remove from tracking.

Definition at line 55 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ remove_tracked_soft_key_mask()

void isobus::VirtualTerminalClientStateTracker::remove_tracked_soft_key_mask ( std::uint16_t dataOrAlarmMaskId)

Removes a data/alarm mask from tracking the soft key mask for.

Parameters
[in]dataOrAlarmMaskIdThe data/alarm mask to remove the soft key mask from tracking for.

Definition at line 108 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ set_max_mask_history_size()

void isobus::VirtualTerminalClientStateTracker::set_max_mask_history_size ( std::size_t size)

Sets the maximum size of the data/alarm mask history (default: 100)

Parameters
[in]sizeThe maximum size of the data/alarm mask history.

Definition at line 92 of file isobus_virtual_terminal_client_state_tracker.cpp.

◆ terminate()

void isobus::VirtualTerminalClientStateTracker::terminate ( )

Terminate the state tracker.

Definition at line 37 of file isobus_virtual_terminal_client_state_tracker.cpp.

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ activeDataOrAlarmMask

std::uint16_t isobus::VirtualTerminalClientStateTracker::activeDataOrAlarmMask = NULL_OBJECT_ID
protected

Holds the data/alarm mask currently visible on the server for this client.

TODO: std::map<std::uint16_t, std::string> stringValueStates; ///< Holds the 'string value' state of tracked objects. TODO: std::map<std::uint16_t, std::uint8_t> endPointStates; ///< Holds the 'end point' state of tracked objects. TODO: add font attribute state TODO: add line attribute state TODO: add fill attribute state

Definition at line 131 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ activeWorkingSetAddress

std::uint8_t isobus::VirtualTerminalClientStateTracker::activeWorkingSetAddress = NULL_CAN_ADDRESS
protected

Holds the address of the control function that currently has.

Definition at line 134 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ attributeStates

std::map<std::uint16_t, std::map<std::uint8_t, std::uint32_t> > isobus::VirtualTerminalClientStateTracker::attributeStates
protected

Holds the 'attribute' state of tracked objects.

Definition at line 136 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ client

std::shared_ptr<ControlFunction> isobus::VirtualTerminalClientStateTracker::client
protected

The control function of the virtual terminal client to track.

Definition at line 114 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ dataAndAlarmMaskHistory

std::deque<std::uint16_t> isobus::VirtualTerminalClientStateTracker::dataAndAlarmMaskHistory
protected

Holds the history of data/alarm masks that were active on the server for this client.

Definition at line 132 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ maxDataAndAlarmMaskHistorySize

std::size_t isobus::VirtualTerminalClientStateTracker::maxDataAndAlarmMaskHistorySize = 100
protected

Holds the maximum size of the data/alarm mask history.

Definition at line 133 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ numericValueStates

std::map<std::uint16_t, std::uint32_t> isobus::VirtualTerminalClientStateTracker::numericValueStates
protected

TODO: std::map<std::uint16_t, bool> shownStates; ///< Holds the 'hide/show' state of tracked objects. TODO: std::map<std::uint16_t, bool> enabledStates; ///< Holds the 'enable/disable' state of tracked objects. TODO: std::map<std::uint16_t, bool> selectedStates; ///< Holds the 'selected for input' state of tracked objects. TODO: add current audio signal state TODO: std::uint8_t audioVolumeState; ///< Holds the current audio volume. TODO: std::map<std::uint16_t, std::pair<std::uint16_t, std::uint16_t>> positionStates; ///< Holds the 'position (x,y)' state of tracked objects. TODO: std::map<std::uint16_t, std::pair<std::uint16_t, std::uint16_t>> sizeStates; ///< Holds the 'size (width,height)' state of tracked objects. TODO: std::map<std::uint16_t, std::uint8_t> backgroundColourStates; ///< Holds the 'background colour' state of tracked objects. Holds the 'numeric value' state of tracked objects.

Definition at line 125 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ pendingChangeAttributeCommands

std::map<std::shared_ptr<ControlFunction>, ChangeAttributeCommand> isobus::VirtualTerminalClientStateTracker::pendingChangeAttributeCommands
private

Holds the pending change attribute command for a control function.

Definition at line 176 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ server

std::shared_ptr<ControlFunction> isobus::VirtualTerminalClientStateTracker::server
protected

The control function of the server the client is connected to.

Definition at line 115 of file isobus_virtual_terminal_client_state_tracker.hpp.

◆ softKeyMasks

std::map<std::uint16_t, std::uint16_t> isobus::VirtualTerminalClientStateTracker::softKeyMasks
protected

Holds the data/alarms masks with their associated soft keys masks for tracked objects.

Definition at line 135 of file isobus_virtual_terminal_client_state_tracker.hpp.


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