9#ifndef ISOBUS_VIRTUAL_TERMINAL_CLIENT_HPP
10#define ISOBUS_VIRTUAL_TERMINAL_CLIENT_HPP
16#include "isobus/utility/event_dispatcher.hpp"
17#include "isobus/utility/processing_flags.hpp"
18#include "isobus/utility/thread_synchronization.hpp"
26#if !defined CAN_STACK_DISABLE_THREADS && !defined ARDUINO
49 SoftKeyActivationMessage = 0x00,
50 ButtonActivationMessage = 0x01,
51 PointingEventMessage = 0x02,
52 VTSelectInputObjectMessage = 0x03,
54 VTChangeNumericValueMessage = 0x05,
55 VTChangeActiveMaskMessage = 0x06,
56 VTChangeSoftKeyMaskMessage = 0x07,
57 VTChangeStringValueMessage = 0x08,
58 VTOnUserLayoutHideShowMessage = 0x09,
59 VTControlAudioSignalTerminationMessage = 0x0A,
60 ObjectPoolTransferMessage = 0x11,
61 EndOfObjectPoolMessage = 0x12,
62 AuxiliaryAssignmentTypeOneCommand = 0x20,
63 AuxiliaryInputTypeOneStatus = 0x21,
64 PreferredAssignmentCommand = 0x22,
65 AuxiliaryInputTypeTwoMaintenanceMessage = 0x23,
66 AuxiliaryAssignmentTypeTwoCommand = 0x24,
67 AuxiliaryInputStatusTypeTwoEnableCommand = 0x25,
68 AuxiliaryInputTypeTwoStatusMessage = 0x26,
69 AuxiliaryCapabilitiesRequest = 0x27,
70 SelectActiveWorkingSet = 0x90,
74 SelectInputObjectCommand = 0xA2,
75 ControlAudioSignalCommand = 0xA3,
76 SetAudioVolumeCommand = 0xA4,
77 ChangeChildLocationCommand = 0xA5,
78 ChangeSizeCommand = 0xA6,
79 ChangeBackgroundColourCommand = 0xA7,
80 ChangeNumericValueCommand = 0xA8,
81 ChangeEndPointCommand = 0xA9,
82 ChangeFontAttributesCommand = 0xAA,
83 ChangeLineAttributesCommand = 0xAB,
84 ChangeFillAttributesCommand = 0xAC,
85 ChangeActiveMaskCommand = 0xAD,
86 ChangeSoftKeyMaskCommand = 0xAE,
87 ChangeAttributeCommand = 0xAF,
88 ChangePriorityCommand = 0xB0,
89 ChangeListItemCommand = 0xB1,
90 DeleteObjectPoolCommand = 0xB2,
91 ChangeStringValueCommand = 0xB3,
92 ChangeChildPositionCommand = 0xB4,
93 ChangeObjectLabelCommand = 0xB5,
94 ChangePolygonPointCommand = 0xB6,
95 ChangePolygonScaleCommand = 0xB7,
96 GraphicsContextCommand = 0xB8,
97 GetAttributeValueMessage = 0xB9,
98 SelectColourMapCommand = 0xBA,
99 IdentifyVTMessage = 0xBB,
100 ExecuteExtendedMacroCommand = 0xBC,
101 LockUnlockMaskCommand = 0xBD,
102 ExecuteMacroCommand = 0xBE,
103 GetMemoryMessage = 0xC0,
104 GetSupportedWidecharsMessage = 0xC1,
105 GetNumberOfSoftKeysMessage = 0xC2,
106 GetTextFontDataMessage = 0xC3,
107 GetWindowMaskDataMessage = 0xC4,
108 GetSupportedObjectsMessage = 0xC5,
109 GetHardwareMessage = 0xC7,
110 StoreVersionCommand = 0xD0,
111 LoadVersionCommand = 0xD1,
112 DeleteVersionCommand = 0xD2,
113 ExtendedGetVersionsMessage = 0xD3,
114 ExtendedStoreVersionCommand = 0xD4,
115 ExtendedLoadVersionCommand = 0xD5,
116 ExtendedDeleteVersionCommand = 0xD6,
117 GetVersionsMessage = 0xDF,
118 GetVersionsResponse = 0xE0,
119 UnsupportedVTFunctionMessage = 0xFD,
120 VTStatusMessage = 0xFE,
121 WorkingSetMaintenanceMessage = 0xFF
378 VirtualTerminalClient(std::shared_ptr<PartneredControlFunction> partner, std::shared_ptr<InternalControlFunction> clientSource);
598 void update_auxiliary_input(
const std::uint16_t auxiliaryInputID,
const std::uint16_t value1,
const std::uint16_t value2,
const bool controlLocked =
false);
642 bool send_control_audio_signal(std::uint8_t activations, std::uint16_t frequency_hz, std::uint16_t duration_ms, std::uint16_t offTimeDuration_ms);
667 bool send_change_child_location(std::uint16_t objectID, std::uint16_t parentObjectID, std::uint8_t relativeXPositionChange, std::uint8_t relativeYPositionChange);
685 bool send_change_child_position(std::uint16_t objectID, std::uint16_t parentObjectID, std::uint16_t xPosition, std::uint16_t yPosition);
822 bool send_change_list_item(std::uint16_t objectID, std::uint8_t listIndex, std::uint16_t newObjectID);
850 bool send_change_object_label(std::uint16_t objectID, std::uint16_t labelStringObjectID, std::uint8_t fontType, std::uint16_t graphicalDesignatorObjectID);
859 bool send_change_polygon_point(std::uint16_t objectID, std::uint8_t pointIndex, std::uint16_t newXValue, std::uint16_t newYValue);
968 bool send_draw_point(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset);
980 bool send_draw_line(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset);
993 bool send_draw_rectangle(std::uint16_t objectID, std::uint16_t width, std::uint16_t height);
1028 bool send_draw_polygon(std::uint16_t objectID, std::uint8_t numberOfPoints,
const std::int16_t *listOfXOffsetsRelativeToCursor,
const std::int16_t *listOfYOffsetsRelativeToCursor);
1041 bool send_draw_text(std::uint16_t objectID,
bool transparent, std::uint8_t textLength,
const char *value);
1052 bool send_pan_viewport(std::uint16_t objectID, std::int16_t xAttribute, std::int16_t yAttribute);
1088 bool send_draw_vt_object(std::uint16_t graphicsContextObjectID, std::uint16_t VTObjectID);
1224 const std::uint8_t *pool,
1226 std::string version =
"");
1234 const std::vector<std::uint8_t> *pool,
1235 std::string version =
"");
1242 std::uint32_t originalDataMaskDimensions_px,
1243 std::uint32_t originalSoftKyeDesignatorHeight_px);
1475 static void process_flags(std::uint32_t flag,
void *parent);
1490 std::uint32_t dataLength,
1491 std::shared_ptr<InternalControlFunction> sourceControlFunction,
1492 std::shared_ptr<ControlFunction> destinationControlFunction,
1494 void *parentPointer);
1506 std::uint32_t bytesOffset,
1507 std::uint32_t numberOfBytesNeeded,
1508 std::uint8_t *chunkBuffer,
1509 void *parentPointer);
1571 bool send_command(
const std::vector<std::uint8_t> &data);
1577 bool queue_command(
const std::vector<std::uint8_t> &data,
bool replace =
false);
1638#if !defined CAN_STACK_DISABLE_THREADS && !defined ARDUINO
1675#if __cplusplus < 201402L
1680 struct hash<
isobus::VirtualTerminalClient::FontSize>
1687 return static_cast<size_t>(fontSize);
A representation of an ISOBUS ECU that we can send from. Use this class when defining your own contro...
A class that describes a control function on the bus that the stack should communicate with....
Similar to a data mask, but takes priority and will be shown over data masks.
CANPriority
Defines all the CAN frame priorities that can be encoded in a frame ID.
@ Priority5
Priority highest - 5.
A class that represents a generic CAN message of arbitrary length.
The Data Mask describes the objects that will appear in the Data Mask area of the physical display.
An interface for requesting and parsing the ISO11783 language command PGN, 0xFE0F.
A struct for storing information of a function assigned to an auxiliary input.
std::uint16_t inputObjectID
The object ID assigned on the auxiliary inputs end.
AssignedAuxiliaryFunction(std::uint16_t functionObjectID, std::uint16_t inputObjectID, AuxiliaryTypeTwoFunctionType functionType)
Constructs a AssignedAuxiliaryFunction, sets default values.
bool operator==(const AssignedAuxiliaryFunction &other) const
Allows easy comparison of two AssignedAuxiliaryFunction objects.
AuxiliaryTypeTwoFunctionType functionType
The type of function.
std::uint16_t functionObjectID
The object ID of the function present in our object pool.
An client interface for interacting with a virtual terminal (VT) server.
bool send_change_font_attributes(std::uint16_t objectID, std::uint8_t colour, FontSize size, std::uint8_t type, std::uint8_t styleBitfield)
Sends the change font attributes command.
bool send_extended_load_version(std::array< std::uint8_t, 32 > versionLabel) const
Sends the extended load version message.
HideShowObjectCommand
Enumerates the states that can be sent with a hide/show object command.
@ ShowObject
Shows an object.
@ HideObject
Hides the object.
EventDispatcher< VTUserLayoutHideShowEvent > & get_vt_user_layout_hide_show_event_dispatcher()
The event dispatcher for when a user-layout object is hidden or shown.
bool send_set_graphics_cursor(std::uint16_t objectID, std::int16_t xPosition, std::int16_t yPosition)
Sends the set graphics cursor command.
EventDispatcher< VTChangeActiveMaskEvent > changeActiveMaskEventDispatcher
A list of all change active mask callbacks.
bool get_support_pointing_device_with_pointing_message() const
Returns if the VT server supports a pointing device with pointing message.
bool send_pan_and_zoom_viewport(std::uint16_t objectID, std::int16_t xAttribute, std::int16_t yAttribute, float zoom)
Sends the pan and zoom viewport command.
bool send_change_polygon_scale(std::uint16_t objectID, std::uint16_t widthAttribute, std::uint16_t heightAttribute)
Sends the change polygon scale command.
bool get_support_drag_operation() const
Returns if the VT supports the drag operation.
void process_command_queue()
Tries to send all messages in the queue.
bool send_auxiliary_input_maintenance() const
Send the auxiliary control type 2 maintenance message.
static void process_standard_object_height_and_width(std::uint8_t *buffer, float scaleFactor)
Resizes the most common VT object format by some scale factor.
GraphicsContextSubCommandID
Enumerates the command types for graphics context objects.
@ SetLineAttributesObjectID
Sets the line attribute object ID.
@ SetBackgroundColour
Sets the background colour.
@ EraseRectangle
Erases a rectangle.
@ MoveGraphicsCursor
Moves the cursor relative to current location.
@ DrawPoint
Draws a point.
@ PanViewport
Pans viewport.
@ SetGraphicsCursor
Sets the graphics cursor x/y attributes.
@ SetForegroundColour
Sets the foreground colour.
@ PanAndZoomViewport
Pan and zooms the viewport.
@ DrawVTObject
Draws a VT object.
@ ZoomViewport
Zooms the viewport.
@ CopyViewportToPictureGraphic
Copies the viewport to picture graphic object.
@ ChangeViewportSize
Changes the viewport size.
@ CopyCanvasToPictureGraphic
Copies the canvas to picture graphic object.
@ SetFontAttributesObjectID
Sets the font attribute object ID.
@ SetFillAttributesObjectID
Sets the fill attribute object ID.
@ DrawClosedEllipse
Draws a closed ellipse.
@ DrawRectangle
Draws a rectangle.
@ DrawPolygon
Draws polygon.
std::uint8_t get_active_working_set_master_address() const
Returns the active working set master's address.
bool commandAwaitingResponse
Determines if we are currently waiting for a response to a command.
bool get_support_intermediate_coordinates_during_drag_operations() const
Returns if the VT supports the intermediate coordinates during a drag operation.
bool send_set_font_attributes_object_id(std::uint16_t objectID, std::uint16_t fontAttributesObjectID)
Sends the set fill attributes object ID command.
std::uint8_t connectedVTVersion
The VT server's supported max version.
CurrentObjectPoolUploadState currentObjectPoolState
The current upload state of the object pool being processed.
std::shared_ptr< PartneredControlFunction > get_partner_control_function() const
Returns the control function of the VT server with which this VT client communicates.
void initialize(bool spawnThread)
This function starts the state machine. Call this once you have supplied 1 or more object pool and ar...
std::vector< ObjectPoolDataStruct > objectPools
A container to hold all object pools that have been assigned to the interface.
EventDispatcher< AuxiliaryFunctionEvent > & get_auxiliary_function_event_dispatcher()
The event dispatcher for for when a change in auxiliary input for a function is received.
EventDispatcher< VTChangeStringValueEvent > changeStringValueEventDispatcher
A list of all change string value callbacks.
bool send_store_version(std::array< std::uint8_t, 7 > versionLabel) const
Sends the store version message.
bool send_set_foreground_colour(std::uint16_t objectID, std::uint8_t colour)
Sends the set foreground colour command.
std::uint8_t currentCommandFunctionCode
The VT server's current command function code.
MaskType
The types of object pool masks.
std::uint16_t yPixels
The y pixel dimension as reported by the VT server.
EventDispatcher< VTKeyEvent > softKeyEventDispatcher
A list of all soft key event callbacks.
LanguageCommandInterface languageCommandInterface
Used to determine the language and unit systems in use by the VT server.
bool send_change_child_position(std::uint16_t objectID, std::uint16_t parentObjectID, std::uint16_t xPosition, std::uint16_t yPosition)
Sends the change child position command.
EventDispatcher< VTESCMessageEvent > & get_vt_esc_message_event_dispatcher()
The event dispatcher for when an ESC message is received, e.g. an open object input is closed.
bool send_change_polygon_point(std::uint16_t objectID, std::uint8_t pointIndex, std::uint16_t newXValue, std::uint16_t newYValue)
Sends change polygon point command.
bool replace_command(const std::vector< std::uint8_t > &data)
Replaces the first message in the queue with the same function-code and priority, and removes the res...
Mutex commandQueueMutex
A mutex to protect the command queue.
void set_auxiliary_input_model_identification_code(std::uint16_t modelIdentificationCode)
Set the model identification code of our auxiliary input device.
bool send_select_active_working_set(std::uint64_t NAMEofWorkingSetMasterForDesiredWorkingSet)
Sends the select active working set command.
VirtualTerminalClient(VirtualTerminalClient &)=delete
Deleted copy constructor for VirtualTerminalClient.
bool send_get_supported_widechars() const
Sends the get supported widechars message.
EventDispatcher< VTPointingEvent > pointingEventDispatcher
A list of all pointing event callbacks.
bool send_draw_point(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset)
Sends the draw point command.
static std::uint32_t get_minimum_object_length(VirtualTerminalObjectType type)
Returns the minimum length that the specified object could possibly require in bytes.
EventDispatcher< VTChangeNumericValueEvent > changeNumericValueEventDispatcher
A list of all change numeric value callbacks.
bool send_get_supported_objects() const
Sends the get supported objects message.
bool send_enable_disable_object(std::uint16_t objectID, EnableDisableObjectCommand command)
Sends an enable/disable object command.
void worker_thread_function()
The worker thread will execute this function when it runs, if applicable.
FontType
Enumerates the different font types.
@ ProprietaryBegin
The beginning of the proprietary range.
@ ReservedEnd
Reserved from ISO8859_7 to this value.
@ ProprietaryEnd
The end of the proprietary region.
void set_object_pool(std::uint8_t poolIndex, const std::uint8_t *pool, std::uint32_t size, std::string version="")
Assigns an object pool to the client using a buffer and size.
GraphicMode supportedGraphicsMode
The graphics mode reported by the VT server.
StateMachineState
The internal state machine state of the VT client, mostly just public so tests can access it.
@ SendLoadVersion
Sending the load version command.
@ WaitForEndOfObjectPoolResponse
Client is waiting for the end of object pool response message.
@ WaitForGetNumberSoftKeysResponse
Client is waiting for a response to the "get number of soft keys" message.
@ WaitForGetVersionsResponse
Client is waiting for a response to the "get versions" message.
@ SendEndOfObjectPool
Client is sending the end of object pool message.
@ Connected
Client is connected to the VT server and the application layer is in control.
@ SendGetVersions
If a version label was specified, check to see if the VT has that version already.
@ SendGetTextFontData
Client is sending the "get text font data" message.
@ SendGetMemory
Client is sending the "get memory" message to see if VT has enough memory available.
@ SendGetHardware
Client is sending the "get hardware" message.
@ SendWorkingSetMasterMessage
Client is sending the working state master message.
@ WaitForGetMemoryResponse
Client is waiting for a response to the "get memory" message.
@ UploadObjectPool
Client is uploading the object pool.
@ SendGetNumberSoftkeys
Client is sending the "get number of soft keys" message.
@ WaitForStoreVersionResponse
Client is waiting for a response to the store version command.
@ ReadyForObjectPool
Client needs an object pool before connection can continue.
@ WaitForGetHardwareResponse
Client is waiting for a response to the "get hardware" message.
@ WaitForLoadVersionResponse
Client is waiting for the VT to respond to the "Load Version" command.
@ SendStoreVersion
Sending the store version command.
@ WaitForGetTextFontDataResponse
Client is waiting for a response to the "get text font data" message.
@ Failed
Client could not connect to the VT due to an error.
@ 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.
std::uint32_t lastVTStatusTimestamp_ms
The timestamp of the last VT status message.
std::uint8_t smallFontSizesBitfield
The small font sizes supported by the VT server.
bool send_select_colour_map_or_palette(std::uint16_t objectID)
Sends the select colour map or palette command.
std::uint16_t get_visible_soft_key_mask() const
Returns the current soft key mask displayed by the VT server.
std::uint16_t get_number_x_pixels() const
Returns the number of x pixels in the data mask area.
bool send_change_object_label(std::uint16_t objectID, std::uint16_t labelStringObjectID, std::uint8_t fontType, std::uint16_t graphicalDesignatorObjectID)
Sends the change object label command.
bool send_extended_get_versions() const
Sends the get extended versions message.
bool get_support_touchscreen_with_pointing_message() const
Returns if the VT server supports a touchscreen with pointing message.
std::uint8_t softKeyYAxisPixels
The size of a soft key Y dimension as reported by the VT server.
static void process_flags(std::uint32_t flag, void *parent)
Processes the internal Tx flags.
bool send_change_list_item(std::uint16_t objectID, std::uint8_t listIndex, std::uint16_t newObjectID)
Sends the change list item command.
AlarmMaskPriority
The allowable priorities of an alarm mask.
@ Low
Overrides data masks.
@ High
Overrides lower priority alarm masks.
@ Medium
Overrides low priority alarm masks.
EventDispatcher< VTKeyEvent > buttonEventDispatcher
A list of all button event callbacks.
bool send_zoom_viewport(std::uint16_t objectID, float zoom)
Sends the zoom viewport command.
bool is_function_unsupported(Function function) const
Extract from the cache whether a VT does not support a specific function.
bool send_set_audio_volume(std::uint8_t volume_percent)
Sends the set audio volume command.
void update_auxiliary_input(const std::uint16_t auxiliaryInputID, const std::uint16_t value1, const std::uint16_t value2, const bool controlLocked=false)
Update the state of an auxiliary input. This should be called when the value of an auxiliary input ch...
bool send_change_string_value(std::uint16_t objectID, uint16_t stringLength, const char *value)
Sends the change string value command.
EventDispatcher< VTESCMessageEvent > escMessageEventDispatcher
A list of all ESC event callbacks.
bool send_execute_extended_macro(std::uint16_t objectID)
Sends the execute extended macro command.
std::uint16_t get_number_y_pixels() const
Returns the number of y pixels in the data mask area.
VirtualTerminalClient(std::shared_ptr< PartneredControlFunction > partner, std::shared_ptr< InternalControlFunction > clientSource)
The constructor for a VirtualTerminalClient.
std::uint8_t activeWorkingSetMasterAddress
The active working set master address.
LineDirection
Enumerates the different line directions that can be used when changing an endpoint of an object.
@ TopLeftToBottomRightOfEnclosingVirtualRectangle
Draws the line from top left to bottom right of the enclosing virtual rectangle.
@ BottomLeftToTopRightOfEnclosingVirtualRectangle
Draws the line from bottom left to top right of the enclosing virtual rectangle.
bool get_auxiliary_input_learn_mode_enabled() const
Get whether the VT has enabled the learn mode for the auxiliary input.
bool is_vt_version_supported(VTVersion value) const
Returns whether the VT version is supported by the VT server.
FontStyleBits
Enumerates the font style options that can be encoded in a font style bitfield.
@ Italic
Italic font style.
@ CrossedOut
Crossed-out font style (strikethrough)
@ Flashing
Flashing font style.
@ ProportionalFontRendering
Enables proportional font rendering if supported by the server.
@ Inverted
Inverted font style (upside down)
@ FlashingHidden
Flashing between hidden and shown font style.
@ Underlined
Underlined font style.
std::uint16_t xPixels
The x pixel dimension as reported by the VT server.
std::uint8_t get_number_virtual_softkeys() const
Returns the number of virtual softkeys reported by the VT server.
KeyActivationCode
The different key activation codes that a button press can generate.
@ ButtonPressedOrLatched
Button is pressed.
@ ButtonPressAborted
Press was aborted (user navigated away from the button and did not release it)
@ ButtonStillHeld
Button is being held down (sent cyclically)
@ ButtonUnlatchedOrReleased
Button is released.
std::uint16_t activeWorkingSetDataMaskObjectID
The active working set data mask object ID.
bool send_copy_viewport_to_picture_graphic(std::uint16_t graphicsContextObjectID, std::uint16_t objectID)
Sends the copy viewport to picture graphic command.
bool firstTimeInState
Stores if the current update cycle is the first time a state machine state has been processed.
static FontSize remap_font_to_scale(FontSize originalFont, float scaleFactor)
Remaps a font to some other font based on a scale factor This is not a one-size-fits-all solution,...
GraphicMode
Enumerates the various VT server graphics modes.
@ SixteenColour
16 Colour mode (4 bit)
@ TwoHundredFiftySixColour
256 Colour mode (8 bit)
@ Monochrome
Monochromatic graphics mode (1 bit)
std::uint16_t activeWorkingSetSoftKeyMaskObjectID
The active working set's softkey mask object ID.
bool get_support_simultaneous_activation_buttons_and_softkeys() const
Returns if the VT server supports simultaneous activation of buttons and softkeys.
bool send_change_fill_attributes(std::uint16_t objectID, FillType fillType, std::uint8_t colour, std::uint16_t fillPatternObjectID)
Sends the change fill attributes command.
std::uint8_t softKeyXAxisPixels
The size of a soft key X dimension as reported by the VT server.
void set_object_pool_scaling(std::uint8_t poolIndex, std::uint32_t originalDataMaskDimensions_px, std::uint32_t originalSoftKyeDesignatorHeight_px)
Configures an object pool to be automatically scaled to match the target VT server.
bool send_get_memory(std::uint32_t requiredMemory) const
Sends the get memory message.
std::vector< std::vector< std::uint8_t > > commandQueue
A queue of commands to send to the VT server.
static bool process_internal_object_pool_upload_callback(std::uint32_t callbackIndex, std::uint32_t bytesOffset, std::uint32_t numberOfBytesNeeded, std::uint8_t *chunkBuffer, void *parentPointer)
The data callback passed to the network manger's send function for the transport layer messages.
bool send_hide_show_object(std::uint16_t objectID, HideShowObjectCommand command)
Sends a hide/show object command.
bool send_pan_viewport(std::uint16_t objectID, std::int16_t xAttribute, std::int16_t yAttribute)
Sends the pan viewport command.
bool send_change_size_command(std::uint16_t objectID, std::uint16_t newWidth, std::uint16_t newHeight)
Sends the change size command.
std::uint16_t ourModelIdentificationCode
The model identification code of this input device.
bool send_change_softkey_mask(MaskType type, std::uint16_t dataOrAlarmMaskObjectID, std::uint16_t newSoftKeyMaskObjectID)
Sends the change softkey mask command.
std::uint32_t lastCommandTimestamp_ms
The timestamp of the last command sent.
void add_auxiliary_input_object_id(const std::uint16_t auxiliaryInputID)
Add a new auxiliary input to be managed by this virtual terminal object.
bool send_change_viewport_size(std::uint16_t objectID, std::uint16_t width, std::uint16_t height)
Sends the change viewport size command.
bool get_is_connected() const
Check whether the client is connected to the VT server.
std::uint16_t get_visible_data_mask() const
Returns the current data mask displayed by the VT server.
EventDispatcher< VTKeyEvent > & get_vt_soft_key_event_dispatcher()
The event dispatcher for when a soft key is pressed or released.
CurrentObjectPoolUploadState
The different states of an object pool upload process.
@ InProgress
The object pool upload is in progress.
@ Success
The object pool was uploaded.
@ Uninitialized
The object pool upload has not been started.
static void process_callback(std::uint32_t parameterGroupNumber, std::uint32_t dataLength, std::shared_ptr< InternalControlFunction > sourceControlFunction, std::shared_ptr< ControlFunction > destinationControlFunction, bool successful, void *parentPointer)
The callback passed to the network manager's send function to know when a Tx is completed.
bool send_change_priority(std::uint16_t alarmMaskObjectID, AlarmMaskPriority priority)
Sends the change priority command.
EventDispatcher< VTAudioSignalTerminationEvent > audioSignalTerminationEventDispatcher
A list of all control audio signal termination callbacks.
MacroEventID
Enumerates the different events that can be associated with a macro.
@ OnChangeSize
Event on change of an object size.
@ OnShow
Event on an object being shown.
@ OnChangeAttribute
Event on change of an attribute value.
@ OnHide
Event on an object being hidden.
@ OnChangeValue
Event on change of an object value (like via change numeric value)
@ OnChangePriority
Event on change of a mask's priority.
@ OnESC
Event on ESC (escape)
@ OnKeyPress
Event on the press of a key.
@ OnDisable
Event on disabling an object.
@ OnPointingEventRelease
Event on a pointing event release.
@ ReservedBegin
Beginning of the reserved range.
@ OnChangeSoftKeyMask
Event on change of the soft key mask.
@ OnChangeLineAttributes
Event on change of a line attribute.
@ OnChangeBackgroundColour
Event on change of a background colour.
@ OnInputFieldDeselection
Event on deselection of an input field.
@ OnChangeChildLocation
Event on change of a child objects location.
@ OnEntryOfValue
Event on entry of a value.
@ OnActivate
Event on activation of an object (such as for data input)
@ OnEnable
Event on enable of an object.
@ OnDeactivate
Event on deactivation of an object.
@ OnChangeEndPoint
Event on change of an object endpoint.
@ OnPointingEventPress
Event on a pointing event press.
@ OnInputFieldSelection
Event when an input field is selected.
@ UseExtendedMacroReference
Use extended macro reference.
@ OnKeyRelease
Event on the release of a key.
@ OnChangeFontAttributes
Event on change of a font attribute.
@ OnEntryOfNewValue
Event on entry of a new value.
@ OnChangeFillAttributes
Event on change of a fill attribute.
@ OnChangeActiveMask
Event on changing the active mask.
@ OnChangeChildPosition
Event on changing a child object's position.
FontSize
Enumerates the different font sizes.
@ Size64x96
64x96 Font size
@ Size16x24
16x24 Font size
@ Size16x16
16x16 Font size
@ Size48x64
48x64 Font size
@ Size64x64
64x64 Font size
@ Size24x32
24x32 Font size
@ Size32x48
32x48 Font size
@ Size128x128
128x128 Font size
@ Size96x128
96x128 Font size
@ Size32x32
32x32 Font size
@ Size128x192
128x192 Font size
@ Size12x16
12x16 Font size
bool get_is_initialized() const
Returns if the client has been initialized.
bool send_lock_unlock_mask(MaskLockState state, std::uint16_t objectID, std::uint16_t timeout_ms)
Sends the lock unlock mask command.
EventDispatcher< VTChangeSoftKeyMaskEvent > changeSoftKeyMaskEventDispatcher
A list of all change soft key mask callbacks.
static constexpr std::uint32_t AUXILIARY_MAINTENANCE_TIMEOUT_MS
The delay between auxiliary maintenance messages.
VTVersion get_connected_vt_version() const
Returns the VT version supported supported by the VT server.
static std::uint32_t get_number_bytes_in_object(std::uint8_t *buffer)
Returns the total number of bytes in the VT object located at the specified memory location.
EventDispatcher< VTUserLayoutHideShowEvent > userLayoutHideShowEventDispatcher
A list of all user layout hide/show callbacks.
std::map< std::uint16_t, AuxiliaryInputState > ourAuxiliaryInputs
The inputs on this auxiliary input device.
bool send_auxiliary_functions_preferred_assignment() const
Send the preferred auxiliary control type 2 assignment command.
bool send_load_version(std::array< std::uint8_t, 7 > versionLabel) const
Sends the load version message.
void update()
Periodic Update Function (worker thread may call this)
bool send_execute_macro(std::uint16_t objectID)
Sends the execute macro command.
static bool get_is_object_scalable(VirtualTerminalObjectType type)
Returns if the specified object type can be scaled.
EventDispatcher< VTChangeStringValueEvent > & get_vt_change_string_value_event_dispatcher()
The event dispatcher for when a string value is changed.
EventDispatcher< VTPointingEvent > & get_vt_pointing_event_dispatcher()
The event dispatcher for when a pointing event is "pressed or released".
std::shared_ptr< InternalControlFunction > myControlFunction
The internal control function the client uses to send from.
void remove_auxiliary_input_object_id(const std::uint16_t auxiliaryInputID)
Remove an auxiliary input from the pool of managed auxiliary inputs.
bool resize_object(std::uint8_t *buffer, float scaleFactor, VirtualTerminalObjectType type)
Resizes a single VT object by some scale factor.
std::uint32_t lastWorkingSetMaintenanceTimestamp_ms
The timestamp from the last time we sent the maintenance message.
std::uint8_t busyCodesBitfield
The VT server's busy codes.
TransmitFlags
Flags used as a retry mechanism for sending important messages.
@ SendWorkingSetMaintenance
Flag to send the working set maintenenace message.
@ NumberFlags
The number of flags in this enum.
@ SendAuxiliaryMaintenance
Flag to send the auxiliary maintenance message.
bool send_draw_closed_ellipse(std::uint16_t objectID, std::uint16_t width, std::uint16_t height)
Sends the draw closed ellipse message.
EventDispatcher< VTAudioSignalTerminationEvent > & get_vt_control_audio_signal_termination_event_dispatcher()
The event dispatcher for when an audio signal is terminated.
Function
Enumerates the multiplexor byte values for VT commands.
bool queue_command(const std::vector< std::uint8_t > &data, bool replace=false)
Tries to send a command to the VT server, and queues it if it fails.
bool send_get_attribute_value(std::uint16_t objectID, std::uint8_t attributeID)
Sends the get attribute value message.
bool send_end_of_object_pool() const
Sends the end of object pool message.
bool get_any_pool_needs_scaling() const
Returns if any object pool had scaling configured.
EventDispatcher< AuxiliaryFunctionEvent > auxiliaryFunctionEventDispatcher
A list of all auxiliary function callbacks.
bool get_has_adjustable_volume_output() const
Returns if the VT server supports adjustable volume output.
bool sendWorkingSetMaintenance
Used internally to enable and disable cyclic sending of the working set maintenance message.
FillType
Enumerates the different fill types for an object.
@ FillWithLineColour
Fill with the colour of the outline of the shape.
@ FillWithPatternGivenByFillPatternAttribute
Fill with a patter provided by a fill pattern attribute.
@ FillWithSpecifiedColourInFillColourAttribute
Fill with the colour specified by a fill attribute.
@ NoFill
No fill will be applied.
bool send_draw_polygon(std::uint16_t objectID, std::uint8_t numberOfPoints, const std::int16_t *listOfXOffsetsRelativeToCursor, const std::int16_t *listOfYOffsetsRelativeToCursor)
Sends the draw polygon command.
static constexpr std::uint64_t AUXILIARY_INPUT_STATUS_DELAY
The delay between the auxiliary input status messages, in milliseconds.
bool send_ESC()
Sends the ESC message (Escape)
void update_auxiliary_input_status()
Send the auxiliary control type 2 status message for all inputs if applicable.
bool send_draw_text(std::uint16_t objectID, bool transparent, std::uint8_t textLength, const char *value)
Sends the draw text command.
bool shouldTerminate
Used to determine if the client should exit and join the worker thread.
bool send_change_line_attributes(std::uint16_t objectID, std::uint8_t colour, std::uint8_t width, std::uint16_t lineArtBitmask)
Sends the change line attributes command.
void register_object_pool_data_chunk_callback(std::uint8_t poolIndex, std::uint32_t poolTotalSize, DataChunkCallback value, std::string version="")
Assigns an object pool to the client where the client will get data in chunks during upload.
AuxiliaryTypeTwoFunctionType
Enumerates the various auxiliary input function types.
@ BidirectionalEncoder
Count increases when turning in the encoders "increase" direction, and decreases when turning in the ...
@ AnalogueMomentaryOneWay
One-way analogue (returns to 0%)
@ DualBooleanLatching
Three-position switch (maintains position) (Single Pole, Three Positions, Centre Off)
@ BooleanMomentary
Two-position switch (returns to off) (Momentary Single Pole, Single Throw)
@ DualBooleanLatchingDownpOnly
Three-position switch (maintains position only in down position) (Momentary Single Pole,...
@ QuadratureBooleanMomentary
Two Quadrature mounted Three-position switches (returns to centre position) (Momentary Single Pole,...
@ AnalogueLatching
Two-way analogue (Maintains position setting)
@ DualBooleanMomentary
Three-position switch (returns to off/centre position) (Momentary Single Pole, Three Positions,...
@ ReservedRemoveAssignment
Used for Remove assignment command.
@ AnalogueMomentaryBooleanLatching
two-way analogue (returns to centre position) with latching Boolean at 0% and 100% positions
@ AnalogueLatchingBooleanLatching
two-way analogue (maintains position setting) with momentary Boolean at 0% and 100% positions
@ DualBooleanLatchingUpOnly
Three-position switch (maintains position only in up position) (Single Pole, Three Positions,...
@ BooleanLatching
Two-position switch (maintains position) (Single Pole, Double Throw)
@ QuadratureAnalogueMomentary
Two Quadrature mounted Two-way analogue (returns to centre position - 50%)
@ QuadratureAnalogueLatching
Two Quadrature mounted Two-way analogue (maintains position)
@ AnalogueMomentaryTwoWay
Two-way analogue (returns to centre position - 50%)
bool get_font_size_supported(FontSize value) const
Returns if the selected font is supported.
std::uint8_t numberVirtualSoftkeysPerSoftkeyMask
The number of virtual softkeys per softkey mask as reported by the VT server.
std::uint8_t hardwareFeaturesBitfield
The reported hardware features from the VT server.
bool send_extended_store_version(std::array< std::uint8_t, 32 > versionLabel) const
Sends the extended store version message.
ESCMessageErrorCode
Enumerates the errors that can be present in an ESC message.
@ NoInputFieldOpen
No input field is open.
@ OtherError
Error is not one of the above.
@ NoError
No error occurred.
bool get_multiple_frequency_audio_output() const
Returns if the VT server supports multiple frequency audio output.
bool get_font_style_supported(FontStyleBits value) const
Returns if the selected font style is supported.
void restart_communication()
Halts communication with the VT gracefully and restarts it.
EventDispatcher< VTChangeNumericValueEvent > & get_vt_change_numeric_value_event_dispatcher()
The event dispatcher for when a numeric value is changed in an input object.
bool send_move_graphics_cursor(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset)
Sends the move graphics cursor command.
std::vector< std::uint8_t > unsupportedFunctions
Holds the functions unsupported by the server.
bool send_set_line_attributes_object_id(std::uint16_t objectID, std::uint16_t lineAttributeobjectID)
Sends the set line attributes object id.
void set_state(StateMachineState value)
Sets the state machine state and updates the associated timestamp.
bool send_set_background_colour(std::uint16_t objectID, std::uint8_t colour)
Sends the set background colour command.
static constexpr std::uint32_t WORKING_SET_MAINTENANCE_TIMEOUT_MS
The delay between working set maintenance messages.
bool send_change_endpoint(std::uint16_t objectID, std::uint16_t width_px, std::uint16_t height_px, LineDirection direction)
Sends the change endpoint command, which changes the end of an output line.
bool send_delete_object_pool() const
Sends the delete object pool message.
bool send_command(const std::vector< std::uint8_t > &data)
Sends a command to the VT server.
bool send_draw_vt_object(std::uint16_t graphicsContextObjectID, std::uint16_t VTObjectID)
Sends the draw VT object command.
GraphicMode get_graphic_mode() const
Returns the graphics mode supported by the VT server.
StateMachineState state
The current client state machine state.
std::uint8_t numberPhysicalSoftkeys
The number of physical softkeys supported by the VT server.
DataChunkCallback objectPoolDataCallback
The callback to use to get pool data.
ProcessingFlags txFlags
A retry mechanism for internal Tx messages.
EventDispatcher< VTChangeActiveMaskEvent > & get_vt_change_active_mask_event_dispatcher()
The event dispatcher for when the active mask is changed.
std::vector< AssignedAuxiliaryInputDevice > assignedAuxiliaryInputDevices
A container to hold all auxiliary input devices known.
bool send_change_numeric_value(std::uint16_t objectID, std::uint32_t value)
Sends the change numeric value command.
SelectInputObjectOptions
Enumerates the states that can be sent with a select input object options command.
@ SetFocusToObject
Focuses the object (usually this draws a temporary box around it)
@ ActivateObjectForDataInput
Activates an object for data input.
bool sendAuxiliaryMaintenance
Used internally to enable and disable cyclic sending of the auxiliary maintenance message.
bool send_change_background_colour(std::uint16_t objectID, std::uint8_t colour)
Sends the change background colour command.
FontSize get_font_or_next_smallest_font(FontSize originalFont) const
Returns the closest font to the one you passed in, in decending order.
bool send_select_input_object(std::uint16_t objectID, SelectInputObjectOptions option)
Sends a select input object command.
EventDispatcher< VTKeyEvent > & get_vt_button_event_dispatcher()
The event dispatcher for when a button is pressed or released.
bool send_draw_rectangle(std::uint16_t objectID, std::uint16_t width, std::uint16_t height)
Sends the draw rectangle command.
bool send_auxiliary_function_assignment_response(std::uint16_t functionObjectID, bool hasError, bool isAlreadyAssigned) const
Send the auxiliary control type 2 assignment reponse message.
bool send_get_number_of_softkeys() const
Sends the get number of softkeys message.
std::thread * workerThread
The worker thread that updates this interface.
MaskLockState
Denotes the lock/unlock state of a mask. Used to freeze/unfreeze rendering of a mask.
@ LockMask
Locks the mask so rendering of it is not updated until it is unlocked or a timeout occurs.
@ UnlockMask
Renders the mask normally.
std::shared_ptr< InternalControlFunction > get_internal_control_function() const
Returns the internal control function being used by the client.
bool scale_object_pools()
Iterates through each object pool and scales each object in the pool automatically.
bool send_set_fill_attributes_object_id(std::uint16_t objectID, std::uint16_t fillAttributeobjectID)
Sends the fill attributes object id.
void terminate()
Terminates the client and joins the worker thread if applicable.
bool send_get_window_mask_data() const
Sends the get window mask data message.
bool send_get_text_font_data() const
Sends the get text font data message.
std::uint8_t get_softkey_y_axis_pixels() const
Returns the number of Y axis pixels in a softkey.
bool send_draw_line(std::uint16_t objectID, std::int16_t xOffset, std::int16_t yOffset)
Sends the draw line command.
bool send_copy_canvas_to_picture_graphic(std::uint16_t graphicsContextObjectID, std::uint16_t objectID)
Sends the copy canvas to picture graphic command.
bool send_extended_delete_version(std::array< std::uint8_t, 32 > versionLabel) const
Sends the extended delete version message.
std::uint8_t get_number_physical_softkeys() const
Returns the number of physical softkeys reported by the VT server.
std::uint32_t stateMachineTimestamp_ms
Timestamp from the last state machine update.
std::shared_ptr< PartneredControlFunction > partnerControlFunction
The partner control function this client will send to.
bool initialized
Stores the client initialization state.
bool send_erase_rectangle(std::uint16_t objectID, std::uint16_t width, std::uint16_t height)
Sends the erase rectangle command.
static void process_rx_message(const CANMessage &message, void *parentPointer)
Processes a CAN message destined for any VT client.
static constexpr std::uint32_t VT_STATUS_TIMEOUT_MS
The max allowable time between VT status messages before its considered offline.
bool send_change_child_location(std::uint16_t objectID, std::uint16_t parentObjectID, std::uint8_t relativeXPositionChange, std::uint8_t relativeYPositionChange)
Sends the change child location command.
std::uint8_t get_softkey_x_axis_pixels() const
Returns the number of X axis pixels in a softkey.
std::uint32_t lastAuxiliaryMaintenanceTimestamp_ms
The timestamp from the last time we sent the maintenance message.
std::uint32_t lastObjectPoolIndex
The last object pool index that was processed.
std::uint8_t fontStylesBitfield
The text font capabilities supported by the VT server.
bool send_delete_version(std::array< std::uint8_t, 7 > versionLabel) const
Sends the delete version message.
EventDispatcher< VTSelectInputObjectEvent > & get_vt_select_input_object_event_dispatcher()
The event dispatcher for when an input object event is triggered.
EventDispatcher< VTSelectInputObjectEvent > selectInputObjectEventDispatcher
A list of all select input object callbacks.
bool send_get_versions() const
Sends the get versions message.
bool send_change_active_mask(std::uint16_t workingSetObjectID, std::uint16_t newActiveMaskObjectID)
Sends the change active mask command.
static constexpr std::uint64_t AUXILIARY_INPUT_STATUS_DELAY_INTERACTION
The delay between the auxiliary input status messages when the input is interacted with,...
EventDispatcher< VTChangeSoftKeyMaskEvent > & get_vt_change_soft_key_mask_event_dispatcher()
The event dispatcher for when the soft key mask is changed.
bool send_get_hardware() const
Sends the get hardware message.
VTVersion
The different VT versions that a client or server might support.
@ 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.
@ Version2OrOlder
Client or server supports VT version 2 or lower.
@ ReservedOrUnknown
Reserved value, not to be used.
@ Version6
Client or server supports all of VT version 6.
bool get_support_simultaneous_activation_physical_keys() const
Returns if the VT server supports simultaneous activation of physical keys.
bool send_auxiliary_input_status_enable_response(std::uint16_t objectID, bool isEnabled, bool hasError) const
Send the auxiliary input status type 2 enable response.
std::uint8_t largeFontSizesBitfield
The large font sizes supported by the VT server.
bool send_working_set_maintenance(bool initializing) const
Sends the working set maintenance message.
bool send_control_audio_signal(std::uint8_t activations, std::uint16_t frequency_hz, std::uint16_t duration_ms, std::uint16_t offTimeDuration_ms)
Sends the control audio signal command.
bool send_working_set_master() const
Sends the working set master message.
bool send_change_attribute(std::uint16_t objectID, std::uint8_t attributeID, std::uint32_t value)
Sends the change attribute command.
bool send_message_to_vt(const std::uint8_t *dataBuffer, std::uint32_t dataLength, CANIdentifier::CANPriority priority=CANIdentifier::CANPriority::Priority5) const
Sends a message to the VT server.
~VirtualTerminalClient()
The destructor for the VirtualTerminalClient.
EnableDisableObjectCommand
Enumerates the states that can be sent with an enable/disable object command.
@ DisableObject
Disables a compatible object.
@ EnableObject
Enables a compatible object.
Defines a set of values found in the isobus language command message from ISO11783-7 commonly used in...
Defines the different VT object types that can comprise a VT object pool.
This namespace encompasses all of the ISO11783 stack's functionality to reduce global namespace pollu...
constexpr std::uint8_t NULL_CAN_ADDRESS
The NULL CAN address defined by J1939 and ISO11783.
constexpr std::uint16_t NULL_OBJECT_ID
Special ID used to indicate no object.
VirtualTerminalObjectType
The types of objects in an object pool by object type byte value.
bool(*)(std::uint32_t callbackIndex, std::uint32_t bytesOffset, std::uint32_t numberOfBytesNeeded, std::uint8_t *chunkBuffer, void *parentPointer) DataChunkCallback
A callback to get chunks of data for transfer by a protocol.
A struct for storing information of an auxilary function event.
std::uint16_t value2
The second value.
std::uint16_t value1
The first value.
AssignedAuxiliaryFunction function
The function.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
An object for storing information regarding an object pool upload.
std::uint32_t objectPoolSize
The size of the object pool.
std::uint32_t autoScaleSoftKeyDesignatorOriginalHeight
The original height of a soft key designator as designed in the pool (in pixels)
const std::uint8_t * objectPoolDataPointer
A pointer to an object pool.
std::string versionLabel
An optional version label that will be used to load/store the pool to the VT. 7 character max!
bool useDataCallback
Determines if the client will use callbacks to get the data in chunks.
DataChunkCallback dataCallback
A callback used to get data in chunks as an alternative to loading the whole pool at once.
const std::vector< std::uint8_t > * objectPoolVectorPointer
A pointer to an object pool (vector format)
bool uploaded
The upload state of this pool.
std::vector< std::uint8_t > scaledObjectPool
Stores a copy of a pool to auto-scale in RAM before uploading it.
std::uint32_t autoScaleDataMaskOriginalDimension
The original length or width of this object pool's data mask area (in pixels)
A struct for storing information of a VT control audio signal termination event.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
bool isTerminated
Whether the audio signal is terminated.
A struct for storing information of a VT change active mask event.
std::uint16_t maskObjectID
The mask object ID.
bool missingObjects
Whether there are missing objects.
bool anyOtherError
Whether there are any other errors.
std::uint16_t errorObjectID
The error object ID.
std::uint16_t parentObjectID
The parent object ID.
bool maskOrChildHasErrors
Whether the mask or child has errors.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
bool poolDeleted
Whether the pool has been deleted.
A struct for storing information of a VT change numeric value event.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
std::uint16_t objectID
The object ID.
std::uint32_t value
The value.
A struct for storing information of a VT change soft key mask event.
std::uint16_t softKeyMaskObjectID
The soft key mask object ID.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
bool poolDeleted
Whether the pool has been deleted.
bool maskOrChildHasErrors
Whether the mask or child has errors.
std::uint16_t dataOrAlarmMaskObjectID
The data or alarm mask object ID.
bool missingObjects
Whether there are missing objects.
bool anyOtherError
Whether there are any other errors.
A struct for storing information of a VT change string value event.
std::uint16_t objectID
The object ID.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
std::string value
The value.
A struct for storing information of a VT ESC message event.
ESCMessageErrorCode errorCode
The error code.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
std::uint16_t objectID
The object ID.
A struct for storing information of a VT key input event.
std::uint8_t keyNumber
The key number.
std::uint16_t objectID
The object ID.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
std::uint16_t parentObjectID
The parent object ID.
KeyActivationCode keyEvent
The key event.
A struct for storing information of a VT pointing event.
std::uint16_t yPosition
The y position.
std::uint16_t parentObjectID
The parent object ID.
KeyActivationCode keyEvent
The key event.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
std::uint16_t xPosition
The x position.
A struct for storing information of a VT on user-layout hide/show event.
bool isHidden
Whether the object is hidden.
std::uint16_t objectID
The object ID.
VirtualTerminalClient * parentPointer
A pointer to the parent VT client.
size_t operator()(const isobus::VirtualTerminalClient::FontSize &fontSize) const
Hashes a font size.