Skip to content

Commit

Permalink
Update AgIsoStack
Browse files Browse the repository at this point in the history
Updated the version of AgIsoStack++ to 867d2c0d02a31f97c17aab2d17970f650db1bf8e
  • Loading branch information
ad3154 committed Feb 10, 2024
1 parent e115b7f commit a2cdca9
Show file tree
Hide file tree
Showing 72 changed files with 24,026 additions and 3,320 deletions.
8 changes: 3 additions & 5 deletions examples/VirtualTerminal/VirtualTerminal.ino
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ auto can0 = std::make_shared<FlexCANT4Plugin>(0);
std::shared_ptr<InternalControlFunction> ISOBUSControlFunction = nullptr;
std::shared_ptr<DiagnosticProtocol> ISOBUSDiagnostics = nullptr;
std::shared_ptr<VirtualTerminalClient> ExampleVirtualTerminalClient = nullptr;
std::shared_ptr<void> softKeyListener = nullptr;
std::shared_ptr<void> buttonListener = nullptr;

// A log sink for the CAN stack
class CustomLogger : public CANStackLogger
Expand Down Expand Up @@ -146,9 +144,9 @@ void setup() {
const std::vector<NAMEFilter> vtNameFilters = { filterVirtualTerminal };
auto TestPartnerVT = PartneredControlFunction::create(0, vtNameFilters);
ExampleVirtualTerminalClient = std::make_shared<VirtualTerminalClient>(TestPartnerVT, ISOBUSControlFunction);
ExampleVirtualTerminalClient->set_object_pool(0, VirtualTerminalClient::VTVersion::Version3, VT3TestPool, sizeof(VT3TestPool), "AIS1");
softKeyListener = ExampleVirtualTerminalClient->add_vt_soft_key_event_listener(handleVTKeyEvents);
buttonListener = ExampleVirtualTerminalClient->add_vt_button_event_listener(handleVTKeyEvents);
ExampleVirtualTerminalClient->set_object_pool(0, VT3TestPool, sizeof(VT3TestPool), "AIS1");
ExampleVirtualTerminalClient->get_vt_button_event_dispatcher().add_listener(handleVTKeyEvents);
ExampleVirtualTerminalClient->get_vt_button_event_dispatcher().add_listener(handleVTKeyEvents);
ExampleVirtualTerminalClient->initialize(false);
}

Expand Down
2 changes: 1 addition & 1 deletion library.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
name=AgIsoStack
version=0.1.1
version=0.1.4
license=MIT
author=Adrian Del Grosso <[email protected]>
maintainer=Adrian Del Grosso <[email protected]>
Expand Down
14 changes: 12 additions & 2 deletions src/AgIsoStack.hpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
/*******************************************************************************
** @file AgIsoStack.hpp
** @author Automatic Code Generation
** @date September 09, 2023 at 11:11:41
** @date February 08, 2024 at 19:36:28
** @brief Includes all important files in the AgIsoStack library.
**
** Copyright 2023 The AgIsoStack++ Developers
** Copyright 2024 The AgIsoStack++ Developers
*******************************************************************************/

#ifndef AG_ISO_STACK_HPP
Expand All @@ -23,6 +23,7 @@
#include <can_identifier.hpp>
#include <can_internal_control_function.hpp>
#include <can_message.hpp>
#include <can_message_data.hpp>
#include <can_message_frame.hpp>
#include <can_NAME.hpp>
#include <can_NAME_filter.hpp>
Expand All @@ -33,29 +34,38 @@
#include <can_protocol.hpp>
#include <can_stack_logger.hpp>
#include <can_transport_protocol.hpp>
#include <can_transport_protocol_base.hpp>
#include <circular_buffer.hpp>
#include <data_span.hpp>
#include <event_dispatcher.hpp>
#include <FlexCAN_T4.hpp>
#include <flex_can_t4_plugin.hpp>
#include <imxrt_flexcan.hpp>
#include <isobus_data_dictionary.hpp>
#include <isobus_device_descriptor_object_pool.hpp>
#include <isobus_diagnostic_protocol.hpp>
#include <isobus_functionalities.hpp>
#include <isobus_guidance_interface.hpp>
#include <isobus_language_command_interface.hpp>
#include <isobus_maintain_power_interface.hpp>
#include <isobus_preferred_addresses.hpp>
#include <isobus_shortcut_button_interface.hpp>
#include <isobus_speed_distance_messages.hpp>
#include <isobus_standard_data_description_indices.hpp>
#include <isobus_task_controller_client.hpp>
#include <isobus_task_controller_client_objects.hpp>
#include <isobus_virtual_terminal_client.hpp>
#include <isobus_virtual_terminal_client_state_tracker.hpp>
#include <isobus_virtual_terminal_client_update_helper.hpp>
#include <isobus_virtual_terminal_objects.hpp>
#include <kinetis_flexcan.hpp>
#include <nmea2000_fast_packet_protocol.hpp>
#include <nmea2000_message_definitions.hpp>
#include <nmea2000_message_interface.hpp>
#include <platform_endianness.hpp>
#include <processing_flags.hpp>
#include <system_timing.hpp>
#include <thread_synchronization.hpp>
#include <to_string.hpp>

