RumPi Linux Client 1.0
A wxWidgets desktop dashboard that visualizes a RumPi robot's live sensor data as a condition-reactive scene
ClientUtilities Class Reference

Collects small, general-purpose helpers shared across the client UI. More...

#include <ClientUtilities.h>

Static Public Member Functions

static unsigned char AlphaByte (double alpha)
 Converts a 0.0 - 1.0 opacity to a wxColour alpha byte, clamped so an out-of-range value never overflows. More...
 
static wxString FormatReading (float value, const char *utf8Unit, int decimals=1)
 Formats a numeric sensor reading with its unit, or "N/A" for the NaN "no reading / sensor absent" sentinel. More...
 

Detailed Description

Collects small, general-purpose helpers shared across the client UI.

Helpers that only make sense for one class (e.g. the scene's Co2DotColour) stay local to that class - only genuinely reusable functions belong here.

Author
Eddie O'Hagan
Date
8/13/2026

Member Function Documentation

◆ AlphaByte()

unsigned char ClientUtilities::AlphaByte ( double  alpha)
static

Converts a 0.0 - 1.0 opacity to a wxColour alpha byte, clamped so an out-of-range value never overflows.

Author
Eddie O'Hagan
Date
8/13/2026
unsigned char alpha = ClientUtilities::AlphaByte(0.5);
static unsigned char AlphaByte(double alpha)
Converts a 0.0 - 1.0 opacity to a wxColour alpha byte, clamped so an out-of-range value never overflo...
Definition: ClientUtilities.cpp:20

Output: 127

Parameters
[in]alphaThe opacity, from 0.0 (transparent) to 1.0 (opaque).
Returns
The clamped alpha byte (0 - 255).

◆ FormatReading()

wxString ClientUtilities::FormatReading ( float  value,
const char *  utf8Unit,
int  decimals = 1 
)
static

Formats a numeric sensor reading with its unit, or "N/A" for the NaN "no reading / sensor absent" sentinel.

utf8Unit is a UTF-8 literal (degree/micro/cubic glyphs), so keep source files saved as UTF-8.

Author
Eddie O'Hagan
Date
8/13/2026
wxString text = ClientUtilities::FormatReading(21.5f, "°C");
static wxString FormatReading(float value, const char *utf8Unit, int decimals=1)
Formats a numeric sensor reading with its unit, or "N/A" for the NaN "no reading / sensor absent" sen...
Definition: ClientUtilities.cpp:43

Output: 21.5 °C

Parameters
[in]valueThe reading to format (NaN means no reading / sensor absent).
[in]utf8UnitThe unit string, as a UTF-8 literal.
[in]decimalsThe number of decimal places to show.
Returns
The formatted "value unit" string, or "N/A" for the sentinel.

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