AgIsoStack++
A control-function-focused implementation of the major ISOBUS and J1939 protocols
Loading...
Searching...
No Matches
isobus_task_controller_client_objects.cpp
Go to the documentation of this file.
1//================================================================================================
8//================================================================================================
10
12#include "isobus/utility/platform_endianness.hpp"
13
14#include <algorithm>
15#include <array>
16#include <cstring>
17
18namespace isobus
19{
20 namespace task_controller_object
21 {
22 Object::Object(std::string objectDesignator, std::uint16_t uniqueID) :
23 designator(objectDesignator),
24 objectID(uniqueID)
25 {
26 }
27
28 std::string Object::get_designator() const
29 {
30 return designator;
31 }
32
33 void Object::set_designator(const std::string &newDesignator)
34 {
35 designator = newDesignator;
36 }
37
38 std::uint16_t Object::get_object_id() const
39 {
40 return objectID;
41 }
42
43 void Object::set_object_id(std::uint16_t id)
44 {
45 objectID = id;
46 }
47
48 const std::string DeviceObject::tableID = "DVC";
49
50 DeviceObject::DeviceObject(std::string deviceDesignator,
51 std::string deviceSoftwareVersion,
52 std::string deviceSerialNumber,
53 std::string deviceStructureLabel,
54 std::array<std::uint8_t, task_controller_object::DeviceObject::MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH> deviceLocalizationLabel,
55 std::vector<std::uint8_t> deviceExtendedStructureLabel,
56 std::uint64_t clientIsoNAME,
57 bool shouldUseExtendedStructureLabel) :
58 Object(deviceDesignator, 0),
59 serialNumber(deviceSerialNumber),
60 softwareVersion(deviceSoftwareVersion),
61 structureLabel(deviceStructureLabel),
62 localizationLabel(deviceLocalizationLabel),
63 extendedStructureLabel(deviceExtendedStructureLabel),
64 NAME(clientIsoNAME),
65 useExtendedStructureLabel(shouldUseExtendedStructureLabel)
66 {
67 }
68
69 std::string DeviceObject::get_table_id() const
70 {
71 return tableID;
72 }
73
78
79 std::vector<std::uint8_t> DeviceObject::get_binary_object() const
80 {
81 std::vector<std::uint8_t> retVal;
82
83 retVal.reserve(31 +
84 designator.size() +
85 softwareVersion.size() +
86 serialNumber.size() +
88
89 retVal.push_back(tableID[0]);
90 retVal.push_back(tableID[1]);
91 retVal.push_back(tableID[2]);
92 retVal.push_back(static_cast<std::uint8_t>(get_object_id() & 0xFF));
93 retVal.push_back(static_cast<std::uint8_t>((get_object_id() >> 8) & 0xFF));
94 retVal.push_back(static_cast<std::uint8_t>(designator.size()));
95 for (std::size_t i = 0; i < designator.size(); i++)
96 {
97 retVal.push_back(designator[i]);
98 }
99 retVal.push_back(static_cast<std::uint8_t>(softwareVersion.size()));
100 for (std::size_t i = 0; i < softwareVersion.size(); i++)
101 {
102 retVal.push_back(softwareVersion[i]);
103 }
104 retVal.push_back(static_cast<std::uint8_t>(NAME & 0xFF));
105 retVal.push_back(static_cast<std::uint8_t>((NAME >> 8) & 0xFF));
106 retVal.push_back(static_cast<std::uint8_t>((NAME >> 16) & 0xFF));
107 retVal.push_back(static_cast<std::uint8_t>((NAME >> 24) & 0xFF));
108 retVal.push_back(static_cast<std::uint8_t>((NAME >> 32) & 0xFF));
109 retVal.push_back(static_cast<std::uint8_t>((NAME >> 40) & 0xFF));
110 retVal.push_back(static_cast<std::uint8_t>((NAME >> 48) & 0xFF));
111 retVal.push_back(static_cast<std::uint8_t>((NAME >> 56) & 0xFF));
112 retVal.push_back(static_cast<std::uint8_t>(serialNumber.size()));
113 for (std::size_t i = 0; i < serialNumber.size(); i++)
114 {
115 retVal.push_back(serialNumber[i]);
116 }
117 for (std::uint_fast8_t i = 0; i < MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH; i++)
118 {
119 if (i < structureLabel.size())
120 {
121 retVal.push_back(structureLabel[i]);
122 }
123 else
124 {
125 retVal.push_back(' ');
126 }
127 }
128 for (std::uint_fast8_t i = 0; i < MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH; i++)
129 {
130 if (i < localizationLabel.size())
131 {
132 retVal.push_back(localizationLabel[i]);
133 }
134 else
135 {
136 retVal.push_back(' ');
137 }
138 }
140 {
141 retVal.push_back(static_cast<std::uint8_t>(extendedStructureLabel.size()));
142 for (std::size_t i = 0; i < extendedStructureLabel.size(); i++)
143 {
144 retVal.push_back(extendedStructureLabel[i]);
145 }
146 }
147 return retVal;
148 }
149
151 {
152 return softwareVersion;
153 }
154
155 void DeviceObject::set_software_version(const std::string &version)
156 {
157 softwareVersion = version;
158 }
159
161 {
162 return serialNumber;
163 }
164
165 void DeviceObject::set_serial_number(const std::string &serial)
166 {
167 serialNumber = serial;
168 }
169
171 {
172 return structureLabel;
173 }
174
175 void DeviceObject::set_structure_label(const std::string &label)
176 {
177 structureLabel = label;
178 }
179
180 std::array<std::uint8_t, task_controller_object::DeviceObject::MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH> DeviceObject::get_localization_label() const
181 {
182 return localizationLabel;
183 }
184
185 void DeviceObject::set_localization_label(std::array<std::uint8_t, 7> label)
186 {
187 localizationLabel = label;
188 }
189
190 std::vector<std::uint8_t> DeviceObject::get_extended_structure_label() const
191 {
193 }
194
195 void DeviceObject::set_extended_structure_label(const std::vector<std::uint8_t> &label)
196 {
198 }
199
200 std::uint64_t DeviceObject::get_iso_name() const
201 {
202 return NAME;
203 }
204
205 void DeviceObject::set_iso_name(std::uint64_t name)
206 {
207 NAME = name;
208 }
209
214
215 void DeviceObject::set_use_extended_structure_label(bool shouldUseExtendedStructureLabel)
216 {
217 useExtendedStructureLabel = shouldUseExtendedStructureLabel;
218 }
219
220 const std::string DeviceElementObject::tableID = "DET";
221
222 DeviceElementObject::DeviceElementObject(std::string deviceElementDesignator,
223 std::uint16_t deviceElementNumber,
224 std::uint16_t parentObjectID,
225 Type deviceEelementType,
226 std::uint16_t uniqueID) :
227 Object(deviceElementDesignator, uniqueID),
228 elementNumber(deviceElementNumber),
229 parentObject(parentObjectID),
230 elementType(deviceEelementType)
231 {
232 }
233
235 {
236 return tableID;
237 }
238
243
244 std::vector<std::uint8_t> DeviceElementObject::get_binary_object() const
245 {
246 std::vector<std::uint8_t> retVal;
247
248 retVal.reserve(14 +
249 designator.size() +
250 2 * referenceList.size());
251
252 retVal.push_back(tableID[0]);
253 retVal.push_back(tableID[1]);
254 retVal.push_back(tableID[2]);
255 retVal.push_back(static_cast<std::uint8_t>(get_object_id() & 0xFF));
256 retVal.push_back(static_cast<std::uint8_t>((get_object_id() >> 8) & 0xFF));
257 retVal.push_back(static_cast<std::uint8_t>(elementType));
258 retVal.push_back(static_cast<std::uint8_t>(designator.size()));
259 for (std::size_t i = 0; i < designator.size(); i++)
260 {
261 retVal.push_back(designator[i]);
262 }
263 retVal.push_back(static_cast<std::uint8_t>(elementNumber & 0xFF));
264 retVal.push_back(static_cast<std::uint8_t>((elementNumber >> 8) & 0xFF));
265 retVal.push_back(static_cast<std::uint8_t>(parentObject & 0xFF));
266 retVal.push_back(static_cast<std::uint8_t>((parentObject >> 8) & 0xFF));
267 std::uint16_t tempSize = static_cast<std::uint16_t>(referenceList.size());
268 retVal.push_back(tempSize & 0xFF);
269 retVal.push_back((tempSize >> 8) & 0xFF);
270 for (std::size_t i = 0; i < tempSize; i++)
271 {
272 retVal.push_back(static_cast<std::uint8_t>(referenceList[i] & 0xFF));
273 retVal.push_back(static_cast<std::uint8_t>((referenceList[i] >> 8) & 0xFF));
274 }
275 return retVal;
276 }
277
279 {
280 return elementNumber;
281 }
282
283 void DeviceElementObject::set_element_number(std::uint16_t newElementNumber)
284 {
285 elementNumber = newElementNumber;
286 }
287
289 {
290 return parentObject;
291 }
292
293 void DeviceElementObject::set_parent_object(std::uint16_t parentObjectID)
294 {
295 parentObject = parentObjectID;
296 }
297
302
304 {
305 referenceList.push_back(childID);
306 }
307
309 {
310 bool retVal = false;
311
312 auto result = std::find(referenceList.begin(), referenceList.end(), childID);
313 if (result != referenceList.end())
314 {
315 retVal = true;
316 referenceList.erase(result);
317 }
318 return retVal;
319 }
320
322 {
323 return static_cast<std::uint16_t>(referenceList.size());
324 }
325
326 std::uint16_t DeviceElementObject::get_child_object_id(std::size_t index)
327 {
328 std::uint16_t retVal = NULL_OBJECT_ID;
329
330 if (index < get_number_child_objects())
331 {
332 retVal = referenceList[index];
333 }
334 return retVal;
335 }
336
337 const std::string DeviceProcessDataObject::tableID = "DPD";
338
339 DeviceProcessDataObject::DeviceProcessDataObject(std::string processDataDesignator,
340 std::uint16_t processDataDDI,
341 std::uint16_t deviceValuePresentationObjectID,
342 std::uint8_t processDataProperties,
343 std::uint8_t processDataTriggerMethods,
344 std::uint16_t uniqueID) :
345 Object(processDataDesignator, uniqueID),
346 ddi(processDataDDI),
347 deviceValuePresentationObject(deviceValuePresentationObjectID),
348 propertiesBitfield(processDataProperties),
349 triggerMethodsBitfield(processDataTriggerMethods)
350 {
351 }
352
354 {
355 return tableID;
356 }
357
362
363 std::vector<std::uint8_t> DeviceProcessDataObject::get_binary_object() const
364 {
365 std::vector<std::uint8_t> retVal;
366
367 retVal.reserve(11 + designator.size());
368
369 retVal.push_back(tableID[0]);
370 retVal.push_back(tableID[1]);
371 retVal.push_back(tableID[2]);
372 retVal.push_back(static_cast<std::uint8_t>(get_object_id() & 0xFF));
373 retVal.push_back(static_cast<std::uint8_t>((get_object_id() >> 8) & 0xFF));
374 retVal.push_back(static_cast<std::uint8_t>(ddi & 0xFF));
375 retVal.push_back(static_cast<std::uint8_t>((ddi >> 8) & 0xFF));
376 retVal.push_back(propertiesBitfield);
377 retVal.push_back(triggerMethodsBitfield);
378 retVal.push_back(static_cast<std::uint8_t>(designator.size()));
379 for (std::size_t i = 0; i < designator.size(); i++)
380 {
381 retVal.push_back(designator[i]);
382 }
383 retVal.push_back(deviceValuePresentationObject & 0xFF);
384 retVal.push_back((deviceValuePresentationObject >> 8) & 0xFF);
385 return retVal;
386 }
387
389 {
390 return ddi;
391 }
392
393 void DeviceProcessDataObject::set_ddi(std::uint16_t newDDI)
394 {
395 ddi = newDDI;
396 }
397
402
407
409 {
410 return propertiesBitfield;
411 }
412
414 {
415 propertiesBitfield = properties;
416 }
417
422
424 {
425 triggerMethodsBitfield = methods;
426 }
427
428 const std::string DevicePropertyObject::tableID = "DPT";
429
430 DevicePropertyObject::DevicePropertyObject(std::string propertyDesignator,
431 std::int32_t propertyValue,
432 std::uint16_t propertyDDI,
433 std::uint16_t valuePresentationObject,
434 std::uint16_t uniqueID) :
435 Object(propertyDesignator, uniqueID),
436 value(propertyValue),
437 ddi(propertyDDI),
438 deviceValuePresentationObject(valuePresentationObject)
439 {
440 }
441
443 {
444 return tableID;
445 }
446
451
452 std::vector<std::uint8_t> DevicePropertyObject::get_binary_object() const
453 {
454 std::vector<std::uint8_t> retVal;
455
456 retVal.reserve(13 + designator.size());
457
458 retVal.push_back(tableID[0]);
459 retVal.push_back(tableID[1]);
460 retVal.push_back(tableID[2]);
461 retVal.push_back(static_cast<std::uint8_t>(get_object_id() & 0xFF));
462 retVal.push_back(static_cast<std::uint8_t>((get_object_id() >> 8) & 0xFF));
463 retVal.push_back(static_cast<std::uint8_t>(ddi & 0xFF));
464 retVal.push_back(static_cast<std::uint8_t>((ddi >> 8) & 0xFF));
465 retVal.push_back(static_cast<std::uint8_t>(value & 0xFF));
466 retVal.push_back(static_cast<std::uint8_t>((value >> 8) & 0xFF));
467 retVal.push_back(static_cast<std::uint8_t>((value >> 16) & 0xFF));
468 retVal.push_back(static_cast<std::uint8_t>((value >> 24) & 0xFF));
469 retVal.push_back(static_cast<std::uint8_t>(designator.size()));
470 for (std::size_t i = 0; i < designator.size(); i++)
471 {
472 retVal.push_back(designator[i]);
473 }
474 retVal.push_back(deviceValuePresentationObject & 0xFF);
475 retVal.push_back((deviceValuePresentationObject >> 8) & 0xFF);
476 return retVal;
477 }
478
480 {
481 return value;
482 }
483
484 void DevicePropertyObject::set_value(std::int32_t newValue)
485 {
486 value = newValue;
487 }
488
489 std::uint16_t DevicePropertyObject::get_ddi() const
490 {
491 return ddi;
492 }
493
494 void DevicePropertyObject::set_ddi(std::uint16_t newDDI)
495 {
496 ddi = newDDI;
497 }
498
503
508
509 const std::string DeviceValuePresentationObject::tableID = "DVP";
510
512 std::int32_t offsetValue,
513 float scaleFactor,
514 std::uint8_t numberDecimals,
515 std::uint16_t uniqueID) :
516 Object(unitDesignator, uniqueID),
517 offset(offsetValue),
518 scale(scaleFactor),
519 numberOfDecimals(numberDecimals)
520 {
521 }
522
524 {
525 return tableID;
526 }
527
532
533 std::vector<std::uint8_t> DeviceValuePresentationObject::get_binary_object() const
534 {
535 std::vector<std::uint8_t> retVal;
536
537 retVal.reserve(16 + designator.size());
538
539 retVal.push_back(tableID[0]);
540 retVal.push_back(tableID[1]);
541 retVal.push_back(tableID[2]);
542 retVal.push_back(static_cast<std::uint8_t>(get_object_id() & 0xFF));
543 retVal.push_back(static_cast<std::uint8_t>((get_object_id() >> 8) & 0xFF));
544 retVal.push_back(static_cast<std::uint8_t>(offset & 0xFF));
545 retVal.push_back(static_cast<std::uint8_t>((offset >> 8) & 0xFF));
546 retVal.push_back(static_cast<std::uint8_t>((offset >> 16) & 0xFF));
547 retVal.push_back(static_cast<std::uint8_t>((offset >> 24) & 0xFF));
548 static_assert(sizeof(float) == 4, "Float must be 4 bytes");
549 std::array<std::uint8_t, sizeof(float)> floatBytes = { 0 };
550 memcpy(floatBytes.data(), &scale, sizeof(float));
551
552 if (is_big_endian())
553 {
554 std::reverse(floatBytes.begin(), floatBytes.end());
555 }
556
557 for (std::uint_fast8_t i = 0; i < 4; i++)
558 {
559 retVal.push_back(floatBytes[i]);
560 }
561 retVal.push_back(numberOfDecimals);
562 retVal.push_back(static_cast<std::uint8_t>(designator.size()));
563 for (std::size_t i = 0; i < designator.size(); i++)
564 {
565 retVal.push_back(designator[i]);
566 }
567 return retVal;
568 }
569
571 {
572 return offset;
573 }
574
575 void DeviceValuePresentationObject::set_offset(std::int32_t newOffset)
576 {
577 offset = newOffset;
578 }
579
581 {
582 return scale;
583 }
584
586 {
587 scale = newScale;
588 }
589
594
596 {
597 numberOfDecimals = decimals;
598 }
599
600 } // namespace task_controller_object
601} // namespace isobus
General constants used throughout this library.
A class that represents an ISO11783 control function NAME from an address claim.
Definition can_NAME.hpp:24
std::string get_table_id() const override
Returns the XML namespace for the object.
void set_element_number(std::uint16_t newElementNumber)
Update the object's element number to a new value.
ObjectTypes get_object_type() const override
Returns the object type.
std::uint16_t elementNumber
Element number for process data variable addressing.
std::uint16_t parentObject
Object ID of parent DeviceElementObject or DeviceObject in order to establish a hierarchical order of...
void add_reference_to_child_object(std::uint16_t childID)
This function can be called to add an object as a child of this object.
std::uint16_t get_number_child_objects() const
Returns the number of child objects added with add_reference_to_child_object.
std::vector< std::uint8_t > get_binary_object() const override
Returns the binary representation of the TC object, or an empty vector if object is invalid.
bool remove_reference_to_child_object(std::uint16_t childID)
Removes a child object reference from this object.
std::uint16_t get_element_number() const
Returns the element number.
std::uint16_t get_parent_object() const
Returns the parent object ID.
DeviceElementObject(std::string deviceElementDesignator, std::uint16_t deviceElementNumber, std::uint16_t parentObjectID, Type deviceEelementType, std::uint16_t uniqueID)
Constructor for a DeviceElementObject.
std::uint16_t get_child_object_id(std::size_t index)
Returns a child object ID by index.
Type get_type() const
Returns the type of the element object.
static const std::string tableID
XML element namespace for DeviceElement.
std::vector< std::uint16_t > referenceList
List of references to DeviceProcessDataObjects or DevicePropertyObjects.
Type elementType
See the comments on Type or ISO11783-10 table A.2.
void set_parent_object(std::uint16_t parentObjectID)
Updates the object ID associated to this object's parent object.
DeviceObject(std::string deviceDesignator, std::string deviceSoftwareVersion, std::string deviceSerialNumber, std::string deviceStructureLabel, std::array< std::uint8_t, 7 > deviceLocalizationLabel, std::vector< std::uint8_t > deviceExtendedStructureLabel, std::uint64_t clientIsoNAME, bool shouldUseExtendedStructureLabel)
Constructor for a DeviceObject.
std::string get_serial_number() const
Returns the serial number for the device.
std::array< std::uint8_t, 7 > get_localization_label() const
Returns the localization label for this DDOP.
void set_localization_label(std::array< std::uint8_t, 7 > label)
Changes the localization label to a new value.
void set_structure_label(const std::string &label)
Sets the device structure label to a new value.
void set_serial_number(const std::string &serial)
Sets the serial number for the device as reported in the DDOP.
std::vector< std::uint8_t > extendedStructureLabel
Continuation of the Label given by Device to identify the Device descriptor Structure.
void set_software_version(const std::string &version)
Sets the software version for the device, as reported in the DDOP.
std::string serialNumber
Device and manufacturer-specific serial number of the Device.
ObjectTypes get_object_type() const override
Returns the object type.
std::uint64_t get_iso_name() const
Returns the ISO NAME associated with this DDOP.
void set_extended_structure_label(const std::vector< std::uint8_t > &label)
Sets the extended structure label to a new value. Only used for TCs with version 4+.
std::vector< std::uint8_t > get_extended_structure_label() const
Returns the extended structure label (if applicable)
std::string structureLabel
Label given by device to identify the device descriptor structure.
bool useExtendedStructureLabel
Tells the device if it should generate binary info using the extended structure label or ignore it.
std::string get_structure_label() const
Returns the structure label for this DDOP.
std::string get_software_version() const
Returns the software version of the device.
std::array< std::uint8_t, task_controller_object::DeviceObject::MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH > localizationLabel
Label given by device to identify the device descriptor localization.
static constexpr std::size_t MAX_STRUCTURE_AND_LOCALIZATION_LABEL_LENGTH
Defines the max length of the device structure label and device localization label (in bytes)
bool get_use_extended_structure_label() const
Returns if the class will append the extended structure label to its serialized form.
static const std::string tableID
XML element namespace for device.
void set_iso_name(std::uint64_t name)
Changes the stored ISO NAME to a new value.
std::uint64_t NAME
The NAME of client device as defined in ISO 11783-5. MUST match your address claim.
std::string get_table_id() const override
Returns the XML namespace for the object.
void set_use_extended_structure_label(bool shouldUseExtendedStructureLabel)
Sets the class' behavior for dealing with the extended structure label.
std::vector< std::uint8_t > get_binary_object() const override
Returns the binary representation of the TC object, or an empty vector if object is invalid.
ObjectTypes get_object_type() const override
Returns the object type.
void set_ddi(std::uint16_t newDDI)
Updates the DDI associated to this DPD object.
DeviceProcessDataObject(std::string processDataDesignator, std::uint16_t processDataDDI, std::uint16_t deviceValuePresentationObjectID, std::uint8_t processDataProperties, std::uint8_t processDataTriggerMethods, std::uint16_t uniqueID)
Constructor for a DeviceProcessDataObject.
std::string get_table_id() const override
Returns the XML element namespace for DeviceProcess-Data.
std::vector< std::uint8_t > get_binary_object() const override
Returns the binary representation of the TC object, or an empty vector if object is invalid.
std::uint8_t propertiesBitfield
A bitset of properties for this object.
std::uint8_t get_trigger_methods_bitfield() const
Returns the object's available trigger methods.
std::uint16_t get_device_value_presentation_object_id() const
Returns Object identifier of the DeviceValuePresentation-Object for this object, or the null ID.
void set_trigger_methods_bitfield(std::uint8_t methods)
Updates the object's available trigger methods bitfield to a new value.
void set_device_value_presentation_object_id(std::uint16_t id)
Updates the object ID to use as an associated presentation for this object.
std::uint16_t deviceValuePresentationObject
Object identifier of DeviceValuePresentation-Object.
std::uint8_t get_properties_bitfield() const
Returns the object's properties bitfield.
void set_properties_bitfield(std::uint8_t properties)
Updates the properties bitfield to a new value.
static const std::string tableID
XML element namespace for DeviceProcessData.
std::vector< std::uint8_t > get_binary_object() const override
Returns the binary representation of the TC object, or an empty vector if object is invalid.
std::string get_table_id() const override
Returns the XML element namespace for DeviceProperty.
ObjectTypes get_object_type() const override
Returns the object type.
void set_device_value_presentation_object_id(std::uint16_t id)
Updates the object ID to use as an associated presentation for this object.
DevicePropertyObject(std::string propertyDesignator, std::int32_t propertyValue, std::uint16_t propertyDDI, std::uint16_t valuePresentationObject, std::uint16_t uniqueID)
Constructor for a DevicePropertyObject.
void set_ddi(std::uint16_t newDDI)
Updates the DDI associated with this DPT object to a new value.
std::uint16_t get_device_value_presentation_object_id() const
Returns the object identifier of an associated DeviceValuePresentationObject.
std::uint16_t deviceValuePresentationObject
Object identifier of DeviceValuePresentationObject.
void set_value(std::int32_t newValue)
Sets the property value.
std::uint16_t get_ddi() const
Returns the DDI for this object.
static const std::string tableID
XML element namespace for DeviceProperty.
std::uint16_t ddi
Identifier of property (DDI) according to definitions in Annex B and ISO 11783 - 11.
std::int32_t get_offset() const
Returns the offset that is applied to the value for presentation.
std::string get_table_id() const override
Returns the XML element namespace for DeviceValuePresentation.
void set_number_of_decimals(std::uint8_t decimals)
Sets the number of decimals to show when presenting objects associated with this presentation.
std::vector< std::uint8_t > get_binary_object() const override
Returns the binary representation of the TC object, or an empty vector if object is invalid.
float get_scale() const
Returns the scale that is applied to the value for presentation.
DeviceValuePresentationObject(std::string unitDesignator, std::int32_t offsetValue, float scaleFactor, std::uint8_t numberDecimals, std::uint16_t uniqueID)
The constructor for a DeviceValuePresentationObject.
void set_offset(std::int32_t newOffset)
Sets the offset that is applied to the value for presentation.
std::int32_t offset
Offset to be applied to the value for presentation.
void set_scale(float newScale)
Sets the scale which will be applied to the value for presentation.
std::uint8_t get_number_of_decimals() const
Returns the number of decimals shown after the decimal point.
static const std::string tableID
XML element namespace for DeviceValuePresentation.
std::uint8_t numberOfDecimals
Specify number of decimals to display after the decimal point.
void set_designator(const std::string &newDesignator)
Updates the designator to a new value.
void set_object_id(std::uint16_t id)
Updates the object ID of the object to a new value.
std::string get_designator() const
Returns the Descriptive text for this object, UTF-8 encoded, 32 characters max.
std::uint16_t get_object_id() const
Returns the object ID of the object.
std::string designator
UTF-8 Descriptive text to identify this object. Max length of 32.
std::uint16_t objectID
Unique object ID in the DDOP.
Object(std::string objectDesignator, std::uint16_t uniqueID)
Constructor for the TC object base class.
Defines a set of C++ objects that represent a DDOP.
ObjectTypes
Enumerates the different kinds of DDOP objects.
@ DeviceProperty
A device property element.
@ DeviceProcessData
Contains a single process data variable definition.
@ DeviceElement
Subcomponent of a device. Has multiple sub-types.
@ DeviceValuePresentation
Contains the presentation information to display the value of a DeviceProcessData or DeviceProperty o...
@ Device
The root object. Each device shall have one single Device.
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.