Home2L - C/C++ API  v1.2-2-ga4fe (2023-04-15)
Smart Tools for a Private Home
Classes | Macros | Enumerations | Functions
Values, Types and States

Description

Basic definitions for values and their types and state.

Collaboration diagram for Values, Types and States:

Classes

class  CRcValueState
 Typed value tagged with a state and a time stamp. More...
 

Macros

#define NO_VALUE_STATE   ((CRcValueState *) NULL)
 Special value meaning "none" for request values, should be used instead of 'NULL'.
 

Enumerations

enum  ERcType {
  rctNone = 0 , rctBool , rctInt , rctFloat ,
  rctString , rctTime , rctTrigger , rctMutex ,
  rctPercent = rctUnitTypesBase , rctTemp , rctUnitTypesEND , rctUseState = rctEnumTypesBase ,
  rctWindowState , rctPhoneState , rctPlayerState , rctEnumTypesEND
}
 Resource major type. More...
 
enum  ERctUseState { }
 Use/presence state of the home (for 'rctUseState') More...
 
enum  ERctWindowState { }
 Window state (for 'rctWindowState') More...
 
enum  ERctPhoneState { }
 Phone state (for 'rctPhoneState') More...
 
enum  ERctPlayerState { }
 Music player state (for 'rctPlayerState') More...
 
enum  ERcState { rcsUnknown = 0 , rcsBusy , rcsValid , rcsNoReport = rcsUnknown }
 Resource state. More...
 

Functions

ERcType RcTypeGetBaseType (ERcType t)
 Return the underlying base type as a unique representative for compatible classes (e.g. rctFloat/rctTemp -> rctFloat)
 
bool RcTypeIsStringBased (ERcType t)
 Return if the base type is 'rctString'; This is the set of types that have dynamic data.
 
static bool RcTypeIsUnitType (ERcType t)
 Return whether the type is a unit type.
 
const char * RcTypeGetUnit (ERcType t)
 Return the unit string; For non-unit types, an empty string is returned.
 
static bool RcTypeIsEnumType (ERcType t)
 Return whether the type is a enumeration type.
 
int RcTypeGetEnumValues (ERcType t)
 Return the number of possible values for an enumeration type.
 
const char * RcTypeGetEnumValue (ERcType t, int idx, bool warn=true)
 Return the value for 'idx' for an enumeration type. Allowed index vaules range from 0 to N-1, where N is the number of possible values. If the index is invalid, "?" is returned and, if 'warn == true', a warning is logged.
 
int RcTypeGetEnumIdx (ERcType t, const char *value, bool warn=true)
 Return the index of some value for an enumeration type. If the 'value' is out of range, -1 is returned and, if 'warn == true', a warning is logged.
 

Enumeration Type Documentation

◆ ERcType

enum ERcType

Resource major type.

Enumerator
rctNone 

No type.

rctBool 

Boolean.

rctInt 

Integer.

rctFloat 

Float.

rctString 

String.

rctTime 

Time.

rctTrigger 

[rctInt] Resource does not carry a value, but can transport events ("triggers"); 'vTriggerCount' counts the number of trigger events.

rctMutex 

[rctString] resource represents a mutex (not implemented yet)

       **Note:** Mutex operations are not implemented yet. Once implemented, they will work as follows.

       Operation of mutexes:

       a) The value of the resource is the GID of the successful request. By using different
          priorities, the mutex can be made preemptive. For non-preemptive mutexes, all
          users should use the same priority ('prioNormal'). Any mutex resource should
          have the empty string as a default (at priority 'prioDefault').

       b) Locking procedure:
            1. Issue request at a given GID `<gid>`
            2. Wait until the value changes to `<gid>`

          Unlocking:
            1. Remove the request with GID `<gid>` 
rctPercent 

[float] Percentage (0.0 .. 100.0)

rctTemp 

[float] Temperature in degree centigrade

rctUseState 

Use/presence state ("day", "night", "away", "vacation")

rctWindowState 

Window opening state ("closed", "tilted", "open", "openOrTilted")

rctPhoneState 

Phone state ("idle", "ringing", "inCall")

rctPlayerState 

Music player state ("stop", "pause", "play")

Definition at line 276 of file resources.H.

◆ ERctUseState

Use/presence state of the home (for 'rctUseState')

Enumerator
rcvUseNight 

User is at home and present at day time.

rcvUseAway 

User is at home, but sleeping (e.g. doors should be locked)

rcvUseVacation 

User is away temporarily (e.g. for work)

User is away for longer (e.g. on vacation)

Definition at line 385 of file resources.H.

◆ ERctWindowState

Window state (for 'rctWindowState')

Enumerator
rcvWindowTilted 

closed

rcvWindowOpen 

tilted

rcvWindowOpenOrTilted 

(wide) open

type of opening is not known

Definition at line 394 of file resources.H.

◆ ERctPhoneState

Phone state (for 'rctPhoneState')

Enumerator
rcvPhoneInCall 

idle

rcvPhoneRinging 

in call, including any 'psDialing' and 'psTransfer...' states (anything where a user is actively using the phone)

ringing

Definition at line 403 of file resources.H.

◆ ERctPlayerState

Music player state (for 'rctPlayerState')

Enumerator
rcvPlayerPaused 

stopped

rcvPlayerPlaying 

paused

playing

Definition at line 411 of file resources.H.

◆ ERcState

enum ERcState

Resource state.

Enumerator
rcsUnknown 

Value is presently unknown (e.g. outdated).

rcsBusy 

Devices is busy and/or switching to the value indicated by the associate value.

rcsValid 

Value is valid.

rcsNoReport 

Alias to make the 'successState' attribute in CRcEventDriver more intuitive.

Definition at line 454 of file resources.H.