Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
BindGaugeSimple Class Reference

BindGaugeSimple Class. More...

`#include <BindGaugeSimple.hpp>`

Inheritance diagram for BindGaugeSimple:

## Public Member Functions
| BindGaugeSimple (const char *cstr)
| Constructor with a label parameter.
| BindGaugeSimple ()
| Default constructor.
void | setLabel (const char *cstr)
| Set the label text.
void | setlabel (const char *cstr)
uint16_t | getBytes (uint8_t *out)
| Serialize the gauge object into bytes.

## Public Attributes
int16_t | x = 0
| The x-coordinate position of the gauge on the screen.
int16_t | y = 0
| The y-coordinate position of the gauge on the screen.
uint8_t | cmdId = 0
| Command identifier to add or refresh the gauge. See the notes for possible cmdId values.
int16_t | dimSize = 200
| The dimensions (size) of the gauge.
int16_t | minValue = 0
| The minimum value for the gauge's value range.
int16_t | maxValue = 100
| The maximum value for the gauge's value range.
int16_t | value = 0
| The current value of the gauge.
uint8_t | style = 0
| The style of the gauge (e.g., radial or linear).
bool | isSymmetrical = false
| Indicates whether the gauge is symmetrical or not.
int32_t | color
| The color of the gauge.
Public Attributes inherited from BindView
int16_t | tag

## Detailed Description

BindGaugeSimple Class.

The `BindGaugeSimple` class is a part of the Bind framework for Arduino, designed to create a simple gauge element that can be displayed and controlled on the BindCanvas Android app interface.

BindGaugeSimple

This class allows you to define the properties of a gauge, including its position, size, value range, current value, style, symmetry, color, and label. You can synchronize these properties with BindCanvas to provide visual gauge displays in your Arduino projects.

Note
  Possible cmdId values for a BindView and corresponding effects:
  - BIND_ADD_OR_REFRESH_CMD: Adds the object to the canvas (screen) or refreshes the existing one.
  - BIND_DATA_ONLY_CMD: Refreshes the existing object without moving or resizing; updates data, such as text.
  - BIND_REMOVE_CMD: Removes the object from the canvas (screen).
  - BIND_DISABLE_CMD: Disables the object.
  - BIND_ENABLE_CMD: Enables the object.
  - BIND_HIDE_CMD: Hides the object.
  - BIND_VISIBLE_CMD: Restores the object's visibility.

The gauge's properties can be customized by setting attributes such as the position (x and y coordinates), dimensions (size), minimum and maximum values for the gauge, current value, style (e.g., arc, horizontal, or vertical), whether it's symmetrical or not (center is zero), color, and label text.

To use the `BindGaugeSimple` class effectively, you can create an instance, set its attributes, and call `bind.sync(your_gauge)` to synchronize it with BindCanvas.

Example usage:

BindGaugeSimple gauge("Temperature");
gauge.x = 30;
gauge.y = 100;
gauge.dimSize = 200;
gauge.minValue = 0;
gauge.maxValue = 100;
gauge.value = 75;
gauge.style = 0; // 0 = arc, 1 = horizontal, 2 = vertical.
gauge.isSymmetrical = true;
gauge.color = YELLOW;
gauge.cmdId = BIND_ADD_OR_REFRESH_CMD;
bind.sync(gauge);
BindGaugeSimple
BindGaugeSimple Class.
Definition BindGaugeSimple.hpp:51

Note
  check the examples for more information.

## Constructor & Destructor Documentation

## ◆ BindGaugeSimple() [1/2]

BindGaugeSimple::BindGaugeSimple | ( | const char * | cstr | ) |

Constructor with a label parameter.

Initializes a `BindGaugeSimple` object with a custom label text.

Parameters

  cstr | A pointer to the label text.

## ◆ BindGaugeSimple() [2/2]

BindGaugeSimple::BindGaugeSimple | ( |  | ) |
| inline

Default constructor.

Initializes a `BindGaugeSimple` object with a default label ("Gauge").

## Member Function Documentation

## ◆ getBytes()

uint16_t BindGaugeSimple::getBytes | ( | uint8_t * | out | ) |
| virtual

Serialize the gauge object into bytes.

This function serializes the gauge object into a byte array, allowing it to be sent and displayed on BindCanvas.

Parameters

  out | A pointer to the byte array where the serialized data will be stored.

Returns
  The offset representing the length of the serialized data.

Reimplemented from BindView.

## ◆ setLabel()

void BindGaugeSimple::setLabel | ( | const char * | cstr | ) |
| inline

Set the label text.

Allows setting a custom label text for the gauge.

Parameters

  cstr | A pointer to the label text.

The documentation for this class was generated from the following files:

- BindGaugeSimple.hpp
- Bind.cpp
- BindGaugeSimple.cpp