48 LOG_WARNING(
"[VTStateHelper] add_tracked_numeric_value: objectId '%lu' already tracked", objectId);
59 LOG_WARNING(
"[VTStateHelper] remove_tracked_numeric_value: objectId '%lu' was not tracked", objectId);
70 LOG_WARNING(
"[VTStateHelper] get_numeric_value: objectId '%lu' not tracked", objectId);
101 LOG_WARNING(
"[VTStateHelper] add_tracked_soft_key_mask: data/alarm mask '%lu' already tracked", dataOrAlarmMaskId);
112 LOG_WARNING(
"[VTStateHelper] remove_tracked_soft_key_mask: data/alarm mask '%lu' was not tracked", dataOrAlarmMaskId);
123 LOG_WARNING(
"[VTStateHelper] get_active_soft_key_mask: the currently active data/alarm mask '%lu' is not tracked",
activeDataOrAlarmMask);
134 LOG_WARNING(
"[VTStateHelper] get_soft_key_mask: data/alarm mask '%lu' is not tracked",
activeDataOrAlarmMask);
154 if (attributeMap.find(attribute) != attributeMap.end())
156 LOG_WARNING(
"[VTStateHelper] add_tracked_attribute: attribute '%lu' of objectId '%lu' already tracked", attribute, objectId);
160 attributeMap[attribute] = initialValue;
167 LOG_WARNING(
"[VTStateHelper] remove_tracked_attribute: objectId '%lu' was not tracked", objectId);
172 if (attributeMap.find(attribute) == attributeMap.end())
174 LOG_WARNING(
"[VTStateHelper] remove_tracked_attribute: attribute '%lu' of objectId '%lu' was not tracked", attribute, objectId);
178 attributeMap.erase(attribute);
185 LOG_WARNING(
"[VTStateHelper] get_attribute: objectId '%lu' not tracked", objectId);
190 if (attributeMap.find(attribute) == attributeMap.end())
192 LOG_WARNING(
"[VTStateHelper] get_attribute: attribute '%lu' of objectId '%lu' not tracked", attribute, objectId);
196 return attributeMap.at(attribute);
228 (message.
get_uint8_at(0) ==
static_cast<std::uint8_t
>(VirtualTerminalClient::Function::VTStatusMessage)))
234 parent->process_message_from_connected_server(message);
238 parent->process_message_to_connected_server(message);
265 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::VTStatusMessage):
281 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::ChangeActiveMaskCommand):
291 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::ChangeSoftKeyMaskCommand):
306 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::ChangeNumericValueCommand):
324 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::VTChangeNumericValueMessage):
338 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::ChangeAttributeCommand):
352 if ((pendingCommand.objectId == objectId) && (pendingCommand.attribute == attribute) && (0 == error))
374 case static_cast<std::uint8_t
>(VirtualTerminalClient::Function::ChangeAttributeCommand):
Defines some PGNs that are used in the library or are very common.
The main class that manages the ISOBUS stack including: callbacks, Name to Address management,...
A class that acts as a logging sink. The intent is that someone could make their own derived class of...
A class that represents a generic CAN message of arbitrary length.
bool is_source(std::shared_ptr< ControlFunction > controlFunction) const
Returns whether the message is originated from the control function.
bool is_destination(std::shared_ptr< ControlFunction > controlFunction) const
Returns whether the message is destined for the control function.
std::uint32_t get_data_length() const
Returns the length of the data in the CAN message.
bool has_valid_source_control_function() const
Returns whether the message is sent by a device that claimed its address on the bus.
std::shared_ptr< ControlFunction > get_source_control_function() const
Gets the source control function that the message is from.
std::uint8_t get_uint8_at(const std::uint32_t index) const
Get a 8-bit unsigned byte from the buffer at a specific index. A 8-bit unsigned byte can hold a value...
bool is_parameter_group_number(CANLibParameterGroupNumber parameterGroupNumber) const
Compares the identifier of the message to the parameter group number (PGN) supplied.
std::uint16_t get_uint16_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 16-bit unsigned integer from the buffer at a specific index. A 16-bit unsigned integer can hold...
std::uint32_t get_uint32_at(const std::uint32_t index, const ByteFormat format=ByteFormat::LittleEndian) const
Get a 32-bit unsigned integer from the buffer at a specific index. A 32-bit unsigned integer can hold...
std::shared_ptr< ControlFunction > get_destination_control_function() const
Gets the destination control function that the message is to.
bool is_broadcast() const
Returns whether the message is sent as a broadcast message / to all devices on the bus.
void add_global_parameter_group_number_callback(std::uint32_t parameterGroupNumber, CANLibCallback callback, void *parent)
This is how you register a callback for any PGN destined for the global address (0xFF)
static CANNetworkManager CANNetwork
Static singleton of the one network manager. Use this to access stack functionality.
void add_any_control_function_parameter_group_number_callback(std::uint32_t parameterGroupNumber, CANLibCallback callback, void *parent)
Registers a callback for ANY control function sending the associated PGN.
void remove_global_parameter_group_number_callback(std::uint32_t parameterGroupNumber, CANLibCallback callback, void *parent)
This is how you remove a callback for any PGN destined for the global address (0xFF)
void remove_any_control_function_parameter_group_number_callback(std::uint32_t parameterGroupNumber, CANLibCallback callback, void *parent)
This is how you remove a callback added with add_any_control_function_parameter_group_number_callback...
A helper class to update and track the state of an active working set.
std::shared_ptr< ControlFunction > client
The control function of the virtual terminal client to track.
void add_tracked_attribute(std::uint16_t objectId, std::uint8_t attribute, std::uint32_t initialValue=0)
Adds an attribute to track.
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 add_tracked_numeric_value(std::uint16_t objectId, std::uint32_t initialValue=0)
TODO: void initialize_with_defaults(ObjectPool &objectPool);.
std::uint32_t get_attribute(std::uint16_t objectId, std::uint8_t attribute) const
Get the value of an attribute of a tracked object.
std::map< std::shared_ptr< ControlFunction >, ChangeAttributeCommand > pendingChangeAttributeCommands
Holds the pending change attribute command for a control function.
static void process_rx_or_tx_message(const CANMessage &message, void *parentPointer)
Processes a received or transmitted message.
~VirtualTerminalClientStateTracker()
The destructor.
std::uint16_t activeDataOrAlarmMask
Holds the data/alarm mask currently visible on the server for this client.
void cache_active_mask(std::uint16_t maskId)
Cache a mask as the active mask on the server.
std::map< std::uint16_t, std::uint16_t > softKeyMasks
Holds the data/alarms masks with their associated soft keys masks for tracked objects.
std::deque< std::uint16_t > dataAndAlarmMaskHistory
Holds the history of data/alarm masks that were active on the server for this client.
void remove_tracked_soft_key_mask(std::uint16_t dataOrAlarmMaskId)
Removes a data/alarm mask from tracking the soft key mask for.
void remove_tracked_numeric_value(std::uint16_t objectId)
Removes a numeric value from tracking.
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...
std::uint16_t get_soft_key_mask(std::uint16_t dataOrAlarmMaskId) const
Get the soft key mask currently associated with a data/alarm mask.
std::map< std::uint16_t, std::map< std::uint8_t, std::uint32_t > > attributeStates
void process_message_from_connected_server(const CANMessage &message)
Processes a VT->ECU message received by any client, sent from the connected server.
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.
void remove_tracked_attribute(std::uint16_t objectId, std::uint8_t attribute)
Removes an attribute from tracking.
bool is_working_set_active() const
Get whether the working set of the client is active on the server.
void set_max_mask_history_size(std::size_t size)
Sets the maximum size of the data/alarm mask history (default: 100)
std::shared_ptr< ControlFunction > server
The control function of the server the client is connected to.
void process_message_to_connected_server(const CANMessage &message)
Processes a ECU->VT message received by the connected server, sent from any control function.
void process_status_message(const CANMessage &message)
Processes a status message from a VT server.
void terminate()
Terminate the state tracker.
VirtualTerminalClientStateTracker(std::shared_ptr< ControlFunction > client)
The constructor to track the state of an active working set provided by a client.
std::uint8_t activeWorkingSetAddress
Holds the address of the control function that currently has.
std::uint32_t get_numeric_value(std::uint16_t objectId) const
Gets the current numeric value of a tracked object.
std::map< std::uint16_t, std::uint32_t > numericValueStates
std::size_t maxDataAndAlarmMaskHistorySize
Holds the maximum size of the data/alarm mask history.
std::size_t get_max_mask_history_size() const
Get the maximum size of the data/alarm mask history.
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 th...
void initialize()
Initializes the state tracker.
A class to manage a client connection to a ISOBUS virtual terminal display.
A helper class to track the state of an active working set.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
constexpr std::uint16_t NULL_OBJECT_ID
Special ID used to indicate no object.
constexpr std::uint8_t CAN_DATA_LENGTH
The length of a classical CAN frame.