#endif // AG_ISO_STACK_HPP
2 changes: 1 addition & 1 deletion src/can_NAME_filter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,4 @@ namespace isobus
return retVal;
}

} // namespace isobus
} // namespace isobus
1 change: 1 addition & 0 deletions src/can_NAME_filter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ namespace isobus
std::uint32_t get_value() const;

/// @brief Returns true if a NAME matches this filter class's components
/// @param[in] nameToCompare A NAME to compare against this filter
/// @returns true if a NAME matches this filter class's components
bool check_name_matches_filter(const NAME &nameToCompare) const;

Expand Down
3 changes: 3 additions & 0 deletions src/can_address_claim_state_machine.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,16 @@ namespace isobus
static void process_rx_message(const CANMessage &message, void *parentPointer);

/// @brief Sets the current state machine state
/// @param[in] value The state to set the state machine to
void set_current_state(State value);

/// @brief Sends the PGN request for the address claim PGN
/// @returns true if the message was sent, otherwise false
bool send_request_to_claim() const;

/// @brief Sends the address claim message
/// @param[in] address The address to claim
/// @returns true if the message was sent, otherwise false
bool send_address_claim(std::uint8_t address);

NAME m_isoname; ///< The ISO NAME to claim as
Expand Down
10 changes: 10 additions & 0 deletions src/can_callbacks.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#ifndef CAN_CALLBACKS_HPP
#define CAN_CALLBACKS_HPP

#include <functional>
#include "can_message.hpp"

namespace isobus
Expand All @@ -36,6 +37,14 @@ namespace isobus

/// @brief A callback for control functions to get CAN messages
using CANLibCallback = void (*)(const CANMessage &message, void *parentPointer);
/// @brief A callback for communicating CAN messages
using CANMessageCallback = std::function<void(const CANMessage &message)>;
/// @brief A callback for communicating CAN message frames
using CANMessageFrameCallback = std::function<bool(std::uint32_t parameterGroupNumber,
CANDataSpan data,
std::shared_ptr<InternalControlFunction> sourceControlFunction,
std::shared_ptr<ControlFunction> destinationControlFunction,
CANIdentifier::CANPriority priority)>; ///< A callback for sending a CAN frame
/// @brief A callback that can inform you when a control function changes state between online and offline
using ControlFunctionStateCallback = void (*)(std::shared_ptr<ControlFunction> controlFunction, ControlFunctionState state);
/// @brief A callback to get chunks of data for transfer by a protocol
Expand Down Expand Up @@ -101,6 +110,7 @@ namespace isobus
CANLibCallback get_callback() const;

/// @brief Returns the parent pointer for this data object
/// @returns The parent pointer for this data object
void *get_parent() const;

/// @brief Returns the ICF being used as a filter for this callback
Expand Down
3 changes: 3 additions & 0 deletions src/can_constants.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
#ifndef CAN_CONSTANTS_HPP
#define CAN_CONSTANTS_HPP

#include <cstdint>

namespace isobus
{
constexpr std::uint64_t DEFAULT_NAME = 0xFFFFFFFFFFFFFFFF; ///< An invalid NAME used as a default
Expand All @@ -17,6 +19,7 @@ namespace isobus
constexpr std::uint8_t BROADCAST_CAN_ADDRESS = 0xFF; ///< The global/broadcast CAN address
constexpr std::uint8_t CAN_DATA_LENGTH = 8; ///< The length of a classical CAN frame
constexpr std::uint32_t CAN_PORT_MAXIMUM = 4; ///< An arbitrary limit for memory consumption
constexpr std::uint16_t NULL_OBJECT_ID = 65535; ///< Special ID used to indicate no object

}

Expand Down
3 changes: 2 additions & 1 deletion src/can_control_function.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ namespace isobus
/// @param[in] NAMEValue The NAME of the control function
/// @param[in] addressValue The current address of the control function
/// @param[in] CANPort The CAN channel index that the control function communicates on
/// @returns A shared pointer to a ControlFunction object created with the parameters passed in
static std::shared_ptr<ControlFunction> create(NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort);

/// @brief Destroys this control function, by removing it from the network manager
Expand Down Expand Up @@ -82,7 +83,7 @@ namespace isobus
/// @param[in] type The 'Type' of control function to create
ControlFunction(NAME NAMEValue, std::uint8_t addressValue, std::uint8_t CANPort, Type type = Type::External);

friend class CANNetworkManager;
friend class CANNetworkManager; ///< The network manager needs access to the control function's internals
#if !defined CAN_STACK_DISABLE_THREADS && !defined ARDUINO
static std::mutex controlFunctionProcessingMutex; ///< Protects the control function tables
#endif
Expand Down
Loading

0 comments on commit a2cdca9

Please sign in to comment.