cstatevariable.h File Reference

#include <cybergarage/typedef.h>
#include <cybergarage/xml/cxml.h>
#include <cybergarage/util/clist.h>
#include <cybergarage/util/cstring.h>
#include <cybergarage/upnp/cupnp_status.h>

Data Structures

struct  _CgUpnpStateVariable

Defines

#define CG_UPNP_STATEVARIABLE_ELEM_NAME   "stateVariable"
#define CG_UPNP_SERVICESTATETALBE_ELEM_NAME   "serviceStateTable"
#define CG_UPNP_STATEVARIABLE_NAME   "name"
#define CG_UPNP_STATEVARIABLE_DATATYPE   "dataType"
#define CG_UPNP_STATEVARIABLE_SENDEVENTS   "sendEvents"
#define CG_UPNP_STATEVARIABLE_SENDEVENTS_YES   "yes"
#define CG_UPNP_STATEVARIABLE_SENDEVENTS_NO   "no"
#define cg_upnp_statevariable_next(statVar)   (CgUpnpStateVariable *)cg_list_next((CgList *)statVar)
#define cg_upnp_statevariable_isstatevariablenode(node)   cg_xml_node_isname(node, CG_UPNP_STATEVARIABLE_ELEM_NAME)
#define cg_upnp_statevariable_getstatevariablenode(statVar)   (statVar->stateVarNode)
#define cg_upnp_statevariable_setservice(statVar, service)   (statVar->parentService = service)
#define cg_upnp_statevariable_getservice(statVar)   ((CgUpnpService *)statVar->parentService)
#define cg_upnp_statevariable_getallowedvaluelist(statVar)   (statVar->allowedValueList)
#define cg_upnp_statevariable_hasallowedvaluelist(statVar)   cg_upnp_allowedvaluelist_size(statVar->allowedValueList)
#define cg_upnp_statevariable_getallowedvaluerange(statVar)   (statVar->allowedValueRange)
#define cg_upnp_statevariable_hasallowedvaluerange(statVar)   ((statVar->allowedValueRange != NULL) ? TRUE : FALSE)
#define cg_upnp_statevariable_setname(statVar, value)   cg_xml_node_setchildnode(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_NAME, value)
#define cg_upnp_statevariable_getname(statVar)   cg_xml_node_getchildnodevalue(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_NAME)
#define cg_upnp_statevariable_isname(statVar, name)   cg_streq(cg_upnp_statevariable_getname(statVar), name)
#define cg_upnp_statevariable_setdatatype(statVar, value)   cg_xml_node_setchildnode(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_DATATYPE, value)
#define cg_upnp_statevariable_getdatatype(statVar)   cg_xml_node_getchildnodevalue(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_DATATYPE)
#define cg_upnp_statevariable_setsendevents(statVar, value)   cg_xml_node_setattribute(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_SENDEVENTS, value)
#define cg_upnp_statevariable_getsendevents(statVar)   cg_xml_node_getattributevalue(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_SENDEVENTS)
#define cg_upnp_statevariable_issendevents(statVar)   (cg_streq(cg_upnp_statevariable_getsendevents(statVar), CG_UPNP_STATEVARIABLE_SENDEVENTS_YES))
#define cg_upnp_statevariable_getvalue(statVar)   cg_string_getvalue(statVar->value)
#define cg_upnp_statevariable_setlistener(statVar, func)   (statVar->listener = func)
#define cg_upnp_statevariable_getlistener(statVar)   (statVar->listener)
#define cg_upnp_statevariable_setstatuscode(statVar, code)   cg_upnp_status_setcode(statVar->upnpStatus, code)
#define cg_upnp_statevariable_getstatuscode(statVar)   cg_upnp_status_getcode(statVar->upnpStatus)
#define cg_upnp_statevariable_setstatusdescription(statVar, value)   cg_upnp_status_setdescription(statVar->upnpStatus, value)
#define cg_upnp_statevariable_getstatusdescription(statVar)   cg_upnp_status_getdescription(statVar->upnpStatus)
#define cg_upnp_statevariable_setuserdata(statVar, value)   (statVar->userData = value)
#define cg_upnp_statevariable_getuserdata(statVar)   (statVar->userData)
#define cg_upnp_servicestatetable_clear(stateTable)   cg_list_clear((CgList *)stateTable, (CG_LIST_DESTRUCTORFUNC)cg_upnp_statevariable_delete)
#define cg_upnp_servicestatetable_size(stateTable)   cg_list_size((CgList *)stateTable)
#define cg_upnp_servicestatetable_gets(stateTable)   (CgUpnpStateVariable *)cg_list_next((CgList *)stateTable)
#define cg_upnp_servicestatetable_add(stateTable, statVar)   cg_list_add((CgList *)stateTable, (CgList *)statVar)

Typedefs

