Added object-name c-string getter function to basic objects so they can be referenced to free if dynamically created. (#754)
* Added basic object-name get for ASCII names to enable free if they were dynamically created. Added unit testing to validate the basic object ASCII object-name API. * Removed static scope on character array used for name since the array gets copied into characterstring array and static is not needed.
This commit is contained in:
@@ -134,7 +134,7 @@ unsigned Accumulator_Instance_To_Index(uint32_t object_instance)
|
||||
bool Accumulator_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32]; /* okay for single thread */
|
||||
char text[32];
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCUMULATORS) {
|
||||
|
||||
@@ -119,7 +119,7 @@ unsigned Access_Credential_Instance_To_Index(uint32_t object_instance)
|
||||
bool Access_Credential_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_CREDENTIALS) {
|
||||
|
||||
@@ -256,7 +256,7 @@ static int Access_Door_Priority_Array_Encode(
|
||||
bool Access_Door_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_DOORS) {
|
||||
|
||||
@@ -122,7 +122,7 @@ unsigned Access_Point_Instance_To_Index(uint32_t object_instance)
|
||||
bool Access_Point_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_POINTS) {
|
||||
|
||||
@@ -114,7 +114,7 @@ unsigned Access_Rights_Instance_To_Index(uint32_t object_instance)
|
||||
bool Access_Rights_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_RIGHTSS) {
|
||||
|
||||
@@ -111,7 +111,7 @@ unsigned Access_User_Instance_To_Index(uint32_t object_instance)
|
||||
bool Access_User_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_USERS) {
|
||||
|
||||
@@ -116,7 +116,7 @@ unsigned Access_Zone_Instance_To_Index(uint32_t object_instance)
|
||||
bool Access_Zone_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCESS_ZONES) {
|
||||
|
||||
@@ -233,7 +233,7 @@ void Analog_Input_Present_Value_Set(uint32_t object_instance, float value)
|
||||
bool Analog_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[32] = "";
|
||||
char text_string[32] = "";
|
||||
bool status = false;
|
||||
struct analog_input_descr *pObject;
|
||||
|
||||
@@ -275,6 +275,24 @@ bool Analog_Input_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Analog_Input_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct analog_input_descr *pObject;
|
||||
|
||||
pObject = Analog_Input_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, gets the event-state property value
|
||||
*
|
||||
|
||||
@@ -86,6 +86,9 @@ extern "C" {
|
||||
bool Analog_Input_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char * Analog_Input_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Analog_Input_Description(
|
||||
|
||||
@@ -514,7 +514,7 @@ bool Analog_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -522,6 +522,24 @@ bool Analog_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Analog_Output_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the units property value
|
||||
*
|
||||
@@ -751,7 +769,7 @@ bool Analog_Output_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -105,6 +105,9 @@ extern "C" {
|
||||
bool Analog_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char * Analog_Output_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Analog_Output_Description(
|
||||
|
||||
@@ -245,7 +245,7 @@ bool Analog_Value_Present_Value_Set(
|
||||
bool Analog_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[32] = "";
|
||||
char text_string[32] = "";
|
||||
bool status = false;
|
||||
struct analog_value_descr *pObject;
|
||||
|
||||
@@ -287,6 +287,24 @@ bool Analog_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Analog_Value_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct analog_value_descr *pObject;
|
||||
|
||||
pObject = Analog_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, gets the event-state property value
|
||||
*
|
||||
|
||||
@@ -33,7 +33,7 @@ typedef struct analog_value_descr {
|
||||
float Prior_Value;
|
||||
float COV_Increment;
|
||||
bool Changed;
|
||||
char* Object_Name;
|
||||
const char* Object_Name;
|
||||
char* Description;
|
||||
BACNET_RELIABILITY Reliability;
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
@@ -83,7 +83,8 @@ extern "C" {
|
||||
bool Analog_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
char *Analog_Value_Name(
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Analog_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
#define FILE_RECORD_SIZE MAX_OCTET_STRING_BYTES
|
||||
#endif
|
||||
struct object_data {
|
||||
char *Object_Name;
|
||||
const char *Object_Name;
|
||||
char *Pathname;
|
||||
BACNET_DATE_TIME Modification_Date;
|
||||
char *File_Type;
|
||||
@@ -206,7 +206,7 @@ bool bacfile_object_name_set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -214,6 +214,25 @@ bool bacfile_object_name_set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *bacfile_name_ansi(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @brief Determines if a given object instance is valid
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
@@ -29,6 +29,7 @@ extern "C" {
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_object_name(
|
||||
uint32_t object_instance,
|
||||
@@ -38,6 +39,10 @@ extern "C" {
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char * bacfile_name_ansi(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool bacfile_valid_instance(
|
||||
uint32_t object_instance);
|
||||
BACNET_STACK_EXPORT
|
||||
|
||||
@@ -581,7 +581,7 @@ static bool Binary_Input_Present_Value_Write(
|
||||
bool Binary_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -614,15 +614,31 @@ bool Binary_Input_Name_Set(uint32_t object_instance, char *new_name)
|
||||
|
||||
pObject = Binary_Input_Object(object_instance);
|
||||
if (pObject) {
|
||||
if (new_name) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Binary_Input_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Binary_Input_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, returns the polarity property.
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
@@ -69,6 +69,9 @@ extern "C" {
|
||||
bool Binary_Input_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Input_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_BINARY_PV Binary_Input_Present_Value(
|
||||
|
||||
@@ -467,15 +467,31 @@ bool BitString_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
|
||||
pObject = BitString_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
if (new_name) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *BitString_Value_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = BitString_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, return the description.
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
@@ -77,6 +77,9 @@ extern "C" {
|
||||
bool BitString_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *BitString_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool BitString_Value_Present_Value(
|
||||
|
||||
@@ -793,7 +793,7 @@ bool Binary_Lighting_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -801,6 +801,24 @@ bool Binary_Lighting_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Binary_Lighting_Output_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
@@ -840,7 +858,7 @@ bool Binary_Lighting_Output_Description_Set(
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -85,6 +85,8 @@ bool Binary_Lighting_Output_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Binary_Lighting_Output_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Lighting_Output_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Binary_Lighting_Output_Description(uint32_t instance);
|
||||
|
||||
@@ -543,7 +543,7 @@ bool Binary_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -551,6 +551,24 @@ bool Binary_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Binary_Output_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the polarity property.
|
||||
*
|
||||
@@ -776,7 +794,7 @@ bool Binary_Output_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -67,6 +67,9 @@ extern "C" {
|
||||
bool Binary_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Binary_Output_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Binary_Output_Inactive_Text(
|
||||
|
||||
@@ -584,7 +584,7 @@ static bool Binary_Value_Present_Value_Write(
|
||||
bool Binary_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
|
||||
@@ -617,15 +617,31 @@ bool Binary_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
|
||||
pObject = Binary_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
if (new_name) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Binary_Value_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Binary_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, returns the polarity property.
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
@@ -73,7 +73,7 @@ extern "C" {
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Binary_Value_Name(
|
||||
const char *Binary_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
|
||||
@@ -409,7 +409,7 @@ bool Calendar_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -417,6 +417,24 @@ bool Calendar_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Calendar_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
|
||||
@@ -48,6 +48,8 @@ bool Calendar_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Calendar_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Calendar_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Calendar_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
@@ -1322,7 +1322,7 @@ bool Channel_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -1330,6 +1330,24 @@ bool Channel_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Channel_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the out-of-service
|
||||
* property value
|
||||
|
||||
@@ -120,6 +120,8 @@ bool Channel_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Channel_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Channel_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Channel_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
@@ -714,7 +714,7 @@ bool Color_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
pObject->Object_Name = new_name;
|
||||
status = true;
|
||||
}
|
||||
@@ -722,6 +722,24 @@ bool Color_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name ANSI-C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Color_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
@@ -760,7 +778,7 @@ bool Color_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -49,6 +49,8 @@ bool Color_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Color_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Color_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
@@ -951,7 +951,7 @@ bool Color_Temperature_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -959,6 +959,24 @@ bool Color_Temperature_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Color_Temperature_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
@@ -997,7 +1015,7 @@ bool Color_Temperature_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -46,6 +46,8 @@ bool Color_Temperature_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Color_Temperature_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Color_Temperature_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Color_Temperature_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
@@ -296,7 +296,7 @@ bool Command_All_Writes_Successful_Set(uint32_t object_instance, bool value)
|
||||
bool Command_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
unsigned int index;
|
||||
bool status = false;
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ unsigned Credential_Data_Input_Instance_To_Index(uint32_t object_instance)
|
||||
bool Credential_Data_Input_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_CREDENTIAL_DATA_INPUTS) {
|
||||
|
||||
+106
-19
@@ -43,8 +43,8 @@ struct integer_object {
|
||||
uint32_t COV_Increment;
|
||||
uint16_t Units;
|
||||
uint32_t Instance;
|
||||
BACNET_CHARACTER_STRING Name;
|
||||
BACNET_CHARACTER_STRING Description;
|
||||
const char *Object_Name;
|
||||
const char *Description;
|
||||
} INTERGER_VALUE_DESCR;
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
@@ -233,22 +233,65 @@ bool Integer_Value_Present_Value_Set(
|
||||
bool Integer_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
struct integer_object *pObject;
|
||||
|
||||
struct integer_object *pObject = Integer_Value_Object(object_instance);
|
||||
|
||||
if (!object_name) {
|
||||
return false;
|
||||
}
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
*object_name = pObject->Name;
|
||||
status = true;
|
||||
if (pObject->Object_Name) {
|
||||
status =
|
||||
characterstring_init_ansi(object_name, pObject->Object_Name);
|
||||
} else {
|
||||
snprintf(
|
||||
text, sizeof(text), "INTEGER-VALUE-%lu",
|
||||
(unsigned long)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text);
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, sets the object-name
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param new_name - holds the object-name to be set
|
||||
* @return true if object-name was set
|
||||
*/
|
||||
bool Integer_Value_Name_Set(uint32_t object_instance,
|
||||
const char *new_name)
|
||||
{
|
||||
bool status = false;
|
||||
struct integer_object *pObject;
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Integer_Value_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct integer_object *pObject;
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, return the description.
|
||||
*
|
||||
@@ -263,20 +306,64 @@ bool Integer_Value_Description(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *description)
|
||||
{
|
||||
bool status = false;
|
||||
struct integer_object *pObject = Integer_Value_Object(object_instance);
|
||||
|
||||
if (!description) {
|
||||
return false;
|
||||
}
|
||||
struct integer_object *pObject;
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
*description = pObject->Description;
|
||||
return true;
|
||||
if (pObject->Description) {
|
||||
status = characterstring_init_ansi(description,
|
||||
pObject->Description);
|
||||
} else {
|
||||
status = characterstring_init_ansi(description, "");
|
||||
}
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, sets the description
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param new_name - holds the description to be set
|
||||
* @return true if object-name was set
|
||||
*/
|
||||
bool Integer_Value_Description_Set(uint32_t object_instance,
|
||||
const char *new_name)
|
||||
{
|
||||
bool status = false; /* return value */
|
||||
struct integer_object *pObject;
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, returns the description
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @return description text or NULL if not found
|
||||
*/
|
||||
char *Integer_Value_Description_ANSI(uint32_t object_instance)
|
||||
{
|
||||
char *name = NULL;
|
||||
struct integer_object *pObject;
|
||||
|
||||
pObject = Integer_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
if (pObject->Description == NULL) {
|
||||
name = "";
|
||||
} else {
|
||||
name = (char *)pObject->Description;
|
||||
}
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the units property value
|
||||
*
|
||||
@@ -643,8 +730,8 @@ uint32_t Integer_Value_Create(uint32_t object_instance)
|
||||
return BACNET_MAX_INSTANCE;
|
||||
}
|
||||
|
||||
characterstring_init_ansi(&pObject->Name, "");
|
||||
characterstring_init_ansi(&pObject->Description, "");
|
||||
pObject->Object_Name = NULL;
|
||||
pObject->Description = NULL;
|
||||
pObject->COV_Increment = 1;
|
||||
pObject->Present_Value = 0;
|
||||
pObject->Prior_Value = 0;
|
||||
|
||||
@@ -42,6 +42,13 @@ extern "C" {
|
||||
bool Integer_Value_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Integer_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Integer_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Integer_Value_Read_Property(
|
||||
@@ -78,7 +85,6 @@ extern "C" {
|
||||
uint32_t object_instance,
|
||||
uint32_t value);
|
||||
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
bool Integer_Value_Description(
|
||||
uint32_t object_instance,
|
||||
@@ -86,7 +92,10 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
bool Integer_Value_Description_Set(
|
||||
uint32_t instance,
|
||||
char *new_name);
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
char *Integer_Value_Description_ANSI(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint16_t Integer_Value_Units(
|
||||
|
||||
@@ -266,15 +266,31 @@ bool Load_Control_Name_Set(uint32_t object_instance, char *new_name)
|
||||
|
||||
pObject = Object_Instance_Data(object_instance);
|
||||
if (pObject) {
|
||||
if (new_name) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Load_Control_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Object_Instance_Data(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief convert the shed level request into a percentage of full duty
|
||||
* baseline power
|
||||
|
||||
@@ -93,6 +93,8 @@ bool Load_Control_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Load_Control_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Load_Control_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_SHED_STATE Load_Control_Present_Value(uint32_t object_instance);
|
||||
|
||||
@@ -843,7 +843,7 @@ bool Lighting_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -851,6 +851,24 @@ bool Lighting_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Lighting_Output_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
@@ -889,7 +907,7 @@ bool Lighting_Output_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -100,6 +100,9 @@ extern "C" {
|
||||
bool Lighting_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Lighting_Output_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
char *Lighting_Output_Description(
|
||||
|
||||
@@ -203,6 +203,44 @@ bool Life_Safety_Point_Object_Name(
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, sets the object-name
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param new_name - holds the object-name to be set
|
||||
* @return true if object-name was set
|
||||
*/
|
||||
bool Life_Safety_Point_Name_Set(uint32_t object_instance, const char *new_name)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Life_Safety_Point_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, gets the property value
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
@@ -45,8 +45,10 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
bool Life_Safety_Point_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Life_Safety_Point_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_LIFE_SAFETY_STATE Life_Safety_Point_Present_Value(
|
||||
|
||||
@@ -214,6 +214,44 @@ bool Life_Safety_Zone_Object_Name(
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, sets the object-name
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param new_name - holds the object-name to be set
|
||||
* @return true if object-name was set
|
||||
*/
|
||||
bool Life_Safety_Zone_Name_Set(uint32_t object_instance, const char *new_name)
|
||||
{
|
||||
bool status = false;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Life_Safety_Zone_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, gets the property value
|
||||
* @param object_instance - object-instance number of the object
|
||||
|
||||
@@ -45,8 +45,10 @@ extern "C" {
|
||||
BACNET_STACK_EXPORT
|
||||
bool Life_Safety_Zone_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
|
||||
const char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Life_Safety_Zone_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
BACNET_LIFE_SAFETY_STATE Life_Safety_Zone_Present_Value(
|
||||
|
||||
@@ -488,7 +488,7 @@ bool Multistate_Input_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Multistate_Input_Object(object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -496,6 +496,24 @@ bool Multistate_Input_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Multistate_Input_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Multistate_Input_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, gets the reliability.
|
||||
* @param object_instance - object-instance number of the object
|
||||
@@ -604,7 +622,7 @@ bool Multistate_Input_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Multistate_Input_Object(object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -71,6 +71,9 @@ extern "C" {
|
||||
bool Multistate_Input_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Multistate_Input_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Multistate_Input_Present_Value(
|
||||
|
||||
@@ -605,7 +605,7 @@ bool Multistate_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -613,6 +613,24 @@ bool Multistate_Output_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Multistate_Output_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, returns the state-text in
|
||||
* a C string.
|
||||
@@ -808,7 +826,7 @@ bool Multistate_Output_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -66,6 +66,9 @@ extern "C" {
|
||||
bool Multistate_Output_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Multistate_Output_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Multistate_Output_Present_Value(
|
||||
|
||||
@@ -488,7 +488,7 @@ bool Multistate_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Multistate_Value_Object(object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -496,6 +496,24 @@ bool Multistate_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Multistate_Value_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Multistate_Value_Object(object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief For a given object instance-number, gets the reliability.
|
||||
* @param object_instance - object-instance number of the object
|
||||
@@ -604,7 +622,7 @@ bool Multistate_Value_Description_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Multistate_Value_Object(object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Description = new_name;
|
||||
}
|
||||
|
||||
@@ -70,6 +70,9 @@ extern "C" {
|
||||
bool Multistate_Value_Name_Set(
|
||||
uint32_t object_instance,
|
||||
char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Multistate_Value_Name_ASCII(
|
||||
uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
uint32_t Multistate_Value_Present_Value(
|
||||
|
||||
@@ -129,7 +129,7 @@ unsigned Notification_Class_Instance_To_Index(uint32_t object_instance)
|
||||
bool Notification_Class_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
unsigned int index;
|
||||
bool status = false;
|
||||
|
||||
|
||||
@@ -322,6 +322,7 @@ bool Network_Port_Name_Set(uint32_t object_instance, char *new_name)
|
||||
index = Network_Port_Instance_To_Index(object_instance);
|
||||
if (index < BACNET_NETWORK_PORTS_MAX) {
|
||||
Object_List[index].Object_Name = new_name;
|
||||
status = true;
|
||||
}
|
||||
|
||||
return status;
|
||||
|
||||
@@ -145,7 +145,7 @@ BACNET_OCTET_STRING *OctetString_Value_Present_Value(uint32_t object_instance)
|
||||
bool OctetString_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_OCTETSTRING_VALUES) {
|
||||
|
||||
@@ -146,7 +146,7 @@ uint32_t PositiveInteger_Value_Present_Value(uint32_t object_instance)
|
||||
bool PositiveInteger_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_POSITIVEINTEGER_VALUES) {
|
||||
|
||||
@@ -182,7 +182,7 @@ unsigned Schedule_Instance_To_Index(uint32_t instance)
|
||||
bool Schedule_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
unsigned int index;
|
||||
bool status = false;
|
||||
|
||||
|
||||
@@ -201,7 +201,7 @@ bool Structured_View_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -209,6 +209,24 @@ bool Structured_View_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Structured_View_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
|
||||
@@ -50,6 +50,8 @@ bool Structured_View_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Structured_View_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Structured_View_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Structured_View_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
@@ -348,7 +348,7 @@ bool Time_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject && new_name) {
|
||||
if (pObject) {
|
||||
status = true;
|
||||
pObject->Object_Name = new_name;
|
||||
}
|
||||
@@ -356,6 +356,25 @@ bool Time_Value_Name_Set(uint32_t object_instance, char *new_name)
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Return the object name C string
|
||||
* @param object_instance [in] BACnet object instance number
|
||||
* @return object name or NULL if not found
|
||||
*/
|
||||
const char *Time_Value_Name_ASCII(uint32_t object_instance)
|
||||
{
|
||||
const char *name = NULL;
|
||||
struct object_data *pObject;
|
||||
|
||||
pObject = Keylist_Data(Object_List, object_instance);
|
||||
if (pObject) {
|
||||
name = pObject->Object_Name;
|
||||
}
|
||||
|
||||
return name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* For a given object instance-number, returns the description
|
||||
*
|
||||
|
||||
@@ -48,6 +48,8 @@ bool Time_Value_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name);
|
||||
BACNET_STACK_EXPORT
|
||||
bool Time_Value_Name_Set(uint32_t object_instance, char *new_name);
|
||||
BACNET_STACK_EXPORT
|
||||
const char *Time_Value_Name_ASCII(uint32_t object_instance);
|
||||
|
||||
BACNET_STACK_EXPORT
|
||||
int Time_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
|
||||
@@ -230,7 +230,7 @@ void Trend_Log_Init(void)
|
||||
bool Trend_Log_Object_Name(
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text[32] = ""; /* okay for single thread */
|
||||
char text[32] = "";
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_TREND_LOGS) {
|
||||
|
||||
@@ -40,6 +40,10 @@ static void testAnalogInput(void)
|
||||
OBJECT_ANALOG_INPUT, object_instance, Analog_Input_Property_Lists,
|
||||
Analog_Input_Read_Property, Analog_Input_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Analog_Input_Name_Set,
|
||||
Analog_Input_Name_ASCII);
|
||||
status = Analog_Input_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ static void testAnalogOutput(void)
|
||||
bool status = false;
|
||||
unsigned count = 0;
|
||||
uint32_t object_instance = BACNET_MAX_INSTANCE, test_object_instance = 0;
|
||||
const int skip_fail_property_list[] = { PROP_PRIORITY_ARRAY, -1 };
|
||||
const int skip_fail_property_list[] = { -1 };
|
||||
|
||||
Analog_Output_Init();
|
||||
object_instance = Analog_Output_Create(object_instance);
|
||||
@@ -40,6 +40,10 @@ static void testAnalogOutput(void)
|
||||
OBJECT_ANALOG_OUTPUT, object_instance, Analog_Output_Property_Lists,
|
||||
Analog_Output_Read_Property, Analog_Output_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Analog_Output_Name_Set,
|
||||
Analog_Output_Name_ASCII);
|
||||
status = Analog_Output_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ static void testAnalog_Value(void)
|
||||
OBJECT_ANALOG_VALUE, object_instance, Analog_Value_Property_Lists,
|
||||
Analog_Value_Read_Property, Analog_Value_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Analog_Value_Name_Set,
|
||||
Analog_Value_Name_ASCII);
|
||||
status = Analog_Value_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ static void testBinaryInput(void)
|
||||
OBJECT_BINARY_INPUT, object_instance, Binary_Input_Property_Lists,
|
||||
Binary_Input_Read_Property, Binary_Input_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Binary_Input_Name_Set,
|
||||
Binary_Input_Name_ASCII);
|
||||
status = Binary_Input_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -52,6 +52,10 @@ static void test_BitString_Value_Object(void)
|
||||
OBJECT_BINARY_INPUT, instance, BitString_Value_Property_Lists,
|
||||
BitString_Value_Read_Property, BitString_Value_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
instance,
|
||||
BitString_Value_Name_Set,
|
||||
BitString_Value_Name_ASCII);
|
||||
/* test specific WriteProperty values */
|
||||
BitString_Value_Write_Disable(instance);
|
||||
status = BitString_Value_Write_Enabled(instance);
|
||||
|
||||
@@ -36,6 +36,8 @@ static void testBinaryLightingOutput(void)
|
||||
uint32_t test_instance = 0;
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Binary_Lighting_Output_Init();
|
||||
test_instance = Binary_Lighting_Output_Create(instance);
|
||||
@@ -129,6 +131,15 @@ static void testBinaryLightingOutput(void)
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
status = Binary_Lighting_Output_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Binary_Lighting_Output_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Binary_Lighting_Output_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Binary_Lighting_Output_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Binary_Lighting_Output_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* check the delete function */
|
||||
status = Binary_Lighting_Output_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
@@ -40,6 +40,10 @@ static void testBinaryOutput(void)
|
||||
OBJECT_BINARY_OUTPUT, object_instance, Binary_Output_Property_Lists,
|
||||
Binary_Output_Read_Property, Binary_Output_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Binary_Output_Name_Set,
|
||||
Binary_Output_Name_ASCII);
|
||||
status = Binary_Output_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -42,6 +42,10 @@ static void testBinary_Value(void)
|
||||
OBJECT_BINARY_VALUE, object_instance, Binary_Value_Property_Lists,
|
||||
Binary_Value_Read_Property, Binary_Value_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Binary_Value_Name_Set,
|
||||
Binary_Value_Name_ASCII);
|
||||
status = Binary_Value_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -37,6 +37,8 @@ static void testCalendar(void)
|
||||
uint32_t test_instance = 0;
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Calendar_Init();
|
||||
test_instance = Calendar_Create(instance);
|
||||
@@ -127,6 +129,15 @@ static void testCalendar(void)
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
status = Calendar_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Calendar_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Calendar_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Calendar_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Calendar_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* check the delete function */
|
||||
status = Calendar_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
@@ -34,6 +34,8 @@ static void test_Channel_ReadProperty(void)
|
||||
unsigned count = 0;
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Channel_Init();
|
||||
Channel_Create(instance);
|
||||
@@ -126,12 +128,23 @@ static void test_Channel_ReadProperty(void)
|
||||
}
|
||||
pOptional++;
|
||||
}
|
||||
/* check for unsupported property - use ALL */
|
||||
rpdata.object_property = PROP_ALL;
|
||||
len = Channel_Read_Property(&rpdata);
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
wpdata.object_property = PROP_ALL;
|
||||
status = Channel_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Channel_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Channel_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Channel_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Channel_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* cleanup */
|
||||
status = Channel_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -36,6 +36,8 @@ static void testColorObject(void)
|
||||
BACNET_WRITE_PROPERTY_DATA wpdata = { 0 };
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Color_Init();
|
||||
Color_Create(instance);
|
||||
@@ -119,12 +121,23 @@ static void testColorObject(void)
|
||||
}
|
||||
pOptional++;
|
||||
}
|
||||
/* check for unsupported property - use ALL */
|
||||
rpdata.object_property = PROP_ALL;
|
||||
len = Color_Read_Property(&rpdata);
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
wpdata.object_property = PROP_ALL;
|
||||
status = Color_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Color_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Color_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Color_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Color_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* cleanup */
|
||||
status = Color_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
|
||||
@@ -35,6 +35,8 @@ static void testColorTemperature(void)
|
||||
const uint32_t instance = 123;
|
||||
BACNET_WRITE_PROPERTY_DATA wpdata = { 0 };
|
||||
bool status = false;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Color_Temperature_Init();
|
||||
Color_Temperature_Create(instance);
|
||||
@@ -114,12 +116,23 @@ static void testColorTemperature(void)
|
||||
}
|
||||
pOptional++;
|
||||
}
|
||||
/* check for unsupported property - use ALL */
|
||||
rpdata.object_property = PROP_ALL;
|
||||
len = Color_Temperature_Read_Property(&rpdata);
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
wpdata.object_property = PROP_ALL;
|
||||
status = Color_Temperature_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Color_Temperature_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Color_Temperature_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Color_Temperature_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Color_Temperature_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* cleanup */
|
||||
status = Color_Temperature_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
|
||||
@@ -26,6 +26,8 @@ static void testInteger_Value(void)
|
||||
unsigned count = 0;
|
||||
uint32_t object_instance = BACNET_MAX_INSTANCE, test_object_instance = 0;
|
||||
const int skip_fail_property_list[] = { -1 };
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Integer_Value_Init();
|
||||
object_instance = Integer_Value_Create(object_instance);
|
||||
@@ -37,6 +39,16 @@ static void testInteger_Value(void)
|
||||
OBJECT_INTEGER_VALUE, object_instance, Integer_Value_Property_Lists,
|
||||
Integer_Value_Read_Property, Integer_Value_Write_Property,
|
||||
skip_fail_property_list);
|
||||
/* test the ASCII name get/set */
|
||||
status = Integer_Value_Name_Set(object_instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Integer_Value_Name_ASCII(object_instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Integer_Value_Name_Set(object_instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Integer_Value_Name_ASCII(object_instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* cleanup */
|
||||
status = Integer_Value_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -657,6 +657,10 @@ static void test_Load_Control_Read_Write_Property(void)
|
||||
OBJECT_LOAD_CONTROL, object_instance, Load_Control_Property_Lists,
|
||||
Load_Control_Read_Property, Load_Control_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Load_Control_Name_Set,
|
||||
Load_Control_Name_ASCII);
|
||||
test_teardown(object_instance);
|
||||
}
|
||||
|
||||
|
||||
@@ -38,6 +38,8 @@ static void testLightingOutput(void)
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
uint16_t milliseconds = 10;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Lighting_Output_Init();
|
||||
Lighting_Output_Create(instance);
|
||||
@@ -131,6 +133,15 @@ static void testLightingOutput(void)
|
||||
zassert_false(status, NULL);
|
||||
/* check the dimming/ramping/stepping engine*/
|
||||
Lighting_Output_Timer(instance, milliseconds);
|
||||
/* test the ASCII name get/set */
|
||||
status = Lighting_Output_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Lighting_Output_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Lighting_Output_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Lighting_Output_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* check the delete function */
|
||||
status = Lighting_Output_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
@@ -39,6 +39,8 @@ static void testLifeSafetyPoint(void)
|
||||
BACNET_WRITE_PROPERTY_DATA wpdata = { 0 };
|
||||
bool status = false;
|
||||
unsigned index;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Life_Safety_Point_Init();
|
||||
Life_Safety_Point_Create(instance);
|
||||
@@ -126,12 +128,23 @@ static void testLifeSafetyPoint(void)
|
||||
}
|
||||
pOptional++;
|
||||
}
|
||||
/* check for unsupported property - use ALL */
|
||||
rpdata.object_property = PROP_ALL;
|
||||
len = Life_Safety_Point_Read_Property(&rpdata);
|
||||
zassert_equal(len, BACNET_STATUS_ERROR, NULL);
|
||||
wpdata.object_property = PROP_ALL;
|
||||
status = Life_Safety_Point_Write_Property(&wpdata);
|
||||
zassert_false(status, NULL);
|
||||
/* test the ASCII name get/set */
|
||||
status = Life_Safety_Point_Name_Set(instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Life_Safety_Point_Name_ASCII(instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Life_Safety_Point_Name_Set(instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Life_Safety_Point_Name_ASCII(instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* cleanup */
|
||||
status = Life_Safety_Point_Delete(instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
|
||||
@@ -27,9 +27,12 @@ ZTEST(testsLifeSafetyZone, testLifeSafetyZone)
|
||||
static void testLifeSafetyZone(void)
|
||||
#endif
|
||||
{
|
||||
bool status;
|
||||
unsigned count = 0;
|
||||
uint32_t object_instance = 0, test_object_instance = 0;
|
||||
const int skip_fail_property_list[] = { -1 };
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
Life_Safety_Zone_Init();
|
||||
object_instance = Life_Safety_Zone_Create(BACNET_MAX_INSTANCE);
|
||||
@@ -41,6 +44,18 @@ static void testLifeSafetyZone(void)
|
||||
OBJECT_LIFE_SAFETY_ZONE, object_instance,
|
||||
Life_Safety_Zone_Property_Lists, Life_Safety_Zone_Read_Property,
|
||||
Life_Safety_Zone_Write_Property, skip_fail_property_list);
|
||||
/* test the ASCII name get/set */
|
||||
status = Life_Safety_Zone_Name_Set(object_instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Life_Safety_Zone_Name_ASCII(object_instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = Life_Safety_Zone_Name_Set(object_instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = Life_Safety_Zone_Name_ASCII(object_instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
/* cleanup */
|
||||
status = Life_Safety_Zone_Delete(object_instance);
|
||||
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -41,6 +41,10 @@ static void testMultistateInput(void)
|
||||
OBJECT_MULTI_STATE_INPUT, object_instance,
|
||||
Multistate_Input_Property_Lists, Multistate_Input_Read_Property,
|
||||
Multistate_Input_Write_Property, skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Multistate_Input_Name_Set,
|
||||
Multistate_Input_Name_ASCII);
|
||||
status = Multistate_Input_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -40,6 +40,10 @@ static void testMultistateOutput(void)
|
||||
OBJECT_MULTI_STATE_OUTPUT, object_instance,
|
||||
Multistate_Output_Property_Lists, Multistate_Output_Read_Property,
|
||||
Multistate_Output_Write_Property, skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Multistate_Output_Name_Set,
|
||||
Multistate_Output_Name_ASCII);
|
||||
status = Multistate_Output_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ static void testMultistateValue(void)
|
||||
OBJECT_MULTI_STATE_VALUE, object_instance,
|
||||
Multistate_Value_Property_Lists, Multistate_Value_Read_Property,
|
||||
Multistate_Value_Write_Property, skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Multistate_Value_Name_Set,
|
||||
Multistate_Value_Name_ASCII);
|
||||
status = Multistate_Value_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,10 @@ static void test_network_port(void)
|
||||
OBJECT_NETWORK_PORT, object_instance, Network_Port_Property_Lists,
|
||||
Network_Port_Read_Property, Network_Port_Write_Property,
|
||||
known_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Network_Port_Name_Set,
|
||||
Network_Port_Object_Name_ASCII);
|
||||
port++;
|
||||
}
|
||||
|
||||
|
||||
@@ -40,6 +40,10 @@ static void test_object_structured_view(void)
|
||||
bacnet_object_properties_read_write_test(
|
||||
OBJECT_STRUCTURED_VIEW, instance, Structured_View_Property_Lists,
|
||||
Structured_View_Read_Property, NULL, skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
instance,
|
||||
Structured_View_Name_Set,
|
||||
Structured_View_Name_ASCII);
|
||||
}
|
||||
/**
|
||||
* @}
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
#include <bacnet/rp.h>
|
||||
#include <bacnet/rpm.h>
|
||||
#include <bacnet/wp.h>
|
||||
#include "property_test.h"
|
||||
|
||||
/**
|
||||
* @brief Perform a read/write test on a property
|
||||
@@ -221,3 +222,28 @@ void bacnet_object_properties_read_write_test(
|
||||
zassert_false(status, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @brief Perform a test on the ASCII name of an object
|
||||
* @param object_instance The instance number of the object to test
|
||||
* @param ascii_set The function to set the ASCII name
|
||||
* @param ascii_get The function to get the ASCII name
|
||||
*/
|
||||
void bacnet_object_name_ascii_test(
|
||||
uint32_t object_instance,
|
||||
object_name_ascii_set_function ascii_set,
|
||||
object_name_ascii_function ascii_get)
|
||||
{
|
||||
bool status = false;
|
||||
const char *test_name = NULL;
|
||||
char *sample_name = "sample";
|
||||
|
||||
status = ascii_set(object_instance, sample_name);
|
||||
zassert_true(status, NULL);
|
||||
test_name = ascii_get(object_instance);
|
||||
zassert_equal(test_name, sample_name, NULL);
|
||||
status = ascii_set(object_instance, NULL);
|
||||
zassert_true(status, NULL);
|
||||
test_name = ascii_get(object_instance);
|
||||
zassert_equal(test_name, NULL, NULL);
|
||||
}
|
||||
|
||||
@@ -13,6 +13,17 @@
|
||||
#include <bacnet/rpm.h>
|
||||
#include <bacnet/wp.h>
|
||||
|
||||
/* function API pattern for testing ASCII name get/set */
|
||||
typedef bool (*object_name_ascii_set_function) (uint32_t object_instance,
|
||||
char *new_name);
|
||||
typedef const char * (*object_name_ascii_function) (
|
||||
uint32_t object_instance);
|
||||
|
||||
void bacnet_object_name_ascii_test(
|
||||
uint32_t object_instance,
|
||||
object_name_ascii_set_function ascii_set,
|
||||
object_name_ascii_function ascii_get);
|
||||
|
||||
void bacnet_object_properties_read_write_test(
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
|
||||
@@ -40,6 +40,10 @@ static void testTimeValue(void)
|
||||
OBJECT_TIME_VALUE, object_instance, Time_Value_Property_Lists,
|
||||
Time_Value_Read_Property, Time_Value_Write_Property,
|
||||
skip_fail_property_list);
|
||||
bacnet_object_name_ascii_test(
|
||||
object_instance,
|
||||
Time_Value_Name_Set,
|
||||
Time_Value_Name_ASCII);
|
||||
/* check the delete function */
|
||||
status = Time_Value_Delete(object_instance);
|
||||
zassert_true(status, NULL);
|
||||
|
||||
Reference in New Issue
Block a user