-
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathisobus_virtual_terminal_client.hpp
1693 lines (1477 loc) · 92.7 KB
/
isobus_virtual_terminal_client.hpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//================================================================================================
/// @file isobus_virtual_terminal_client.hpp
///
/// @brief A class to manage a client connection to a ISOBUS virtual terminal display
/// @author Adrian Del Grosso
///
/// @copyright 2022 The Open-Agriculture Developers
//================================================================================================
#ifndef ISOBUS_VIRTUAL_TERMINAL_CLIENT_HPP
#define ISOBUS_VIRTUAL_TERMINAL_CLIENT_HPP
#include "can_internal_control_function.hpp"
#include "can_partnered_control_function.hpp"
#include "isobus_language_command_interface.hpp"
#include "isobus_virtual_terminal_objects.hpp"
#include "event_dispatcher.hpp"
#include "processing_flags.hpp"
#include "thread_synchronization.hpp"
#include <functional>
#include <map>
#include <memory>
#include <string>
#include <vector>
#if !defined CAN_STACK_DISABLE_THREADS && !defined ARDUINO
#include <thread>
#endif
namespace isobus
{
//================================================================================================
/// @class VirtualTerminalClient
///
/// @brief An client interface for interacting with a virtual terminal (VT) server
/// @details This class is the main interface for working with a VT. To use it,
/// you must instantiate it with a source and partner control function, and set and one or more
/// object pools to this class to be uploaded to the VT server. Once this setup is done, call
/// the initialize function to start running the internal state machine. The stack will take care
/// of uploading the object pool, and then you will be able to interact with the pool using the
/// provided "send" functions from your application.
//================================================================================================
class VirtualTerminalClient
{
public:
/// @brief Enumerates the multiplexor byte values for VT commands
enum class Function : std::uint8_t
{
SoftKeyActivationMessage = 0x00,
ButtonActivationMessage = 0x01,
PointingEventMessage = 0x02,
VTSelectInputObjectMessage = 0x03,
VTESCMessage = 0x04,
VTChangeNumericValueMessage = 0x05,
VTChangeActiveMaskMessage = 0x06,
VTChangeSoftKeyMaskMessage = 0x07,
VTChangeStringValueMessage = 0x08,
VTOnUserLayoutHideShowMessage = 0x09,
VTControlAudioSignalTerminationMessage = 0x0A,
ObjectPoolTransferMessage = 0x11,
EndOfObjectPoolMessage = 0x12,
AuxiliaryAssignmentTypeOneCommand = 0x20,
AuxiliaryInputTypeOneStatus = 0x21,
PreferredAssignmentCommand = 0x22,
AuxiliaryInputTypeTwoMaintenanceMessage = 0x23,
AuxiliaryAssignmentTypeTwoCommand = 0x24,
AuxiliaryInputStatusTypeTwoEnableCommand = 0x25,
AuxiliaryInputTypeTwoStatusMessage = 0x26,
AuxiliaryCapabilitiesRequest = 0x27,
SelectActiveWorkingSet = 0x90,
ESCCommand = 0x92,
HideShowObjectCommand = 0xA0,
EnableDisableObjectCommand = 0xA1,
SelectInputObjectCommand = 0xA2,
ControlAudioSignalCommand = 0xA3,
SetAudioVolumeCommand = 0xA4,
ChangeChildLocationCommand = 0xA5,
ChangeSizeCommand = 0xA6,
ChangeBackgroundColourCommand = 0xA7,
ChangeNumericValueCommand = 0xA8,
ChangeEndPointCommand = 0xA9,
ChangeFontAttributesCommand = 0xAA,
ChangeLineAttributesCommand = 0xAB,
ChangeFillAttributesCommand = 0xAC,
ChangeActiveMaskCommand = 0xAD,
ChangeSoftKeyMaskCommand = 0xAE,
ChangeAttributeCommand = 0xAF,
ChangePriorityCommand = 0xB0,
ChangeListItemCommand = 0xB1,
DeleteObjectPoolCommand = 0xB2,
ChangeStringValueCommand = 0xB3,
ChangeChildPositionCommand = 0xB4,
ChangeObjectLabelCommand = 0xB5,
ChangePolygonPointCommand = 0xB6,
ChangePolygonScaleCommand = 0xB7,
GraphicsContextCommand = 0xB8,
GetAttributeValueMessage = 0xB9,
SelectColourMapCommand = 0xBA,
IdentifyVTMessage = 0xBB,
ExecuteExtendedMacroCommand = 0xBC,
LockUnlockMaskCommand = 0xBD,
ExecuteMacroCommand = 0xBE,
GetMemoryMessage = 0xC0,
GetSupportedWidecharsMessage = 0xC1,
GetNumberOfSoftKeysMessage = 0xC2,
GetTextFontDataMessage = 0xC3,
GetWindowMaskDataMessage = 0xC4,
GetSupportedObjectsMessage = 0xC5,
GetHardwareMessage = 0xC7,
StoreVersionCommand = 0xD0,
LoadVersionCommand = 0xD1,
DeleteVersionCommand = 0xD2,
ExtendedGetVersionsMessage = 0xD3,
ExtendedStoreVersionCommand = 0xD4,
ExtendedLoadVersionCommand = 0xD5,
ExtendedDeleteVersionCommand = 0xD6,
GetVersionsMessage = 0xDF,
GetVersionsResponse = 0xE0,
UnsupportedVTFunctionMessage = 0xFD,
VTStatusMessage = 0xFE,
WorkingSetMaintenanceMessage = 0xFF
};
/// @brief Enumerates the states that can be sent with a hide/show object command
enum class HideShowObjectCommand : std::uint8_t
{
HideObject = 0, ///< Hides the object
ShowObject = 1 ///< Shows an object
};
/// @brief Enumerates the states that can be sent with an enable/disable object command
enum class EnableDisableObjectCommand : std::uint8_t
{
DisableObject = 0, ///< Disables a compatible object
EnableObject = 1 ///< Enables a compatible object
};
/// @brief Enumerates the states that can be sent with a select input object options command
enum class SelectInputObjectOptions : std::uint8_t
{
ActivateObjectForDataInput = 0x00, ///< Activates an object for data input
SetFocusToObject = 0xFF ///< Focuses the object (usually this draws a temporary box around it)
};
/// @brief The different VT versions that a client or server might support
enum class VTVersion
{
Version2OrOlder, ///< Client or server supports VT version 2 or lower
Version3, ///< Client or server supports all of VT version 3
Version4, ///< Client or server supports all of VT version 4
Version5, ///< Client or server supports all of VT version 5
Version6, ///< Client or server supports all of VT version 6
ReservedOrUnknown, ///< Reserved value, not to be used
};
/// @brief Enumerates the different line directions that can be used when changing an endpoint of an object
enum class LineDirection : std::uint8_t
{
TopLeftToBottomRightOfEnclosingVirtualRectangle = 0, ///< Draws the line from top left to bottom right of the enclosing virtual rectangle
BottomLeftToTopRightOfEnclosingVirtualRectangle = 1 ///< Draws the line from bottom left to top right of the enclosing virtual rectangle
};
/// @brief Enumerates the different font sizes
enum class FontSize : std::uint8_t
{
Size6x8 = 0, ///< 6x8 Font size
Size8x8 = 1, ///< 8x8 Font size
Size8x12 = 2, ///< 8x12 Font size
Size12x16 = 3, ///< 12x16 Font size
Size16x16 = 4, ///< 16x16 Font size
Size16x24 = 5, ///< 16x24 Font size
Size24x32 = 6, ///< 24x32 Font size
Size32x32 = 7, ///< 32x32 Font size
Size32x48 = 8, ///< 32x48 Font size
Size48x64 = 9, ///< 48x64 Font size
Size64x64 = 10, ///< 64x64 Font size
Size64x96 = 11, ///< 64x96 Font size
Size96x128 = 12, ///< 96x128 Font size
Size128x128 = 13, ///< 128x128 Font size
Size128x192 = 14 ///< 128x192 Font size
};
/// @brief Enumerates the font style options that can be encoded in a font style bitfield
enum class FontStyleBits : std::uint8_t
{
Bold = 0, ///< Bold font style
CrossedOut = 1, ///< Crossed-out font style (strikethrough)
Underlined = 2, ///< Underlined font style
Italic = 3, ///< Italic font style
Inverted = 4, ///< Inverted font style (upside down)
Flashing = 5, ///< Flashing font style
FlashingHidden = 6, ///< Flashing between hidden and shown font style
ProportionalFontRendering = 7 ///< Enables proportional font rendering if supported by the server
};
/// @brief Enumerates the different font types
enum class FontType : std::uint8_t
{
ISO8859_1 = 0, ///< ISO Latin 1
ISO8859_15 = 1, ///< ISO Latin 9
ISO8859_2 = 2, ///< ISO Latin 2
Reserved_1 = 3, ///< Reserved
ISO8859_4 = 4, ///< ISO Latin 4
ISO8859_5 = 5, ///< Cyrillic
Reserved_2 = 6, ///< Reserved
ISO8859_7 = 7, ///< Greek
ReservedEnd = 239, ///< Reserved from ISO8859_7 to this value
ProprietaryBegin = 240, ///< The beginning of the proprietary range
ProprietaryEnd = 255 ///< The end of the proprietary region
};
/// @brief Enumerates the different fill types for an object
enum class FillType : std::uint8_t
{
NoFill = 0, ///< No fill will be applied
FillWithLineColour = 1, ///< Fill with the colour of the outline of the shape
FillWithSpecifiedColourInFillColourAttribute = 2, ///< Fill with the colour specified by a fill attribute
FillWithPatternGivenByFillPatternAttribute = 3 ///< Fill with a patter provided by a fill pattern attribute
};
/// @brief The types of object pool masks
enum class MaskType : std::uint8_t
{
DataMask = 1, ///< A data mask, used in normal circumstances
AlarmMask = 2 ///< An alarm mask, which has different metadata related to popping up alarms, like priority
};
/// @brief The allowable priorities of an alarm mask
enum class AlarmMaskPriority : std::uint8_t
{
High = 0, ///< Overrides lower priority alarm masks
Medium = 1, ///< Overrides low priority alarm masks
Low = 2 ///< Overrides data masks
};
/// @brief Denotes the lock/unlock state of a mask. Used to freeze/unfreeze rendering of a mask.
enum class MaskLockState : std::uint8_t
{
UnlockMask = 0, ///< Renders the mask normally
LockMask = 1 ///< Locks the mask so rendering of it is not updated until it is unlocked or a timeout occurs
};
/// @brief The different key activation codes that a button press can generate
enum class KeyActivationCode : std::uint8_t
{
ButtonUnlatchedOrReleased = 0, ///< Button is released
ButtonPressedOrLatched = 1, ///< Button is pressed
ButtonStillHeld = 2, ///< Button is being held down (sent cyclically)
ButtonPressAborted = 3 ///< Press was aborted (user navigated away from the button and did not release it)
};
/// @brief Enumerates the errors that can be present in an ESC message
enum class ESCMessageErrorCode : std::uint8_t
{
NoError = 0, ///< No error occurred
NoInputFieldOpen = 1, ///< No input field is open
OtherError = 5 ///< Error is not one of the above
};
/// @brief Enumerates the different events that can be associated with a macro
enum class MacroEventID : std::uint8_t
{
Reserved = 0, ///< Reserved
OnActivate = 1, ///< Event on activation of an object (such as for data input)
OnDeactivate = 2, ///< Event on deactivation of an object
OnShow = 3, ///< Event on an object being shown
OnHide = 4, ///< Event on an object being hidden
OnEnable = 5, ///< Event on enable of an object
OnDisable = 6, ///< Event on disabling an object
OnChangeActiveMask = 7, ///< Event on changing the active mask
OnChangeSoftKeyMask = 8, ///< Event on change of the soft key mask
OnChangeAttribute = 9, ///< Event on change of an attribute value
OnChangeBackgroundColour = 10, ///< Event on change of a background colour
OnChangeFontAttributes = 11, ///< Event on change of a font attribute
OnChangeLineAttributes = 12, ///< Event on change of a line attribute
OnChangeFillAttributes = 13, ///< Event on change of a fill attribute
OnChangeChildLocation = 14, ///< Event on change of a child objects location
OnChangeSize = 15, ///< Event on change of an object size
OnChangeValue = 16, ///< Event on change of an object value (like via `change numeric value`)
OnChangePriority = 17, ///< Event on change of a mask's priority
OnChangeEndPoint = 18, ///< Event on change of an object endpoint
OnInputFieldSelection = 19, ///< Event when an input field is selected
OnInputFieldDeselection = 20, ///< Event on deselection of an input field
OnESC = 21, ///< Event on ESC (escape)
OnEntryOfValue = 22, ///< Event on entry of a value
OnEntryOfNewValue = 23, ///< Event on entry of a *new* value
OnKeyPress = 24, ///< Event on the press of a key
OnKeyRelease = 25, ///< Event on the release of a key
OnChangeChildPosition = 26, ///< Event on changing a child object's position
OnPointingEventPress = 27, ///< Event on a pointing event press
OnPointingEventRelease = 28, ///< Event on a pointing event release
ReservedBegin = 29, ///< Beginning of the reserved range
ReservedEnd = 254, ///< End of the reserved range
UseExtendedMacroReference = 255 ///< Use extended macro reference
};
/// @brief Enumerates the various VT server graphics modes
enum class GraphicMode : std::uint8_t
{
Monochrome = 0, ///< Monochromatic graphics mode (1 bit)
SixteenColour = 1, ///< 16 Colour mode (4 bit)
TwoHundredFiftySixColour = 2 ///< 256 Colour mode (8 bit)
};
/// @brief Enumerates the various auxiliary input function types
enum class AuxiliaryTypeTwoFunctionType : std::uint8_t
{
BooleanLatching = 0, ///< Two-position switch (maintains position) (Single Pole, Double Throw)
AnalogueLatching = 1, ///< Two-way analogue (Maintains position setting)
BooleanMomentary = 2, ///< Two-position switch (returns to off) (Momentary Single Pole, Single Throw)
AnalogueMomentaryTwoWay = 3, ///< Two-way analogue (returns to centre position - 50%)
AnalogueMomentaryOneWay = 4, ///< One-way analogue (returns to 0%)
DualBooleanLatching = 5, ///< Three-position switch (maintains position) (Single Pole, Three Positions, Centre Off)
DualBooleanMomentary = 6, ///< Three-position switch (returns to off/centre position) (Momentary Single Pole, Three Positions, Centre Off)
DualBooleanLatchingUpOnly = 7, ///< Three-position switch (maintains position only in up position) (Single Pole, Three Positions, Centre Off)
DualBooleanLatchingDownpOnly = 8, ///< Three-position switch (maintains position only in down position) (Momentary Single Pole, Three Positions, Centre Off)
AnalogueMomentaryBooleanLatching = 9, ///< two-way analogue (returns to centre position) with latching Boolean at 0% and 100% positions
AnalogueLatchingBooleanLatching = 10, ///< two-way analogue (maintains position setting) with momentary Boolean at 0% and 100% positions
QuadratureBooleanMomentary = 11, ///< Two Quadrature mounted Three-position switches (returns to centre position) (Momentary Single Pole, Three Position Single Throw, Centre Off)
QuadratureAnalogueLatching = 12, ///< Two Quadrature mounted Two-way analogue (maintains position)
QuadratureAnalogueMomentary = 13, ///< Two Quadrature mounted Two-way analogue (returns to centre position - 50%)
BidirectionalEncoder = 14, ///< Count increases when turning in the encoders "increase" direction, and decreases when turning in the opposite direction
Reserved = 30, ///< 15-30 Reserved
ReservedRemoveAssignment = 31 ///< Used for Remove assignment command
};
/// @brief The internal state machine state of the VT client, mostly just public so tests can access it
enum class StateMachineState : std::uint8_t
{
Disconnected, ///< VT is not connected, and is not trying to connect yet
WaitForPartnerVTStatusMessage, ///< VT client is initialized, waiting for a VT server to come online
SendWorkingSetMasterMessage, ///< Client is sending the working state master message
ReadyForObjectPool, ///< Client needs an object pool before connection can continue
SendGetMemory, ///< Client is sending the "get memory" message to see if VT has enough memory available
WaitForGetMemoryResponse, ///< Client is waiting for a response to the "get memory" message
SendGetNumberSoftkeys, ///< Client is sending the "get number of soft keys" message
WaitForGetNumberSoftKeysResponse, ///< Client is waiting for a response to the "get number of soft keys" message
SendGetTextFontData, ///< Client is sending the "get text font data" message
WaitForGetTextFontDataResponse, ///< Client is waiting for a response to the "get text font data" message
SendGetHardware, ///< Client is sending the "get hardware" message
WaitForGetHardwareResponse, ///< Client is waiting for a response to the "get hardware" message
SendGetVersions, ///< If a version label was specified, check to see if the VT has that version already
WaitForGetVersionsResponse, ///< Client is waiting for a response to the "get versions" message
SendStoreVersion, ///< Sending the store version command
WaitForStoreVersionResponse, ///< Client is waiting for a response to the store version command
SendLoadVersion, ///< Sending the load version command
WaitForLoadVersionResponse, ///< Client is waiting for the VT to respond to the "Load Version" command
UploadObjectPool, ///< Client is uploading the object pool
SendEndOfObjectPool, ///< Client is sending the end of object pool message
WaitForEndOfObjectPoolResponse, ///< Client is waiting for the end of object pool response message
Connected, ///< Client is connected to the VT server and the application layer is in control
Failed ///< Client could not connect to the VT due to an error
};
/// @brief A struct for storing information of a function assigned to an auxiliary input
class AssignedAuxiliaryFunction
{
public:
/// @brief Constructs a `AssignedAuxiliaryFunction`, sets default values
/// @param[in] functionObjectID the object ID of the function present in our object pool
/// @param[in] inputObjectID the object ID assigned on the auxiliary inputs end
/// @param[in] functionType the type of function
AssignedAuxiliaryFunction(std::uint16_t functionObjectID, std::uint16_t inputObjectID, AuxiliaryTypeTwoFunctionType functionType);
/// @brief Allows easy comparison of two `AssignedAuxiliaryFunction` objects
/// @param[in] other the object to compare against
/// @returns true if the objects are equal, false otherwise
bool operator==(const AssignedAuxiliaryFunction &other) const;
std::uint16_t functionObjectID; ///< The object ID of the function present in our object pool
std::uint16_t inputObjectID; ///< The object ID assigned on the auxiliary inputs end
AuxiliaryTypeTwoFunctionType functionType; ///< The type of function
};
/// @brief The constructor for a VirtualTerminalClient
/// @param[in] partner The VT server control function
/// @param[in] clientSource The internal control function to communicate from
VirtualTerminalClient(std::shared_ptr<PartneredControlFunction> partner, std::shared_ptr<InternalControlFunction> clientSource);
/// @brief Deleted copy constructor for VirtualTerminalClient
VirtualTerminalClient(VirtualTerminalClient &) = delete;
/// @brief The destructor for the VirtualTerminalClient
~VirtualTerminalClient();
// Setup Functions
/// @brief This function starts the state machine. Call this once you have supplied 1 or more object pool and are ready to connect.
/// @param[in] spawnThread The client will start a thread to manage itself if this parameter is true. Otherwise you must update it cyclically.
void initialize(bool spawnThread);
/// @brief Returns if the client has been initialized
/// @note This does not mean that the client is connected to the VT server
/// @returns true if the client has been initialized
bool get_is_initialized() const;
/// @brief Check whether the client is connected to the VT server
/// @returns true if cconnected, false otherwise
bool get_is_connected() const;
/// @brief Terminates the client and joins the worker thread if applicable
void terminate();
/// @brief Halts communication with the VT gracefully and restarts it.
void restart_communication();
/// @brief Returns the control function of the VT server with which this VT client communicates.
/// @returns The partner control function for the VT server
std::shared_ptr<PartneredControlFunction> get_partner_control_function() const;
/// @brief Returns the internal control function being used by the client
/// @returns The internal control function being used by the client
std::shared_ptr<InternalControlFunction> get_internal_control_function() const;
/// @brief Returns the active working set master's address
/// @returns The active working set master's address, or 0xFE (NULL_CAN_ADDRESS) if none or unknown
std::uint8_t get_active_working_set_master_address() const;
/// @brief A struct for storing information of a VT key input event
struct VTKeyEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t objectID; ///< The object ID
std::uint16_t parentObjectID; ///< The parent object ID
std::uint8_t keyNumber; ///< The key number
KeyActivationCode keyEvent; ///< The key event
};
/// @brief A struct for storing information of a VT pointing event
struct VTPointingEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t xPosition; ///< The x position
std::uint16_t yPosition; ///< The y position
std::uint16_t parentObjectID; ///< The parent object ID
KeyActivationCode keyEvent; ///< The key event
};
/// @brief A struct for storing information of a VT input object selection event
struct VTSelectInputObjectEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t objectID; ///< The object ID
bool objectSelected; ///< Whether the object is selected
bool objectOpenForInput; ///< Whether the object is open for input
};
/// @brief A struct for storing information of a VT ESC message event
struct VTESCMessageEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t objectID; ///< The object ID
ESCMessageErrorCode errorCode; ///< The error code
};
/// @brief A struct for storing information of a VT change numeric value event
struct VTChangeNumericValueEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint32_t value; ///< The value
std::uint16_t objectID; ///< The object ID
};
/// @brief A struct for storing information of a VT change active mask event
struct VTChangeActiveMaskEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t maskObjectID; ///< The mask object ID
std::uint16_t errorObjectID; ///< The error object ID
std::uint16_t parentObjectID; ///< The parent object ID
bool missingObjects; ///< Whether there are missing objects
bool maskOrChildHasErrors; ///< Whether the mask or child has errors
bool anyOtherError; ///< Whether there are any other errors
bool poolDeleted; ///< Whether the pool has been deleted
};
/// @brief A struct for storing information of a VT change soft key mask event
struct VTChangeSoftKeyMaskEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t dataOrAlarmMaskObjectID; ///< The data or alarm mask object ID
std::uint16_t softKeyMaskObjectID; ///< The soft key mask object ID
bool missingObjects; ///< Whether there are missing objects
bool maskOrChildHasErrors; ///< Whether the mask or child has errors
bool anyOtherError; ///< Whether there are any other errors
bool poolDeleted; ///< Whether the pool has been deleted
};
/// @brief A struct for storing information of a VT change string value event
struct VTChangeStringValueEvent
{
std::string value; ///< The value
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t objectID; ///< The object ID
};
/// @brief A struct for storing information of a VT on user-layout hide/show event
struct VTUserLayoutHideShowEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t objectID; ///< The object ID
bool isHidden; ///< Whether the object is hidden
};
/// @brief A struct for storing information of a VT control audio signal termination event
struct VTAudioSignalTerminationEvent
{
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
bool isTerminated; ///< Whether the audio signal is terminated
};
/// @brief A struct for storing information of an auxilary function event
struct AuxiliaryFunctionEvent
{
AssignedAuxiliaryFunction function; ///< The function
VirtualTerminalClient *parentPointer; ///< A pointer to the parent VT client
std::uint16_t value1; ///< The first value
std::uint16_t value2; ///< The second value
};
/// @brief The event dispatcher for when a soft key is pressed or released
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTKeyEvent> &get_vt_soft_key_event_dispatcher();
/// @brief The event dispatcher for when a button is pressed or released
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTKeyEvent> &get_vt_button_event_dispatcher();
/// @brief The event dispatcher for when a pointing event is "pressed or released"
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTPointingEvent> &get_vt_pointing_event_dispatcher();
/// @brief The event dispatcher for when an input object event is triggered
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTSelectInputObjectEvent> &get_vt_select_input_object_event_dispatcher();
/// @brief The event dispatcher for when an ESC message is received, e.g. an open object input is closed
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTESCMessageEvent> &get_vt_esc_message_event_dispatcher();
/// @brief The event dispatcher for when a numeric value is changed in an input object
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTChangeNumericValueEvent> &get_vt_change_numeric_value_event_dispatcher();
/// @brief The event dispatcher for when the active mask is changed
/// @details The VT sends this whenever there are missing object references or errors in the mask.
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTChangeActiveMaskEvent> &get_vt_change_active_mask_event_dispatcher();
/// @brief The event dispatcher for when the soft key mask is changed
/// @details The VT sends this whenever there are missing object references or errors in the mask.
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTChangeSoftKeyMaskEvent> &get_vt_change_soft_key_mask_event_dispatcher();
/// @brief The event dispatcher for when a string value is changed
/// @details The object could be either the input string object or the referenced string variable object.
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTChangeStringValueEvent> &get_vt_change_string_value_event_dispatcher();
/// @brief The event dispatcher for when a user-layout object is hidden or shown
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTUserLayoutHideShowEvent> &get_vt_user_layout_hide_show_event_dispatcher();
/// @brief The event dispatcher for when an audio signal is terminated
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<VTAudioSignalTerminationEvent> &get_vt_control_audio_signal_termination_event_dispatcher();
/// @brief The event dispatcher for for when a change in auxiliary input for a function is received
/// @returns A reference to the event dispatcher, used to add listeners
EventDispatcher<AuxiliaryFunctionEvent> &get_auxiliary_function_event_dispatcher();
/// @brief Set the model identification code of our auxiliary input device.
/// @details The model identification code is used to allow other devices identify
/// whether our device differs from a previous versions. If the model identification code
/// is different, the preferred assignments are reset.
/// @param[in] modelIdentificationCode The model identification code
void set_auxiliary_input_model_identification_code(std::uint16_t modelIdentificationCode);
/// @brief Get whether the VT has enabled the learn mode for the auxiliary input
/// @returns true if the VT has enabled the learn mode for the auxiliary input
bool get_auxiliary_input_learn_mode_enabled() const;
/// @brief Add a new auxiliary input to be managed by this virtual terminal object.
/// @details This function should be called for each auxiliary input that is available in the pool,
/// and will receive updates using update_auxiliary_input().
/// @param[in] auxiliaryInputID The ID of the auxiliary input
void add_auxiliary_input_object_id(const std::uint16_t auxiliaryInputID);
/// @brief Remove an auxiliary input from the pool of managed auxiliary inputs.
/// @param[in] auxiliaryInputID The ID of the auxiliary input
void remove_auxiliary_input_object_id(const std::uint16_t auxiliaryInputID);
/// @brief Update the state of an auxiliary input. This should be called when
/// the value of an auxiliary input changes.
/// @param[in] auxiliaryInputID The ID of the auxiliary input
/// @param[in] value1 The first value of the auxiliary input. See Table J.5 of Part 6 of the standard for details.
/// @param[in] value2 The second value of the auxiliary input. See Table J.5 of Part 6 of the standard for details.
/// @param[in] controlLocked Whether the auxiliary input is locked
void update_auxiliary_input(const std::uint16_t auxiliaryInputID, const std::uint16_t value1, const std::uint16_t value2, const bool controlLocked = false);
// Command Messages
/// @brief Sends a hide/show object command
/// @details This command is used to hide or show a Container object.
/// This pertains to the visibility of the object as well as its
/// remembered state.If the object cannot be displayed due to references to missing
/// objects, the VT generates an error in the response.
/// @param[in] objectID The ID of the target object
/// @param[in] command The target hide/show state of the object
/// @returns true if the message is being sent successfully
bool send_hide_show_object(std::uint16_t objectID, HideShowObjectCommand command);
/// @brief Sends an enable/disable object command
/// @details This command is used to enable or disable an input field object
/// or a Button object and pertains to the accessibility of an input field
/// object or Button object.This command is also used to enable or disable an Animation object.
/// It is allowed to enable already enabled objects and to disable already disabled objects.
/// @param[in] objectID The ID of the target object
/// @param[in] command The target enable/disable state of the object
/// @returns true if the message is being sent successfully
bool send_enable_disable_object(std::uint16_t objectID, EnableDisableObjectCommand command);
/// @brief Sends a select input object command
/// @details This command is used to force the selection of an input field, Button, or Key object.
/// @param[in] objectID The ID of the target object
/// @param[in] option The method by which the object will be selected
/// @returns true if the message is being sent successfully
bool send_select_input_object(std::uint16_t objectID, SelectInputObjectOptions option);
/// @brief Sends the ESC message (Escape)
/// @returns true if the message is being sent successfully
bool send_ESC();
/// @brief Sends the control audio signal command
/// @details This command may be used to control the audio on the VT.
/// When received this message shall terminate any audio in process from
/// the originating ECU and replace the previous command with the new command.
/// @param[in] activations Number of times to activate the signal
/// @param[in] frequency_hz The audio frequency to command in Hz
/// @param[in] duration_ms Duration of the signal activation
/// @param[in] offTimeDuration_ms The amount of silent time in the signal
/// @returns true if the message is being sent successfully
bool send_control_audio_signal(std::uint8_t activations, std::uint16_t frequency_hz, std::uint16_t duration_ms, std::uint16_t offTimeDuration_ms);
/// @brief Sends the set audio volume command
/// @details This command applies to subsequent Control Audio Signal commands.
/// VTs that are not able to modify the volume of the currently playing tone shall set
/// the Audio device is busy bit in the response.This command should not affect in any way
/// the volume settings of other Working Sets and shall not affect the volume of Alarm Masks.
/// @param[in] volume_percent The volume percentage to set the VT server to
/// @returns true if the message is being sent successfully
bool send_set_audio_volume(std::uint8_t volume_percent);
/// @brief Sends the change child location command
/// @details The Change Child Location command is used to change the position of an object. The new position is set
/// relative to the object's current position. Since the object can be included in many
/// parent objects, the parent Object ID is also included. If a parent object includes
/// the child object multiple times, then each instance will be moved.
/// The position attributes given in the message have an offset of -127, so
/// a value of 255 results in a +128 px move.
/// Positive values indicate a position change down or to the right. Negative values
/// indicate a position change up or to the left.
/// @param[in] objectID The ID of the target object
/// @param[in] parentObjectID The ID of the object's parent object
/// @param[in] relativeXPositionChange The amount to change the X position by (px)
/// @param[in] relativeYPositionChange The amount to change the Y position by (px)
/// @returns true if the message is being sent successfully
bool send_change_child_location(std::uint16_t objectID, std::uint16_t parentObjectID, std::uint8_t relativeXPositionChange, std::uint8_t relativeYPositionChange);
/// @brief Sends the change child position command
/// @details The new position is set relative to the parent object's position.
/// Since the object can be included in many parent objects, the parent Object ID
/// is also included.If a parent object includes the child object multiples times,
/// then each instance will be moved to the same location(the designer may want to
/// use Change Child Location command to move all instances in a relative motion).
/// When the object is moved, the parent object shall be refreshed.
/// The position attributes given in the message are signed integer.
/// Positive values indicate a position below(Y) or to the right of(X) the top left
/// corner of the parent object.Negative values indicate a position above(Y) or to the
/// left of(X) the top left corner of the parent object.
/// @param[in] objectID The ID of the target object
/// @param[in] parentObjectID The ID of the object's parent object
/// @param[in] xPosition The new X position of the object (px)
/// @param[in] yPosition The new Y position of the object (px)
/// @returns true if the message is being sent successfully
bool send_change_child_position(std::uint16_t objectID, std::uint16_t parentObjectID, std::uint16_t xPosition, std::uint16_t yPosition);
/// @brief Sends the change size command
/// @details A value of 0 for width or height or both
/// means that the object size is 0 and the object is not drawn.
/// @param[in] objectID The ID of the target object
/// @param[in] newWidth The new width of the object
/// @param[in] newHeight The new height of the object
/// @returns true if the message is being sent successfully
bool send_change_size_command(std::uint16_t objectID, std::uint16_t newWidth, std::uint16_t newHeight);
/// @brief Sends the change background colour command
/// @param[in] objectID The ID of the target object
/// @param[in] colour The new background colour of the object
/// @returns true if the message is being sent successfully
bool send_change_background_colour(std::uint16_t objectID, std::uint8_t colour);
/// @brief Sends the change numeric value command
/// @details The size of the object shall not be changed by this command. Only the object indicated in the
/// command is to be changed, variables referenced by the object are not changed.
/// @param[in] objectID The ID of the target object
/// @param[in] value The new numeric value of the object
/// @returns true if the message is being sent successfully
bool send_change_numeric_value(std::uint16_t objectID, std::uint32_t value);
/// @brief Sends the change string value command
/// @details The size of the object shall not be changed by this command. Only the object indicated in the
/// command is to be changed, variables referenced by the object are not changed.
/// The transferred string is allowed to be smaller than the length of the value attribute of the target object and in
/// this case the VT shall pad the value attribute with space characters.
/// @param[in] objectID The ID of the target object
/// @param[in] stringLength The length of the string to be sent
/// @param[in] value The string to be sent
/// @returns true if the message is being sent successfully
bool send_change_string_value(std::uint16_t objectID, uint16_t stringLength, const char *value);
/// @brief Sends the change string value command (with a c++ string instead of buffer + length)
/// @details The size of the object shall not be changed by this command. Only the object indicated in the
/// command is to be changed, variables referenced by the object are not changed.
/// The transferred string is allowed to be smaller than the length of the value attribute of the target object and in
/// this case the VT shall pad the value attribute with space characters.
/// @param[in] objectID The ID of the target object
/// @param[in] value The string to be sent
/// @returns true if the message is being sent successfully
bool send_change_string_value(std::uint16_t objectID, const std::string &value);
/// @brief Sends the change endpoint command, which changes the end of an output line
/// @param[in] objectID The ID of the target object
/// @param[in] width_px The width to change the output line to
/// @param[in] height_px The height to change the output line to
/// @param[in] direction The line direction (refer to output line object attributes)
/// @returns true if the message is being sent successfully
bool send_change_endpoint(std::uint16_t objectID, std::uint16_t width_px, std::uint16_t height_px, LineDirection direction);
/// @brief Sends the change font attributes command
/// @details This command is used to change the Font Attributes in a Font Attributes object.
/// @param[in] objectID The ID of the target object
/// @param[in] colour See the standard VT colour palette for more details
/// @param[in] size Font size
/// @param[in] type Font Type
/// @param[in] styleBitfield The font style encoded as a bitfield
/// @returns true if the message is being sent successfully
bool send_change_font_attributes(std::uint16_t objectID, std::uint8_t colour, FontSize size, std::uint8_t type, std::uint8_t styleBitfield);
/// @brief Sends the change line attributes command
/// @details This command is used to change the Line Attributes in a Line Attributes object.
/// @param[in] objectID The ID of the target object
/// @param[in] colour See the standard VT colour palette for more details
/// @param[in] width The line width
/// @param[in] lineArtBitmask The line art, encoded as a bitfield (See ISO11783-6 for details)
/// @returns true if the message is being sent successfully
bool send_change_line_attributes(std::uint16_t objectID, std::uint8_t colour, std::uint8_t width, std::uint16_t lineArtBitmask);
/// @brief Sends the change fill attributes command
/// @details This command is used to change the Fill Attributes in a Fill Attributes object.
/// @param[in] objectID The ID of the target object
/// @param[in] fillType The fill type
/// @param[in] colour See the standard VT colour palette for more details
/// @param[in] fillPatternObjectID Object ID to a fill pattern or NULL_OBJECT_ID
/// @returns true if the message is being sent successfully
bool send_change_fill_attributes(std::uint16_t objectID, FillType fillType, std::uint8_t colour, std::uint16_t fillPatternObjectID);
/// @brief Sends the change active mask command
/// @details This command is used to change the active mask of a Working Set
/// to either a Data Mask object or an Alarm Mask object.
/// @param[in] workingSetObjectID The ID of the working set
/// @param[in] newActiveMaskObjectID The object ID of the new active mask
/// @returns true if the message is being sent successfully
bool send_change_active_mask(std::uint16_t workingSetObjectID, std::uint16_t newActiveMaskObjectID);
/// @brief Sends the change softkey mask command
/// @details This command is used to change the Soft Key Mask associated with a
/// Data Mask object or an Alarm Mask object.
/// @param[in] type The mask type, alarm or data
/// @param[in] dataOrAlarmMaskObjectID The object ID of the target mask
/// @param[in] newSoftKeyMaskObjectID The object ID of the new softkey mask
/// @returns true if the message is being sent successfully
bool send_change_softkey_mask(MaskType type, std::uint16_t dataOrAlarmMaskObjectID, std::uint16_t newSoftKeyMaskObjectID);
/// @brief Sends the change attribute command
/// @details This command is used to change any attribute with an assigned Attribute ID.
/// This message cannot be used to change strings.
/// @param[in] objectID The ID of the target object
/// @param[in] attributeID The attribute ID of the attribute being changed
/// @param[in] value The new attribute value
/// @returns true if the message is being sent successfully
bool send_change_attribute(std::uint16_t objectID, std::uint8_t attributeID, std::uint32_t value);
/// @brief Sends the change attribute command (for float values)
/// @details This command is used to change a float attribute with an assigned Attribute ID.
/// This is most useful for changing output number scale factors.
/// @param[in] objectID The ID of the target object
/// @param[in] attributeID The attribute ID of the attribute being changed
/// @param[in] value The new attribute value
/// @returns true if the message is being sent successfully
bool send_change_attribute(std::uint16_t objectID, std::uint8_t attributeID, float value);
/// @brief Sends the change priority command
/// @details This command is used to change the priority of an Alarm Mask.
/// This command causes the VT to evaluate the priority of all active masks and
/// may cause a change to a different mask if the Alarm Mask being changed
/// should either become the active Working Set and mask,
/// or should no longer be the active Working Set and mask.
/// @param[in] alarmMaskObjectID The object ID of the target alarm mask
/// @param[in] priority The new priority for the mask
/// @returns true if the message is being sent successfully
bool send_change_priority(std::uint16_t alarmMaskObjectID, AlarmMaskPriority priority);
/// @brief Sends the change list item command
/// @details This command is used to change a list item in an Input List object,
/// Output List object, animation object, or external object definition object.
/// NULL_OBJECT_ID will result in the list item being removed, but will not change the index
/// order of the other list items.
/// @param[in] objectID The object ID of the list
/// @param[in] listIndex The index in the list to edit
/// @param[in] newObjectID The new object ID for the specified list index, or NULL_OBJECT_ID.
/// @returns true if the message is being sent successfully
bool send_change_list_item(std::uint16_t objectID, std::uint8_t listIndex, std::uint16_t newObjectID);
/// @brief Sends the lock unlock mask command
/// @details This command is used by a Working Set to disallow or allow
/// screen refreshes at the VT for the visible Data Mask or User Layout Data Mask
/// owned by the requesting Working Set.
/// This message would be used when a series of changes need to be synchronized or made visually atomic.
/// The mask may be unlocked if a a timeout occurs based on the timeout attribute of this message, or by
/// several other methods outlined in ISO11783-6, such as "proprietary reasons".
/// @param[in] state The target lock/unlock state
/// @param[in] objectID The object ID of the target mask
/// @param[in] timeout_ms The max time to lock the mask, or 0 for no timeout. Does not apply to unlock commands.
/// @returns true if the message is being sent successfully
bool send_lock_unlock_mask(MaskLockState state, std::uint16_t objectID, std::uint16_t timeout_ms);
/// @brief Sends the execute macro command
/// @details This command is used to execute a Macro.
/// @param[in] objectID The ID of the target object
/// @returns true if the message is being sent successfully
bool send_execute_macro(std::uint16_t objectID);
/// @brief Sends the change object label command
/// @details This command is used by an ECU to change a label of an object.
/// @param[in] objectID The ID of the target object
/// @param[in] labelStringObjectID The label's object ID
/// @param[in] fontType The font type or NULL_OBJECT_ID
/// @param[in] graphicalDesignatorObjectID Object ID of an object to be used as a graphic representation of the object label or NULL_OBJECT_ID
/// @returns true if the message is being sent successfully
bool send_change_object_label(std::uint16_t objectID, std::uint16_t labelStringObjectID, std::uint8_t fontType, std::uint16_t graphicalDesignatorObjectID);
/// @brief Sends change polygon point command
/// @details This command is used by a Working Set to modify a point in an Output Polygon object.
/// @param[in] objectID The ID of the target object
/// @param[in] pointIndex The index of the point in the polygon to edit
/// @param[in] newXValue The new X axis value (px)
/// @param[in] newYValue The new Y axis value (px)
/// @returns true if the message is being sent successfully
bool send_change_polygon_point(std::uint16_t objectID, std::uint8_t pointIndex, std::uint16_t newXValue, std::uint16_t newYValue);
/// @brief Sends the change polygon scale command
/// @details This command is used by a Working Set to change the scale of a complete Output Polygon object. This
/// message causes the value of the polygon points to be changed.
/// @param[in] objectID The ID of the target object
/// @param[in] widthAttribute New width attribute
/// @param[in] heightAttribute New height attribute
/// @returns true if the message is being sent successfully
bool send_change_polygon_scale(std::uint16_t objectID, std::uint16_t widthAttribute, std::uint16_t heightAttribute);
/// @brief Sends the select colour map or palette command
/// @param[in] objectID The object to select
/// @returns true if the message is being sent successfully
bool send_select_colour_map_or_palette(std::uint16_t objectID);
/// @brief Sends the execute extended macro command
/// @details Executes an extended macro
/// @param[in] objectID The object ID of the extended macro to execute
/// @returns true if the message is being sent successfully
bool send_execute_extended_macro(std::uint16_t objectID);
/// @brief Sends the select active working set command
/// @param[in] NAMEofWorkingSetMasterForDesiredWorkingSet The NAME of the target working set master
/// @returns true if the message is being sent successfully
bool send_select_active_working_set(std::uint64_t NAMEofWorkingSetMasterForDesiredWorkingSet);
// Graphics Context Commands:
/// @brief Sends the set graphics cursor command
/// @details This command sets the graphics cursor X/Y attributes of the object.
/// @param[in] objectID The ID of the target object
/// @param[in] xPosition The new X position (px)
/// @param[in] yPosition The new Y position (px)
/// @returns true if the message is being sent successfully
bool send_set_graphics_cursor(std::uint16_t objectID, std::int16_t xPosition, std::int16_t yPosition);
/// @brief Sends the move graphics cursor command
/// @details This command alters the graphics cursor x/y attributes of the object
/// by moving it relative to its current position.
/// @param[in] objectID The ID of the target object
/// @param[in] xOffset The new relative X offset of the cursor
/// @param[in] yOffset The new relative Y offset of the cursor
/// @returns true if the message was sent successfully
bool send_move_graphics_cursor(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset);
/// @brief Sends the set foreground colour command
/// @details This command modifies the foreground colour
/// attribute.The graphics cursor is not moved.
/// @param[in] objectID The ID of the target object
/// @param[in] colour See standard colour palette, 0-255
/// @returns true if the message is being sent successfully
bool send_set_foreground_colour(std::uint16_t objectID, std::uint8_t colour);
/// @brief Sends the set background colour command
/// @details This command modifies the background colour
/// attribute.The graphics cursor is not moved.
/// @param[in] objectID The ID of the target object
/// @param[in] colour See standard colour palette, 0-255
/// @returns true if the message is being sent successfully
bool send_set_background_colour(std::uint16_t objectID, std::uint8_t colour);
/// @brief Sends the set line attributes object id
/// @details This command modifies the Output Line object
/// attribute. All drawing commands that follow use the new attribute value.
/// For line suppression, set the Object ID to NULL.
/// The graphics cursor is not moved.
/// @param[in] objectID The ID of the target object
/// @param[in] lineAttributeobjectID The object ID of the line attribute
/// @returns true if the message is being sent successfully
bool send_set_line_attributes_object_id(std::uint16_t objectID, std::uint16_t lineAttributeobjectID);
/// @brief Sends the fill attributes object id
/// @details This command modifies the fill object attribute. All
/// drawing commands that follow use the new attribute value.
/// For no filling, set the Object ID to NULL. The
/// graphics cursor is not moved.
/// @param[in] objectID The ID of the target object
/// @param[in] fillAttributeobjectID The object ID of the fill attribute
/// @returns true if the message is being sent successfully
bool send_set_fill_attributes_object_id(std::uint16_t objectID, std::uint16_t fillAttributeobjectID);
/// @brief Sends the set fill attributes object ID command
/// @details This command modifies the font object attribute. All
/// drawing commands that follow use the new attribute value.
/// If text is not being used, the object can be set to NULL.
/// The graphics cursor is not moved.
/// @param[in] objectID The ID of the target object
/// @param[in] fontAttributesObjectID The object ID of the font attribute
/// @returns true if the message is being sent successfully
bool send_set_font_attributes_object_id(std::uint16_t objectID, std::uint16_t fontAttributesObjectID);
/// @brief Sends the erase rectangle command
/// @details Fills the rectangle at the graphics cursor using the
/// current background colour.For this command, the Fill Attributes Object is
/// not used regardless of the state of Options bit 1 The graphics cursor is
/// moved to the bottom right pixel inside of the rectangle.
/// @param[in] objectID The ID of the target object
/// @param[in] width The width of the rectangle
/// @param[in] height The height of the rectangle
/// @returns true if the message is being sent successfully
bool send_erase_rectangle(std::uint16_t objectID, std::uint16_t width, std::uint16_t height);
/// @brief Sends the draw point command
/// @details Sets the pixel to the foreground colour. The graphics
/// cursor is moved to the defined point.
/// @param[in] objectID The ID of the target object
/// @param[in] xOffset The pixel X offset relative to the cursor
/// @param[in] yOffset The pixel Y offset relative to the cursor
/// @returns true if the message is being sent successfully
bool send_draw_point(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset);
/// @brief Sends the draw line command
/// @details Draws a line from the graphics cursor to the specified
/// end pixel using the foreground colour. The Output Line
/// Object drawing rules apply with respect to the end
/// pixel location and Line Attributes.The graphics cursor
/// is moved to the specified end pixel.
/// @param[in] objectID The ID of the target object
/// @param[in] xOffset The pixel X offset relative to the cursor
/// @param[in] yOffset The pixel Y offset relative to the cursor
/// @returns true if the message is being sent successfully
bool send_draw_line(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset);
/// @brief Sends the draw rectangle command
/// @details Draws a rectangle at the graphics cursor. The
/// Rectangle Object drawing rules apply.If a Line
/// Attributes object is currently defined, the border is
/// drawn. If a fill attribute object is currently defined,
/// the rectangle is filled.The graphics cursor is moved to the
/// bottom right pixel inside of the rectangle.
/// @param[in] objectID The ID of the target object
/// @param[in] width The width of the rectangle (px)
/// @param[in] height The height of the rectangle (px)
/// @returns true if the message is being sent successfully
bool send_draw_rectangle(std::uint16_t objectID, std::uint16_t width, std::uint16_t height);
/// @brief Sends the draw closed ellipse message
/// @details Draws a closed ellipse bounded by the rectangle
/// defined by the current graphics cursor location and the
/// width and height given.The Output Ellipse object
/// drawing rules apply.If a Line Attributes object is currently defined,
/// the border is drawn.If a fill attribute object is currently defined,