typedef _CgUpnpStateVariable CgUpnpStateVariable
typedef _CgUpnpStateVariable CgUpnpServiceStateTable
typedef BOOL(*) CG_UPNP_STATEVARIABLE_LISTNER (CgUpnpStateVariable *)

Functions

CgUpnpStateVariablecg_upnp_statevariable_new ()
void cg_upnp_statevariable_delete (CgUpnpStateVariable *statVar)
void cg_upnp_statevariable_setstatevariablenode (CgUpnpStateVariable *statVar, CgXmlNode *node)
void cg_upnp_statevariable_setvalue (CgUpnpStateVariable *statVar, char *data)
CgUpnpServiceStateTablecg_upnp_servicestatetable_new ()
void cg_upnp_servicestatetable_delete (CgUpnpServiceStateTable *servicestatetable)

Define Documentation

#define cg_upnp_servicestatetable_add ( stateTable,
statVar   )     cg_list_add((CgList *)stateTable, (CgList *)statVar)

Add new service state table into service state table list

Parameters:
stateTable Service state table
statVar State variable

#define cg_upnp_servicestatetable_clear ( stateTable   )     cg_list_clear((CgList *)stateTable, (CG_LIST_DESTRUCTORFUNC)cg_upnp_statevariable_delete)

Clear service state table

Parameters:
stateTable Service state table

#define cg_upnp_servicestatetable_gets ( stateTable   )     (CgUpnpStateVariable *)cg_list_next((CgList *)stateTable)

Get next service state table from service state table list

Parameters:
stateTable Service state table
Returns:
Service state table (node)

#define cg_upnp_servicestatetable_size ( stateTable   )     cg_list_size((CgList *)stateTable)

Get size of service state table

Parameters:
stateTable Service state table

#define CG_UPNP_SERVICESTATETALBE_ELEM_NAME   "serviceStateTable"

Definition for service state table XML element name

#define CG_UPNP_STATEVARIABLE_DATATYPE   "dataType"

Definition for state variable data type element

#define CG_UPNP_STATEVARIABLE_ELEM_NAME   "stateVariable"

Definition for state variable XML element name

#define cg_upnp_statevariable_getallowedvaluelist ( statVar   )     (statVar->allowedValueList)

Get allowed value list

Parameters:
statVar State variable
Returns:
Allowed value list

#define cg_upnp_statevariable_getallowedvaluerange ( statVar   )     (statVar->allowedValueRange)

Get allowed value range for state variable

Parameters:
statVar State variable
Returns:
Allowed value range

#define cg_upnp_statevariable_getdatatype ( statVar   )     cg_xml_node_getchildnodevalue(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_DATATYPE)

Get data type from state variable

Parameters:
statVar State variable
Returns:
Data type

#define cg_upnp_statevariable_getlistener ( statVar   )     (statVar->listener)

Get lister function associated with state variable

Parameters:
statVar State variable

#define cg_upnp_statevariable_getname ( statVar   )     cg_xml_node_getchildnodevalue(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_NAME)

Get state variable name

Parameters:
statVar State variable
Returns:
State variable name

#define cg_upnp_statevariable_getsendevents ( statVar   )     cg_xml_node_getattributevalue(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_SENDEVENTS)

Get state variable event sending option value

Parameters:
statVar State variable
Returns:
Current value associated to state variable

#define cg_upnp_statevariable_getservice ( statVar   )     ((CgUpnpService *)statVar->parentService)

Get service from state variable

Parameters:
statVar State variable
Returns:
UPnP service

#define cg_upnp_statevariable_getstatevariablenode ( statVar   )     (statVar->stateVarNode)

Get XML node from this state variable

Parameters:
statVar State variable

#define cg_upnp_statevariable_getstatuscode ( statVar   )     cg_upnp_status_getcode(statVar->upnpStatus)

Get status code of this state variable

Parameters:
statVar Status variable

#define cg_upnp_statevariable_getstatusdescription ( statVar   )     cg_upnp_status_getdescription(statVar->upnpStatus)

Get status description from this state variable

Parameters:
statVar State variable

#define cg_upnp_statevariable_getuserdata ( statVar   )     (statVar->userData)

Get user data from this state variable

Parameters:
statVar State variable
Returns:
User data

#define cg_upnp_statevariable_getvalue ( statVar   )     cg_string_getvalue(statVar->value)

Get value associated with this state variable

Parameters:
statVar State variable
Returns:
Value associated with this state variable

#define cg_upnp_statevariable_hasallowedvaluelist ( statVar   )     cg_upnp_allowedvaluelist_size(statVar->allowedValueList)

Check if state variable has allowed value list

Parameters:
statVar State variable
Returns:
0 if it does not have allowed value list integer greater than zero otherwise

#define cg_upnp_statevariable_hasallowedvaluerange ( statVar   )     ((statVar->allowedValueRange != NULL) ? TRUE : FALSE)

