Added a context variable in basic object data structure and API to get or set the context pointer. (#1111)
This commit is contained in:
@@ -33,6 +33,7 @@ struct object_data {
|
||||
/* The state text functions expect a list of C strings separated by '\0' */
|
||||
const char *State_Text;
|
||||
const char *Description;
|
||||
void *Context;
|
||||
};
|
||||
/* Key List for storing the object data sorted by instance number */
|
||||
static OS_Keylist Object_List;
|
||||
@@ -951,6 +952,38 @@ void Multistate_Input_Write_Disable(uint32_t object_instance)
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the context used with a specific object instance
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @param context [in] pointer to the context
|
||||
*/
|
||||
void *Multistate_Input_Context_Get(uint32_t object_instance)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
return pObject->Context;
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Set the context used with a specific object instance
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @param context [in] pointer to the context
|
||||
*/
|
||||
void Multistate_Input_Context_Set(uint32_t object_instance, void *context)
|
||||
{
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
pObject->Context = context;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Creates a new object and adds it to the object list
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
Reference in New Issue
Block a user