AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
isobus_device_descriptor_object_pool.hpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
9
10#ifndef ISOBUS_DEVICE_DESCRIPTOR_OBJECT_POOL_HPP
11#define ISOBUS_DEVICE_DESCRIPTOR_OBJECT_POOL_HPP
12
15
16#include <memory>
17
18namespace isobus
19{
28 {
29 public:
32
35 explicit DeviceDescriptorObjectPool(std::uint8_t taskControllerServerVersion);
36
48 bool add_device(std::string deviceDesignator,
49 std::string deviceSoftwareVersion,
50 std::string deviceSerialNumber,
51 std::string deviceStructureLabel,
52 std::array<std::uint8_t, task_controller_object::DeviceObject::MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH> deviceLocalizationLabel,
53 std::vector<std::uint8_t> deviceExtendedStructureLabel,
54 std::uint64_t clientIsoNAME);
55
63 bool add_device_element(std::string deviceElementDesignator,
64 std::uint16_t deviceElementNumber,
65 std::uint16_t parentObjectID,
67 std::uint16_t uniqueID);
68
77 bool add_device_process_data(std::string processDataDesignator,
78 std::uint16_t processDataDDI,
79 std::uint16_t deviceValuePresentationObjectID,
80 std::uint8_t processDataProperties,
81 std::uint8_t processDataTriggerMethods,
82 std::uint16_t uniqueID);
83
91 bool add_device_property(std::string propertyDesignator,
92 std::int32_t propertyValue,
93 std::uint16_t propertyDDI,
94 std::uint16_t valuePresentationObject,
95 std::uint16_t uniqueID);
96
104 bool add_device_value_presentation(std::string unitDesignator,
105 std::int32_t offsetValue,
106 float scaleFactor,
107 std::uint8_t numberDecimals,
108 std::uint16_t uniqueID);
109
119 bool deserialize_binary_object_pool(std::vector<std::uint8_t> &binaryPool, NAME clientNAME = NAME(0));
120
131 bool deserialize_binary_object_pool(const std::uint8_t *binaryPool, std::uint32_t binaryPoolSizeBytes, NAME clientNAME = NAME(0));
132
136 bool generate_binary_object_pool(std::vector<std::uint8_t> &resultantPool);
137
141 bool generate_task_data_iso_xml(std::string &resultantString);
142
146 std::shared_ptr<task_controller_object::Object> get_object_by_id(std::uint16_t objectID);
147
151 std::shared_ptr<task_controller_object::Object> get_object_by_index(std::uint16_t index);
152
159 bool remove_object_by_id(std::uint16_t objectID);
160
164 void set_task_controller_compatibility_level(std::uint8_t tcVersion);
165
168 std::uint8_t get_task_controller_compatibility_level() const;
169
172 static std::uint8_t get_max_supported_task_controller_version();
173
175 void clear();
176
180 std::uint16_t size() const;
181
182 private:
186
190 bool check_object_id_unique(std::uint16_t uniqueID) const;
191
192 static constexpr std::uint8_t MAX_TC_VERSION_SUPPORTED = 4;
193
194 std::vector<std::shared_ptr<task_controller_object::Object>> objectList;
196 };
197} // namespace isobus
198
199#endif // ISOBUS_DEVICE_DESCRIPTOR_OBJECT_POOL_HPP
A class that represents a control function's NAME.
std::uint8_t taskControllerCompatibilityLevel
Stores the max TC version.
void clear()
Clears the DDOP back to an empty state.
std::shared_ptr< task_controller_object::Object > get_object_by_index(std::uint16_t index)
Gets an object from the DDOP by index based on object creation.
bool generate_task_data_iso_xml(std::string &resultantString)
bool add_device_element(std::string deviceElementDesignator, std::uint16_t deviceElementNumber, std::uint16_t parentObjectID, task_controller_object::DeviceElementObject::Type deviceElementType, std::uint16_t uniqueID)
Adds a device element object to the DDOP.
static constexpr std::uint8_t MAX_TC_VERSION_SUPPORTED
The max TC version a DDOP object can support as of today.
std::shared_ptr< task_controller_object::Object > get_object_by_id(std::uint16_t objectID)
Gets an object from the DDOP that corresponds to a certain object ID.
bool generate_binary_object_pool(std::vector< std::uint8_t > &resultantPool)
std::uint8_t get_task_controller_compatibility_level() const
Returns the current TC version used when generating a binary DDOP.
static std::uint8_t get_max_supported_task_controller_version()
Returns The maximum TC version supported by the CAN stack's DDOP generator.
bool remove_object_by_id(std::uint16_t objectID)
Removes an object from the DDOP using its object ID.
bool add_device(std::string deviceDesignator, std::string deviceSoftwareVersion, std::string deviceSerialNumber, std::string deviceStructureLabel, std::array< std::uint8_t, task_controller_object::DeviceObject::MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH > deviceLocalizationLabel, std::vector< std::uint8_t > deviceExtendedStructureLabel, std::uint64_t clientIsoNAME)
Adds a device object to the DDOP.
std::vector< std::shared_ptr< task_controller_object::Object > > objectList
Maintains a list of all added objects.
DeviceDescriptorObjectPool()=default
Default constructor for a DDOP. Sets TC compatibility to version 4.
bool add_device_process_data(std::string processDataDesignator, std::uint16_t processDataDDI, std::uint16_t deviceValuePresentationObjectID, std::uint8_t processDataProperties, std::uint8_t processDataTriggerMethods, std::uint16_t uniqueID)
Adds a device process data object to the DDOP.
std::uint16_t size() const
Returns the number of objects in the DDOP.
void set_task_controller_compatibility_level(std::uint8_t tcVersion)
Sets the TC version to use when generating a binary DDOP.
bool resolve_parent_ids_to_objects()
Checks to see that all parent object IDs correspond to an object in this DDOP.
bool deserialize_binary_object_pool(std::vector< std::uint8_t > &binaryPool, NAME clientNAME=NAME(0))
Attempts to take a binary object pool and convert it back into C++ objects. Useful for a task control...
bool add_device_property(std::string propertyDesignator, std::int32_t propertyValue, std::uint16_t propertyDDI, std::uint16_t valuePresentationObject, std::uint16_t uniqueID)
Adds a device property object to the DDOP.
bool check_object_id_unique(std::uint16_t uniqueID) const
Checks the DDOP to see if an object ID has already been used.
bool add_device_value_presentation(std::string unitDesignator, std::int32_t offsetValue, float scaleFactor, std::uint8_t numberDecimals, std::uint16_t uniqueID)
Adds a device value presentation object to the DDOP.
A class that represents an ISO11783 control function NAME from an address claim.
Definition can_NAME.hpp:24
Defines a set of C++ objects that represent a DDOP.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...