The Bind class provides a framework for creating interactive applications with BindCanvas. More...
#include <Bind.h>
Public Member Functions | |
Bind (void(*_setupCallback)(int16_t, int16_t)) | |
Constructs a Bind object with a setup callback function. | |
bool | isReady () |
Checks if the bind object is in a ready state. | |
bool | init (Stream &stream, void(&setupCallback)(int16_t, int16_t)) |
Initializes the Bind framework with communication and screen setup. | |
void | sync (BindView &obj) |
Synchronizes a BindView object with the BindCanvas screen. Same as sync(BindView *obj) but uses the object refrence to prevent common mistakes. | |
void | sync () |
Synchronizes the bind with the current state. | |
void | sync (const uint8_t *buffer, size_t size) |
Synchronizes the bind with the current state. | |
void | sync (float chartData, BindChart &obj) |
Synchronizes chart data of a BindChart object. | |
void | sync (const char *str, int32_t textColor, bool autoScroll, bool newLine, bool bold, bool italic, BindTerminal &obj) |
Prints terminal data in a BindTerminal object. | |
void | sync (const char *str, BindTerminal &obj) |
Prints terminal data in a BindTerminal object. | |
void | sync (BindSwitch &obj) |
Synchronizes the BindSwitch object with the BindCanvas screen. | |
void | sync (BindButton &obj) |
Synchronizes the BindButton object with the BindCanvas screen. | |
void | sync (BindKnob &obj) |
Synchronizes the BindKnob object with the BindCanvas screen. | |
void | sync (BindSeekBar &obj) |
Synchronizes the BindSeekBar object with the BindCanvas screen. | |
void | sync (BindJoystick &obj) |
Synchronizes the BindJoystick object with the BindCanvas screen. | |
void | sync (BindColorPicker &obj) |
Synchronizes the BindColorPicker object with the BindCanvas screen. | |
void | sync (BindTextInput &obj) |
Synchronizes the BindTextInput object with the BindCanvas screen. | |
void | sync (BindDialog &obj) |
Synchronizes the BindDialog object with the BindCanvas screen. | |
The Bind class provides a framework for creating interactive applications with BindCanvas.
Bind is a versatile class that enables you to build applications that interact with BindCanvas. It provides functions for binding and synchronizing various UI elements, including buttons, knobs, switches, seekbars, joysticks, color pickers, terminals, and many more. You can use Bind to connect your c++ programme to the BindCanvas screen, manage user interactions, and update UI elements in real time.
![]()
Sample app created by Bind | ![]()
Sample app created by Bind |
To use Bind effectively, you can define a setup callback function to configure the initial state of your application, including screen setup and object synchronization. Bind also allows you to set the communication device, such as a serial port, for data exchange with BindCanvas.
|
inline |
Constructs a Bind object with a setup callback function.
This constructor creates a Bind object and associates it with a setup callback function. The setup callback is in charge of configuring the initial state of the Bind object, which includes screen rotation and syncing all the objects. To put it simply, 'setupCallback' is where you construct the application view.
_setupCallback | A pointer to the setup callback function that initializes the Bind screen. |
bool Bind::init | ( | Stream & | stream, |
void(&)(int16_t, int16_t) | setupCallback | ||
) |
Initializes the Bind framework with communication and screen setup.
This function serves a dual purpose:
stream | A reference to the 'Stream' object representing the communication device. |
setupCallback | A reference to the screen setup callback function. This function receives 'w' for width and 'h' for height. It ensures consistent object positioning and size across devices. |
|
inline |
Checks if the bind object is in a ready state.
This function checks whether the Bind object is in a ready state, which indicates whether it is connected or not.
void Bind::sync | ( | ) |
Synchronizes the bind with the current state.
This function synchronizes the Bind object with the current state by reading data from the canvas and managing user interactions with Bind views, such as button presses or connection requests. In simpler terms, it reads the screen.
void Bind::sync | ( | BindButton & | obj | ) |
Synchronizes the BindButton object with the BindCanvas screen.
This function synchronizes the BindButton object with the BindCanvas screen. It adds the object to the canvas, refreshes the existing object, or removes it.
obj | A reference to the 'BindButton' object for data synchronization. |
void Bind::sync | ( | BindColorPicker & | obj | ) |
Synchronizes the BindColorPicker object with the BindCanvas screen.
This function synchronizes the BindColorPicker object with the BindCanvas screen. It adds the object to the canvas, refreshes the existing object, or removes it.
obj | A reference to the 'BindColorPicker' object for data synchronization. |
void Bind::sync | ( | BindDialog & | obj | ) |
Synchronizes the BindDialog object with the BindCanvas screen.
This function synchronizes the BindDialog object with the BindCanvas screen. It shows the dialog box Imeadiatly.
obj | A reference to the 'BindDialog' object for data synchronization. |
void Bind::sync | ( | BindJoystick & | obj | ) |
Synchronizes the BindJoystick object with the BindCanvas screen.
This function synchronizes the BindJoystick object with the BindCanvas screen. It adds the object to the canvas, refreshes the existing object, or removes it.
obj | A reference to the 'BindJoystick' object for data synchronization. |
void Bind::sync | ( | BindKnob & | obj | ) |
void Bind::sync | ( | BindSeekBar & | obj | ) |
Synchronizes the BindSeekBar object with the BindCanvas screen.
This function synchronizes the BindSeekBar object with the BindCanvas screen. It adds the object to the canvas, refreshes the existing object, or removes it.
obj | A reference to the 'BindSeekBar' object for data synchronization. |
void Bind::sync | ( | BindSwitch & | obj | ) |
Synchronizes the BindSwitch object with the BindCanvas screen.
This function synchronizes the BindSwitch object with the BindCanvas screen. It adds the object to the canvas, refreshes the existing object, or removes it.
obj | A reference to the 'BindSwitch' object for data synchronization. |
void Bind::sync | ( | BindTextInput & | obj | ) |
Synchronizes the BindTextInput object with the BindCanvas screen.
This function synchronizes the BindTextInput object with the BindCanvas screen. It adds the object to the canvas, refreshes the existing object, or removes it.
obj | A reference to the 'BindTextInput' object for data synchronization. |
void Bind::sync | ( | const char * | str, |
BindTerminal & | obj | ||
) |
Prints terminal data in a BindTerminal object.
This function prints terminal data with this simple format: textColor is white autoScroll is enable always adds a new line No bold, no italic
str | The text data to be printed in the 'BindTerminal' object. |
obj | A pointer to the 'BindTerminal' object for data synchronization. |
void Bind::sync | ( | const char * | str, |
int32_t | textColor, | ||
bool | autoScroll, | ||
bool | newLine, | ||
bool | bold, | ||
bool | italic, | ||
BindTerminal & | obj | ||
) |
Prints terminal data in a BindTerminal object.
This function synchronizes terminal data, including text, text color, formatting options, and terminal behavior, with a 'BindTerminal' object.
str | The text data to be printed in the 'BindTerminal' object. |
textColor | The color of the text. |
autoScroll | Determines whether auto-scrolling is enabled. |
newLine | Determines whether a new line is added after the text. |
bold | Indicates whether the text should be bold. |
italic | Indicates whether the text should be italic. |
obj | A reference to the 'BindTerminal' object for data synchronization. |
void Bind::sync | ( | const uint8_t * | buffer, |
size_t | size | ||
) |
Synchronizes the bind with the current state.
Similar to sync() but uses the buffer directly to be used in some cases that the regular stream object is not available. for example ble, wifi or any other custom communication.
buffer | a pointer to the buffer that contains the data to be processed. |
size | size of the buffer. |
void Bind::sync | ( | float | chartData, |
BindChart & | obj | ||
) |
Synchronizes chart data of a BindChart object.
This function synchronizes the chart data represented by a float value with a 'BindChart' object. It takes two parameters: the 'chartData' to be synchronized and a pointer to the 'BindChart' object, 'obj' so that it knows the data blong to which chart. This function updates the chart data on the screen immediately.