Added a context variable in basic object data structure and API to get or set the context pointer. (#1111)
This commit is contained in:
@@ -36,6 +36,7 @@ struct object_data {
|
||||
char *Object_Name;
|
||||
char *Pathname;
|
||||
char *File_Type;
|
||||
void *Context;
|
||||
BACNET_DATE_TIME Modification_Date;
|
||||
bool File_Access_Stream : 1;
|
||||
bool Read_Only : 1;
|
||||
@@ -1148,6 +1149,38 @@ bool bacfile_read_ack_record_data(
|
||||
return found;
|
||||
}
|
||||
|
||||
/**
|
||||
* @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 *bacfile_create_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 bacfile_create_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 File object
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
Reference in New Issue
Block a user