# Vault 7: Projects

This publication series is about specific projects related to the Vault 7 main publication.

### Protego

# MLA -- Graphics Library

- 1
- 2
…
- 46
- 47
- 48
- 49
- 50
…
- 373
- 374

// assume signal is sampled at a pin RC1
if (PORTCbits.RC1 == 1)
signalAssert = true;
else
signalAssert - false;
if (signalAssert == true)
{
// increment the value
GFX_GOL_ScrollBarPositionIncrement(pScrollBar);
}
else
{
// increment the value
GFX_GOL_ScrollBarPositionDecrement(pScrollBar);
}
// redraw only the thumb
GFX_GOL_ObjectStateSet(pScrollBar, GFX_GOL_SCROLLBAR_DRAW_THUMB_STATE);
}
return (true);
}
1.4.1.3 Object Layer Messaging
This section describes the basics of object messages.
Description
User inputs can also change the state of objects. This is done through messaging. The library passes user action to the
objects using the message structure (see GFX_GOL_MESSAGE). The purpose of the messaging is to translate user action
(i.e. a user press on a touch screen) to a change in state of the objects in the screen. At the same time, this user action will
cause an application function to execute.
For example: A press on a button on the screen will result in an LED to be turned on. While pressing on the button, the
button on the screen also changes states and is redrawn to a pressed state. When the user let's go of the press, the button
redraws back to an unpressed state and the LED turns off.
The mechanism of messaging and object state change is explained in the next section.
Messaging Structure
The messages are encoded in the GFX_GOL_MESSAGE structure.
typedef struct
{
uint8_t type; // Specifies the type of input device.
uint8_t uiEvent; // An event that occurred in the input
// device.
int16_t param1; // Parameter 1, definition and usage is
// dependent on the type of input device.
int16_t param2; // Parameter 2, definition and usage is
// dependent on the type of input device.
} GFX_GOL_MESSAGE;
The type defines the type of input device. See INPUT_DEVICE_TYPE for the currently supported type of devices. The
uiEvent is also a set of predefined events. See INPUT_DEVICE_EVENT for a list of supported events. The two parameters,
param1 and param2, changes in usage depending on the type of input device and event.
The messages are encoded in the drivers for the input devices. The drivers provide functions for the application to call.
These functions should return the message whenever there is a valid user action on the input device.
The example code below shows TouchGetMsg() as the function provided by the touch screen driver to retrieve user inputs
on the touchscreen.
// GOL message structure
GFX_GOL_MESSAGE msg;
...
1.4 Using The Library MLA - Graphics Library Help Library Overview
48

- 1
- 2
…
- 46
- 47
- 48
- 49
- 50
…
- 373
- 374