SBB Host
Host communication with the self balancing bike.
Loading...
Searching...
No Matches
HostControl Class Reference

A class for host control widget. More...

#include <HostControl.h>

Inheritance diagram for HostControl:

Public Member Functions

 HostControl ()
 Constructor. More...
 
void append_slider (Glib::ustring lbl, double min=-1, double max=+1, double val=0)
 Append a slider. More...
 
void update ()
 Update the widget appearance. More...
 
bool get_values (float *buf, size_t len)
 Get the values of the sliders. More...
 

Protected Attributes

Gtk::Grid grid
 Gtk::Grid object for the sliders. More...
 
std::vector< Slider * > sliders
 Vector of pointers to Slider object. More...
 

Private Attributes

unsigned int nanVal = NAN_VAL
 NaN variable, see NAN_VAL. More...
 

Detailed Description

A class for host control widget.

Class for host control widget extending the Gtk::Frame class, used in SBBHostApp.

See also
SBBHostApp
Author
Stefano Lovato
Date
2022

Constructor & Destructor Documentation

◆ HostControl()

HostControl::HostControl ( )

Constructor.

Default constructor.

Member Function Documentation

◆ append_slider()

void HostControl::append_slider ( Glib::ustring  lbl,
double  min = -1,
double  max = +1,
double  val = 0 
)

Append a slider.

Function to append a slider. Does not update the widget.

Parameters
lblThe label of the slider.
minThe minimum value of the slider.
maxThe maximum value of the slider.
valThe default value of the slider.

◆ get_values()

bool HostControl::get_values ( float *  buf,
size_t  len 
)

Get the values of the sliders.

Function to get the values of the sliders. Values of sliders not active are set to NaN, see NAN_VAL.

Parameters
bufPointer to buffer of floats where store the values.
lenSize of the buffer.
Returns
true if one or more values has been set.

◆ update()

void HostControl::update ( )

Update the widget appearance.

Function to update the widget appearance after having added sliders.

Member Data Documentation

◆ grid

Gtk::Grid HostControl::grid
protected

Gtk::Grid object for the sliders.

◆ nanVal

unsigned int HostControl::nanVal = NAN_VAL
private

NaN variable, see NAN_VAL.

◆ sliders

std::vector<Slider*> HostControl::sliders
protected

Vector of pointers to Slider object.