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:
Steve Karg
2024-08-28 16:21:58 -05:00
committed by GitHub
parent b3c8c10c03
commit 3d3e192ae9
86 changed files with 872 additions and 87 deletions
+13
View File
@@ -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);