Home2L - Python API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
Public Member Functions | Static Public Member Functions | List of all members
CResource Class Reference

Description

Home2L Resource.

This is the most central class of the library. A 'Resource' may represent
a sensor, an actor, a stored value, a virtual device, a mutex, an event
trigger - almost anything. Resources are identified by a uniform resource
identifier (URI).

Inherits object.

Public Member Functions

def Uri (self)
 
def Gid (self)
 
def Lid (self)
 
def Is (self, *args)
 
def IsLike (self, pattern)
 
def IsWritable (self)
 
def ToStr (self, ret, pathLocal=False)
 
def Type (self)
 
def State (self)
 
def TimeStamp (self)
 
def IsValid (self)
 
def IsBusy (self)
 
def IsKnown (self)
 
def Equals (self, vs2)
 
def ValueEquals (self, vs2)
 
def Subscribe (self, subscr)
 
def Unsubscribe (self, subscr)
 
def GetRequestSet (self, ret, allowNet=True)
 
def GetRequest (self, reqGid, allowNet=True)
 
def WriteValue (self, *args)
 
def UnWrite (self, *args)
 
def SetDefault (self, *args)
 
def Unregister (self)
 
def SetUserData (self, _data)
 
def UserData (self)
 
def ReportValueState (self, _valueState)
 
def ReportTrigger (self)
 
def ReportState (self, _state)
 
def ReportBusy (self)
 
def ReportUnknown (self)
 
def RedriveValue (self, force=True)
 
def PrintInfo (self, *args)
 
def LockLocalSubscribers (self)
 
def GetLocalSubscriber (self, n)
 
def UnlockLocalSubscribers (self)
 
def LockLocalRequests (self)
 
def GetLocalRequest (self, n)
 
def UnlockLocalRequests (self)
 
def ValueState (self)
 
def Value (self)
 
def ValidValue (self, defaultVal)
 
def SetRequest (self, reqDef=None, attrs=None, value=None, id=None, priority=None, t0=None, t1=None, repeat=None, hysteresis=None, delDelay=None)
 
def SetTrigger (self, attrs=None, id=None, priority=None, t0=None, t1=None, repeat=None, hysteresis=None)
 
def DelRequest (self, reqId=None, t1=None)
 
def ReportValue (self, value, state=rcsValid)
 

Static Public Member Functions

def Get (uri, allowWait=False)
 
def GarbageCollection ()
 

Member Function Documentation

◆ Get()

def Get (   uri,
  allowWait = False 
)
static
Get(char const * uri, bool allowWait=False) -> CResource

◆ GarbageCollection()

def GarbageCollection ( )
static
GarbageCollection()

◆ Uri()

def Uri (   self)
Uri(CResource self) -> char const *

◆ Gid()

def Gid (   self)
Gid(CResource self) -> char const *

◆ Lid()

def Lid (   self)
Lid(CResource self) -> char const *

◆ Is()

def Is (   self,
args 
)
    Is(CResource self, char const * uri) -> bool
    Is(CResource self, CResource rc) -> bool

◆ IsLike()

def IsLike (   self,
  pattern 
)
IsLike(CResource self, char const * pattern) -> bool

◆ IsWritable()

def IsWritable (   self)
IsWritable(CResource self) -> bool

◆ ToStr()

def ToStr (   self,
  ret,
  pathLocal = False 
)
ToStr(CResource self, CString * ret, bool pathLocal=False) -> char const

◆ Type()

def Type (   self)
Type(CResource self) -> ERcType

◆ State()

def State (   self)
State(CResource self) -> ERcState

◆ TimeStamp()

def TimeStamp (   self)
TimeStamp(CResource self) -> TTicks

◆ IsValid()

def IsValid (   self)
IsValid(CResource self) -> bool

◆ IsBusy()

def IsBusy (   self)
IsBusy(CResource self) -> bool

◆ IsKnown()

def IsKnown (   self)
IsKnown(CResource self) -> bool

◆ Equals()

def Equals (   self,
  vs2 
)
Equals(CResource self, CRcValueState vs2) -> bool

◆ ValueEquals()

def ValueEquals (   self,
  vs2 
)
ValueEquals(CResource self, CRcValueState vs2) -> bool

◆ Subscribe()

def Subscribe (   self,
  subscr 
)
Subscribe(CResource self, CRcSubscriber subscr) -> CResource

◆ Unsubscribe()

def Unsubscribe (   self,
  subscr 
)
Unsubscribe(CResource self, CRcSubscriber subscr)

◆ GetRequestSet()