Checks if state variable has allowed variable range

Parameters:
statVar State variable
Returns:
True if allowed value range exists, false otherwise

#define cg_upnp_statevariable_isname ( statVar,
name   )     cg_streq(cg_upnp_statevariable_getname(statVar), name)

Checks if state variable has certain name

Parameters:
statVar State variable
name Name to be checked
Returns:
True if State variable name is same as provided, false otherwise

#define cg_upnp_statevariable_issendevents ( statVar   )     (cg_streq(cg_upnp_statevariable_getsendevents(statVar), CG_UPNP_STATEVARIABLE_SENDEVENTS_YES))

Check if events are sent to subscribers when this state variable changes

Parameters:
statVar State variable
Returns:
True if events are sent, false otherwise

#define cg_upnp_statevariable_isstatevariablenode ( node   )     cg_xml_node_isname(node, CG_UPNP_STATEVARIABLE_ELEM_NAME)

Check if XML node is state variable node

Parameters:
node XML node

#define CG_UPNP_STATEVARIABLE_NAME   "name"

Definition for state variable name element

#define cg_upnp_statevariable_next ( statVar   )     (CgUpnpStateVariable *)cg_list_next((CgList *)statVar)

Get next element from state variable list

Parameters:
statVar state variable list node

#define CG_UPNP_STATEVARIABLE_SENDEVENTS   "sendEvents"

Definition for state variable send events element name

#define CG_UPNP_STATEVARIABLE_SENDEVENTS_NO   "no"

Definition for state variable send events element value

#define CG_UPNP_STATEVARIABLE_SENDEVENTS_YES   "yes"

Definition for state variable send events element value

#define cg_upnp_statevariable_setdatatype ( statVar,
value   )     cg_xml_node_setchildnode(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_DATATYPE, value)

Set data type for state variable

Parameters:
statVar State variable
value Data type

#define cg_upnp_statevariable_setlistener ( statVar,
func   )     (statVar->listener = func)

Set listener callback for this state variable

Parameters:
statVar State variable
func Listener function

#define cg_upnp_statevariable_setname ( statVar,
value   )     cg_xml_node_setchildnode(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_NAME, value)

Set state variable name

Parameters:
statVar State variable
value New state variable name

#define cg_upnp_statevariable_setsendevents ( statVar,
value   )     cg_xml_node_setattribute(cg_upnp_statevariable_getstatevariablenode(statVar), CG_UPNP_STATEVARIABLE_SENDEVENTS, value)

Set send events option for state variable, can be used to disable eventing for certain variables.

Parameters:
statVar State variable
value New value

#define cg_upnp_statevariable_setservice ( statVar,
service   )     (statVar->parentService = service)

Set service for this state variable

Parameters:
statVar State variable
service Service

#define cg_upnp_statevariable_setstatuscode ( statVar,
code   )     cg_upnp_status_setcode(statVar->upnpStatus, code)

Set status code for state variable

Parameters:
statVar State variable
code Status code

#define cg_upnp_statevariable_setstatusdescription ( statVar,
value   )     cg_upnp_status_setdescription(statVar->upnpStatus, value)

Set status description for state variable

Parameters:
statVar State variable
value Status description

#define cg_upnp_statevariable_setuserdata ( statVar,
value   )     (statVar->userData = value)

Set arbitrary user data associated with this state variable

Parameters:
statVar State variable
value Data


Typedef Documentation

typedef BOOL(*) CG_UPNP_STATEVARIABLE_LISTNER(CgUpnpStateVariable *)

Type definition for state variable listener function

typedef struct _CgUpnpStateVariable CgUpnpServiceStateTable

Data type for state variable and state table

typedef struct _CgUpnpStateVariable CgUpnpStateVariable

Data type for state variable and state table


Function Documentation

void cg_upnp_servicestatetable_delete ( CgUpnpServiceStateTable servicestatetable  ) 

Delete service state table object

Parameters:
servicestatetable Service state table

CgUpnpServiceStateTable* cg_upnp_servicestatetable_new (  ) 

Create service state table object

void cg_upnp_statevariable_delete ( CgUpnpStateVariable statVar  ) 

Delete state variable object

Parameters:
statVar state variable

CgUpnpStateVariable* cg_upnp_statevariable_new (  ) 

Create new state variable object

void cg_upnp_statevariable_setstatevariablenode ( CgUpnpStateVariable statVar,
CgXmlNode node 
)

Set XML node for this state variable

Parameters:
statVar State variable
node XML node

void cg_upnp_statevariable_setvalue ( CgUpnpStateVariable statVar,
char *  data 
)

Set state variable value

Parameters:
statVar State variable
data New value associated with this state variable


Generated on Tue Aug 8 14:56:29 2006 for CyberLinkC by  doxygen 1.4.7