Struct Reference
API Reference
This is a list of all structs used by the LaRoomy Api.
POINT
typedef struct _POINT
{
float x ;
float y ;
} POINT, *LPPOINT;
Description:
The POINT struct defines a simple point in a coordinate system. It is used by the LineGraphDataPoints class.
Usage:
Add some points to the LineGraphDataPoints class:
LineGraphDataPoints points ;
// create some points and initialize them in different ways:
POINT pt1 = {1,1};
points .addPoint(pt1 );
POINT pt2 ;
pt2 .x = 21;
pt2 .y = 1;
points .addPoint(pt2 );
POINT pt3 = {21, 21};
points .addPoint(pt3 );
POINT pt4 = {1, 21};
points .addPoint(pt4 );
points .addPoint(pt1 );// initial point
// add the points to the lineGraph (these coordinates will draw a rect in the lineGraph)
lineGraph .lineGraphState .lineGraphPoints = points ;
COLOR
typedef struct _COLOR
{
unsigned int redPart ;
unsigned int greenPart ;
unsigned int bluePart ;
String toString();
void fromString(const String& s );
bool isValidColor();
} COLOR, *PCOLOR;
Description:
The COLOR struct is used at various points within the API. Some device properties have color member to set the color of elements. The RGBController uses the struct in different cases and it can be used in conjunction with the RGBSelectorState.
Usage:
Here some examples on how to initialize the COLOR struct:
// yellow color
COLOR col ;
col .redPart = 255;
col .greenPart = 255;
col .bluePart = 0;
// use the colors class to set the color
COLOR col2 = Colors::DarkGreen ;
// use a hex string to initialize a cyan color
COLOR col3 = "#00ffff";
UIMODEDATA
typedef struct _UIMODEDATA
{
bool isNightMode ;
unsigned int dummy ;
} UIMODEDATA, *PUIMODEDATA;
Description:
The UIMODEDATA struct is used in a response to a UI-Mode-Info request. The ILaroomyAppCallback reports the response with the onUIModeRequestResponse method which has a parameter from type PUIMODEDATA (pointer to a UIMODEDATA struct).
Usage:
Exampe implementation of the callback method:
// define the callback for the remote app-user events
class RemoteEvents : public ILaroomyAppCallback
{
public:
// listen for response to UI-Mode-Info request
void onUIModeRequestResponse(PUIMODEDATA pData ) override
{
if(pData ->isNightMode ){
// app is running in dark mode...
}
}
};
STATETIME
typedef struct _STATETIME
{
unsigned int hour ;
unsigned int minute ;
} STATETIME, *LPSTATETIME;
Description:
The STATETIME struct defines a time value. It is used in the TimeSelectorState and the TimeFrameSelectorState class. Beside holding time values, it can be used to compare times.
Usage:
In the following example, the current time from an RTC is compared with the time from a TimeSelector property.
// get current time
STATETIME curTime ;
curTime .hour = rtc .getHours();
curTime .minute = rtc .getMinutes();
// get state from a simple time selector
auto simpleTimeSelectorTime =
LaRoomyApi .getTimeSelectorState(MY_TIME_SELECTOR_ID ).toStateTime();
if (simpleTimeSelectorTime == curTime )
{
// time match, do something..
}
else if(simpleTimeSelectorTime > curTime )
{
// current time is before the selector time
}
else if(simpleTimeSelectorTime < curTime )
{
// current time is later than selector time
}