def GetRequestSet (   self,
  ret,
  allowNet = True 
)
GetRequestSet(CResource self, CRcRequestSet * ret, bool allowNet=True) -> bool

◆ GetRequest()

def GetRequest (   self,
  reqGid,
  allowNet = True 
)
GetRequest(CResource self, char const * reqGid, bool allowNet=True) -> CRcRequest

◆ WriteValue()

def WriteValue (   self,
args 
)
WriteValue(CResource self, CRcValueState value, int priority=-1, char const * reqGid="write")

◆ UnWrite()

def UnWrite (   self,
args 
)
UnWrite(CResource self, char const * reqGid="write")

◆ SetDefault()

def SetDefault (   self,
args 
)
    SetDefault(CResource self, CRcValueState vs)
    SetDefault(CResource self, bool valBool)
    SetDefault(CResource self, int valInt)
    SetDefault(CResource self, float valFloat)
    SetDefault(CResource self, char const * valString)
    SetDefault(CResource self, TTicks valTime)

◆ Unregister()

def Unregister (   self)
Unregister(CResource self)

◆ SetUserData()

def SetUserData (   self,
  _data 
)
SetUserData(CResource self, void * _data)

◆ UserData()

def UserData (   self)
UserData(CResource self) -> void *

◆ ReportValueState()

def ReportValueState (   self,
  _valueState 
)
ReportValueState(CResource self, CRcValueState _valueState)

◆ ReportTrigger()

def ReportTrigger (   self)
ReportTrigger(CResource self)

◆ ReportState()

def ReportState (   self,
  _state 
)
ReportState(CResource self, ERcState _state)

◆ ReportBusy()

def ReportBusy (   self)
ReportBusy(CResource self)

◆ ReportUnknown()

def ReportUnknown (   self)
ReportUnknown(CResource self)

◆ RedriveValue()

def RedriveValue (   self,
  force = True 
)
RedriveValue(CResource self, bool force=True)

◆ PrintInfo()

def PrintInfo (   self,
args 
)
PrintInfo(CResource self, FILE * f=stdout, int verbosity=1, bool allowNet=True)

◆ LockLocalSubscribers()

def LockLocalSubscribers (   self)
LockLocalSubscribers(CResource self) -> int

◆ GetLocalSubscriber()

def GetLocalSubscriber (   self,
  n 
)
GetLocalSubscriber(CResource self, int n) -> CRcSubscriber

◆ UnlockLocalSubscribers()

def UnlockLocalSubscribers (   self)
UnlockLocalSubscribers(CResource self)

◆ LockLocalRequests()

def LockLocalRequests (   self)
LockLocalRequests(CResource self) -> int

◆ GetLocalRequest()

def GetLocalRequest (   self,
  n 
)
GetLocalRequest(CResource self, int n) -> CRcRequest

◆ UnlockLocalRequests()

def UnlockLocalRequests (   self)
UnlockLocalRequests(CResource self)

◆ ValueState()

def ValueState (   self)
    ValueState(CResource self) -> CRcValueState
    Get the current value and state of the resource.

◆ Value()

def Value (   self)
Get a value ('None' if invalid) of this resource (use ValueState() to get the complete value and state).

◆ ValidValue()

def ValidValue (   self,
  defaultVal 
)
Get a valid value of this resource (use ValueState() to get the complete value and state).

◆ SetRequest()

def SetRequest (   self,
  reqDef = None,
  attrs = None,
  value = None,
  id = None,
  priority = None,
  t0 = None,
  t1 = None,
  repeat = None,
  hysteresis = None,
  delDelay = None 
)
Set or delete a request with selected attributes.

This method allows to set any subset of attributes in a flexible way, either by (named) function arguments
or by a textual description as accepted by the Home2L Shell or CRcRequest::SetFromStr().

If the effective value is 'None' (no value is passed), the call will delete the request with
the specified ID passing 'delDelay' as the 't1' argument of DelRequest().

See RcSetRequest() for a detailed explanation of the arguments and examples.

◆ SetTrigger()

def SetTrigger (   self,
  attrs = None,
  id = None,
  priority = None,
  t0 = None,
  t1 = None,
  repeat = None,
  hysteresis = None 
)
Set a request for a trigger resource with selected attributes.

◆ DelRequest()

def DelRequest (   self,
  reqId = None,
  t1 = None 
)
Delete a request by its ID.

◆ ReportValue()

def ReportValue (   self,
  value,
  state = rcsValid 
)
Report a new value and optionally its state. If '_value == None', 'ReportUnknown()' is called.