make pretty using clang-format 10
This commit is contained in:
@@ -44,28 +44,14 @@ struct object_data {
|
||||
static struct object_data Object_List[MAX_ACCUMULATORS];
|
||||
|
||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||
static const int Properties_Required[] = {
|
||||
PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME,
|
||||
PROP_OBJECT_TYPE,
|
||||
PROP_PRESENT_VALUE,
|
||||
PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE,
|
||||
PROP_OUT_OF_SERVICE,
|
||||
PROP_SCALE,
|
||||
PROP_UNITS,
|
||||
PROP_MAX_PRES_VALUE,
|
||||
-1
|
||||
};
|
||||
static const int Properties_Required[] = { PROP_OBJECT_IDENTIFIER,
|
||||
PROP_OBJECT_NAME, PROP_OBJECT_TYPE, PROP_PRESENT_VALUE, PROP_STATUS_FLAGS,
|
||||
PROP_EVENT_STATE, PROP_OUT_OF_SERVICE, PROP_SCALE, PROP_UNITS,
|
||||
PROP_MAX_PRES_VALUE, -1 };
|
||||
|
||||
static const int Properties_Optional[] = {
|
||||
PROP_DESCRIPTION,
|
||||
-1
|
||||
};
|
||||
static const int Properties_Optional[] = { PROP_DESCRIPTION, -1 };
|
||||
|
||||
static const int Properties_Proprietary[] = {
|
||||
-1
|
||||
};
|
||||
static const int Properties_Proprietary[] = { -1 };
|
||||
|
||||
/**
|
||||
* Returns the list of required, optional, and proprietary properties.
|
||||
@@ -79,9 +65,7 @@ static const int Properties_Proprietary[] = {
|
||||
* BACnet proprietary properties for this object.
|
||||
*/
|
||||
void Accumulator_Property_Lists(
|
||||
const int **pRequired,
|
||||
const int **pOptional,
|
||||
const int **pProprietary)
|
||||
const int **pRequired, const int **pOptional, const int **pProprietary)
|
||||
{
|
||||
if (pRequired)
|
||||
*pRequired = Properties_Required;
|
||||
@@ -100,8 +84,7 @@ void Accumulator_Property_Lists(
|
||||
*
|
||||
* @return true if the instance is valid, and false if not
|
||||
*/
|
||||
bool Accumulator_Valid_Instance(
|
||||
uint32_t object_instance)
|
||||
bool Accumulator_Valid_Instance(uint32_t object_instance)
|
||||
{
|
||||
if (object_instance < MAX_ACCUMULATORS)
|
||||
return true;
|
||||
@@ -141,8 +124,7 @@ uint32_t Accumulator_Index_To_Instance(unsigned index)
|
||||
* @return index for the given instance-number, or MAX_ACCUMULATORS
|
||||
* if not valid.
|
||||
*/
|
||||
unsigned Accumulator_Instance_To_Index(
|
||||
uint32_t object_instance)
|
||||
unsigned Accumulator_Instance_To_Index(uint32_t object_instance)
|
||||
{
|
||||
unsigned index = MAX_ACCUMULATORS;
|
||||
|
||||
@@ -163,15 +145,14 @@ unsigned Accumulator_Instance_To_Index(
|
||||
* @return true if object-name was retrieved
|
||||
*/
|
||||
bool Accumulator_Object_Name(
|
||||
uint32_t object_instance,
|
||||
BACNET_CHARACTER_STRING * object_name)
|
||||
uint32_t object_instance, BACNET_CHARACTER_STRING *object_name)
|
||||
{
|
||||
static char text_string[32]; /* okay for single thread */
|
||||
static char text_string[32]; /* okay for single thread */
|
||||
bool status = false;
|
||||
|
||||
if (object_instance < MAX_ACCUMULATORS) {
|
||||
sprintf(text_string, "ACCUMULATOR-%lu",
|
||||
(long unsigned int)object_instance);
|
||||
sprintf(
|
||||
text_string, "ACCUMULATOR-%lu", (long unsigned int)object_instance);
|
||||
status = characterstring_init_ansi(object_name, text_string);
|
||||
}
|
||||
|
||||
@@ -205,8 +186,7 @@ BACNET_UNSIGNED_INTEGER Accumulator_Present_Value(uint32_t object_instance)
|
||||
* @return true if values are within range and present-value is set.
|
||||
*/
|
||||
bool Accumulator_Present_Value_Set(
|
||||
uint32_t object_instance,
|
||||
BACNET_UNSIGNED_INTEGER value)
|
||||
uint32_t object_instance, BACNET_UNSIGNED_INTEGER value)
|
||||
{
|
||||
bool status = false;
|
||||
|
||||
@@ -233,7 +213,7 @@ uint16_t Accumulator_Units(uint32_t object_instance)
|
||||
units = UNITS_WATT_HOURS;
|
||||
}
|
||||
|
||||
return units;
|
||||
return units;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -255,7 +235,7 @@ int32_t Accumulator_Scale_Integer(uint32_t object_instance)
|
||||
scale = Object_List[object_instance].Scale;
|
||||
}
|
||||
|
||||
return scale;
|
||||
return scale;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -279,7 +259,7 @@ bool Accumulator_Scale_Integer_Set(uint32_t object_instance, int32_t scale)
|
||||
status = true;
|
||||
}
|
||||
|
||||
return status;
|
||||
return status;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -301,7 +281,7 @@ BACNET_UNSIGNED_INTEGER Accumulator_Max_Pres_Value(uint32_t object_instance)
|
||||
max_value = BACNET_UNSIGNED_INTEGER_MAX;
|
||||
}
|
||||
|
||||
return max_value;
|
||||
return max_value;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -314,10 +294,9 @@ BACNET_UNSIGNED_INTEGER Accumulator_Max_Pres_Value(uint32_t object_instance)
|
||||
* @return number of APDU bytes in the response, or
|
||||
* BACNET_STATUS_ERROR on error.
|
||||
*/
|
||||
int Accumulator_Read_Property(
|
||||
BACNET_READ_PROPERTY_DATA * rpdata)
|
||||
int Accumulator_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
{
|
||||
int apdu_len = 0; /* return value */
|
||||
int apdu_len = 0; /* return value */
|
||||
BACNET_BIT_STRING bit_string;
|
||||
BACNET_CHARACTER_STRING char_string;
|
||||
uint8_t *apdu = NULL;
|
||||
@@ -327,11 +306,10 @@ int Accumulator_Read_Property(
|
||||
return 0;
|
||||
}
|
||||
apdu = rpdata->application_data;
|
||||
switch ((int) rpdata->object_property) {
|
||||
switch ((int)rpdata->object_property) {
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len =
|
||||
encode_application_object_id(&apdu[0], OBJECT_ACCUMULATOR,
|
||||
rpdata->object_instance);
|
||||
apdu_len = encode_application_object_id(
|
||||
&apdu[0], OBJECT_ACCUMULATOR, rpdata->object_instance);
|
||||
break;
|
||||
case PROP_OBJECT_NAME:
|
||||
case PROP_DESCRIPTION:
|
||||
@@ -340,21 +318,21 @@ int Accumulator_Read_Property(
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
case PROP_OBJECT_TYPE:
|
||||
apdu_len = encode_application_enumerated(&apdu[0], OBJECT_ACCUMULATOR);
|
||||
apdu_len =
|
||||
encode_application_enumerated(&apdu[0], OBJECT_ACCUMULATOR);
|
||||
break;
|
||||
case PROP_PRESENT_VALUE:
|
||||
apdu_len = encode_application_unsigned(&apdu[0],
|
||||
Accumulator_Present_Value(rpdata->object_instance));
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0], Accumulator_Present_Value(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_SCALE:
|
||||
case PROP_SCALE:
|
||||
/* context tagged choice: [0]=REAL, [1]=INTEGER */
|
||||
apdu_len = encode_context_signed(&apdu[apdu_len], 1,
|
||||
apdu_len = encode_context_signed(&apdu[apdu_len], 1,
|
||||
Accumulator_Scale_Integer(rpdata->object_instance));
|
||||
break;
|
||||
break;
|
||||
case PROP_MAX_PRES_VALUE:
|
||||
apdu_len =
|
||||
encode_application_unsigned(&apdu[0],
|
||||
Accumulator_Max_Pres_Value(rpdata->object_instance));
|
||||
apdu_len = encode_application_unsigned(
|
||||
&apdu[0], Accumulator_Max_Pres_Value(rpdata->object_instance));
|
||||
break;
|
||||
case PROP_STATUS_FLAGS:
|
||||
bitstring_init(&bit_string);
|
||||
@@ -372,7 +350,8 @@ int Accumulator_Read_Property(
|
||||
apdu_len = encode_application_boolean(&apdu[0], false);
|
||||
break;
|
||||
case PROP_UNITS:
|
||||
apdu_len = encode_application_enumerated(&apdu[0], Accumulator_Units(rpdata->object_instance));
|
||||
apdu_len = encode_application_enumerated(
|
||||
&apdu[0], Accumulator_Units(rpdata->object_instance));
|
||||
break;
|
||||
default:
|
||||
rpdata->error_class = ERROR_CLASS_PROPERTY;
|
||||
@@ -398,16 +377,14 @@ int Accumulator_Read_Property(
|
||||
*
|
||||
* @return false if an error is loaded, true if no errors
|
||||
*/
|
||||
bool Accumulator_Write_Property(
|
||||
BACNET_WRITE_PROPERTY_DATA * wp_data)
|
||||
bool Accumulator_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
{
|
||||
int len = 0;
|
||||
BACNET_APPLICATION_DATA_VALUE value;
|
||||
|
||||
/* decode the some of the request */
|
||||
len =
|
||||
bacapp_decode_application_data(wp_data->application_data,
|
||||
wp_data->application_data_len, &value);
|
||||
len = bacapp_decode_application_data(
|
||||
wp_data->application_data, wp_data->application_data_len, &value);
|
||||
/* FIXME: len < application_data_len: more data? */
|
||||
if (len < 0) {
|
||||
/* error while decoding - a value larger than we can handle */
|
||||
@@ -427,7 +404,7 @@ bool Accumulator_Write_Property(
|
||||
case PROP_DESCRIPTION:
|
||||
case PROP_OBJECT_TYPE:
|
||||
case PROP_PRESENT_VALUE:
|
||||
case PROP_SCALE:
|
||||
case PROP_SCALE:
|
||||
case PROP_MAX_PRES_VALUE:
|
||||
case PROP_STATUS_FLAGS:
|
||||
case PROP_EVENT_STATE:
|
||||
@@ -454,9 +431,9 @@ void Accumulator_Init(void)
|
||||
unsigned i = 0;
|
||||
|
||||
for (i = 0; i < MAX_ACCUMULATORS; i++) {
|
||||
Accumulator_Scale_Integer_Set(i, i+1);
|
||||
Accumulator_Scale_Integer_Set(i, i + 1);
|
||||
Accumulator_Present_Value_Set(i, unsigned_value);
|
||||
unsigned_value |= (unsigned_value<<1);
|
||||
unsigned_value |= (unsigned_value << 1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -466,14 +443,13 @@ void Accumulator_Init(void)
|
||||
#include "ctest.h"
|
||||
#include "bactext.h"
|
||||
|
||||
void test_Accumulator(
|
||||
Test * pTest)
|
||||
void test_Accumulator(Test *pTest)
|
||||
{
|
||||
uint8_t apdu[MAX_APDU] = { 0 };
|
||||
int len = 0;
|
||||
int test_len = 0;
|
||||
BACNET_READ_PROPERTY_DATA rpdata = {0};
|
||||
BACNET_APPLICATION_DATA_VALUE value = {0};
|
||||
BACNET_READ_PROPERTY_DATA rpdata = { 0 };
|
||||
BACNET_APPLICATION_DATA_VALUE value = { 0 };
|
||||
const int *property = &Properties_Required[0];
|
||||
BACNET_UNSIGNED_INTEGER unsigned_value = 1;
|
||||
|
||||
@@ -489,11 +465,11 @@ void test_Accumulator(
|
||||
len = Accumulator_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
if (IS_CONTEXT_SPECIFIC(rpdata.application_data[0])) {
|
||||
test_len = bacapp_decode_context_data(rpdata.application_data,
|
||||
len, &value, rpdata.object_property);
|
||||
test_len = bacapp_decode_context_data(
|
||||
rpdata.application_data, len, &value, rpdata.object_property);
|
||||
} else {
|
||||
test_len = bacapp_decode_application_data(rpdata.application_data,
|
||||
len, &value);
|
||||
test_len = bacapp_decode_application_data(
|
||||
rpdata.application_data, len, &value);
|
||||
}
|
||||
if (len != test_len) {
|
||||
printf("property '%s': failed to decode!\n",
|
||||
@@ -508,17 +484,16 @@ void test_Accumulator(
|
||||
Accumulator_Present_Value_Set(0, unsigned_value);
|
||||
len = Accumulator_Read_Property(&rpdata);
|
||||
ct_test(pTest, len != 0);
|
||||
test_len = bacapp_decode_application_data(rpdata.application_data,
|
||||
len, &value);
|
||||
test_len = bacapp_decode_application_data(
|
||||
rpdata.application_data, len, &value);
|
||||
ct_test(pTest, len == test_len);
|
||||
unsigned_value |= (unsigned_value<<1);
|
||||
unsigned_value |= (unsigned_value << 1);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
int main(
|
||||
void)
|
||||
int main(void)
|
||||
{
|
||||
Test *pTest;
|
||||
bool rc;
|
||||
@@ -530,7 +505,7 @@ int main(
|
||||
|
||||
ct_setStream(pTest, stdout);
|
||||
ct_run(pTest);
|
||||
(void) ct_report(pTest);
|
||||
(void)ct_report(pTest);
|
||||
ct_destroy(pTest);
|
||||
|
||||
return 0;
|
||||
|
||||
@@ -190,7 +190,7 @@ bool Access_Door_Present_Value_Set(
|
||||
index = Access_Door_Instance_To_Index(object_instance);
|
||||
if (index < MAX_ACCESS_DOORS) {
|
||||
if (priority && (priority <= BACNET_MAX_PRIORITY) &&
|
||||
(priority != 6 /* reserved */) &&
|
||||
(priority != 6 /* reserved */) &&
|
||||
(value <= DOOR_VALUE_EXTENDED_PULSE_UNLOCK)) {
|
||||
ad_descr[index].value_active[priority - 1] = true;
|
||||
ad_descr[index].priority_array[priority - 1] = value;
|
||||
@@ -467,7 +467,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
algorithm and may not be used for other purposes in any
|
||||
object. */
|
||||
status = Access_Door_Present_Value_Set(wp_data->object_instance,
|
||||
(BACNET_DOOR_VALUE)value.type.Enumerated, wp_data->priority);
|
||||
(BACNET_DOOR_VALUE)value.type.Enumerated,
|
||||
wp_data->priority);
|
||||
if (wp_data->priority == 6) {
|
||||
/* Command priority 6 is reserved for use by Minimum On/Off
|
||||
algorithm and may not be used for other purposes in any
|
||||
|
||||
@@ -64,7 +64,8 @@ static const int Analog_Value_Properties_Optional[] = { PROP_DESCRIPTION,
|
||||
static const int Analog_Value_Properties_Proprietary[] = { -1 };
|
||||
|
||||
/**
|
||||
* Initialize the pointers for the required, the optional and the properitary value properties.
|
||||
* Initialize the pointers for the required, the optional and the properitary
|
||||
* value properties.
|
||||
*
|
||||
* @param pRequired - Pointer to the pointer of required values.
|
||||
* @param pOptional - Pointer to the pointer of optional values.
|
||||
@@ -477,7 +478,8 @@ int Analog_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
|
||||
case PROP_OBJECT_NAME:
|
||||
case PROP_DESCRIPTION:
|
||||
if (Analog_Value_Object_Name(rpdata->object_instance, &char_string)) {
|
||||
if (Analog_Value_Object_Name(
|
||||
rpdata->object_instance, &char_string)) {
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
}
|
||||
@@ -667,7 +669,8 @@ int Analog_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
/**
|
||||
* Set the requested property of the analog value.
|
||||
*
|
||||
* @param wp_data Property requested, see for BACNET_WRITE_PROPERTY_DATA details.
|
||||
* @param wp_data Property requested, see for BACNET_WRITE_PROPERTY_DATA
|
||||
* details.
|
||||
*
|
||||
* @return true if successful
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,8 @@ static const int Binary_Value_Properties_Optional[] = { PROP_DESCRIPTION,
|
||||
static const int Binary_Value_Properties_Proprietary[] = { -1 };
|
||||
|
||||
/**
|
||||
* Initialize the pointers for the required, the optional and the properitary value properties.
|
||||
* Initialize the pointers for the required, the optional and the properitary
|
||||
* value properties.
|
||||
*
|
||||
* @param pRequired - Pointer to the pointer of required values.
|
||||
* @param pOptional - Pointer to the pointer of optional values.
|
||||
@@ -302,7 +303,8 @@ int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
You could make Description writable and different */
|
||||
case PROP_OBJECT_NAME:
|
||||
case PROP_DESCRIPTION:
|
||||
if (Binary_Value_Object_Name(rpdata->object_instance, &char_string)) {
|
||||
if (Binary_Value_Object_Name(
|
||||
rpdata->object_instance, &char_string)) {
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
}
|
||||
@@ -405,7 +407,8 @@ int Binary_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
/**
|
||||
* Set the requested property of the binary value.
|
||||
*
|
||||
* @param wp_data Property requested, see for BACNET_WRITE_PROPERTY_DATA details.
|
||||
* @param wp_data Property requested, see for BACNET_WRITE_PROPERTY_DATA
|
||||
* details.
|
||||
*
|
||||
* @return true if successful
|
||||
*/
|
||||
|
||||
@@ -115,9 +115,9 @@ static object_functions_t Object_Table[] = {
|
||||
Device_Count, Device_Index_To_Instance,
|
||||
Device_Valid_Object_Instance_Number, Device_Object_Name,
|
||||
Device_Read_Property_Local, NULL /* Write_Property */,
|
||||
Device_Property_Lists, NULL /* ReadRangeInfo */,
|
||||
NULL /* Iterator */, NULL /* Value_Lists */, NULL /* COV */,
|
||||
NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
||||
Device_Property_Lists, NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* Value_Lists */, NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
{ OBJECT_NETWORK_PORT, Network_Port_Init, Network_Port_Count,
|
||||
Network_Port_Index_To_Instance, Network_Port_Valid_Instance,
|
||||
@@ -225,8 +225,7 @@ static const int Device_Properties_Optional[] = {
|
||||
#if defined(BACDL_MSTP)
|
||||
PROP_MAX_MASTER, PROP_MAX_INFO_FRAMES,
|
||||
#endif
|
||||
PROP_DESCRIPTION, PROP_LOCATION, PROP_ACTIVE_COV_SUBSCRIPTIONS,
|
||||
-1
|
||||
PROP_DESCRIPTION, PROP_LOCATION, PROP_ACTIVE_COV_SUBSCRIPTIONS, -1
|
||||
};
|
||||
|
||||
static const int Device_Properties_Proprietary[] = { -1 };
|
||||
@@ -650,8 +649,8 @@ bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
|
||||
* @param object_instance [in] The object instance number to be looked up.
|
||||
* @return True if found, else False if no such Object in this device.
|
||||
*/
|
||||
bool Device_Valid_Object_Id
|
||||
(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
|
||||
bool Device_Valid_Object_Id(
|
||||
BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
|
||||
{
|
||||
bool status = false; /* return value */
|
||||
struct object_functions *pObject = NULL;
|
||||
|
||||
@@ -204,8 +204,7 @@ int cl_decode_apdu(uint8_t *apdu,
|
||||
len = decode_tag_number_and_value(
|
||||
&apdu[dec_len], &tag_number, &len_value_type);
|
||||
dec_len += len;
|
||||
len = decode_unsigned(
|
||||
&apdu[dec_len], len_value_type, &unsigned_value);
|
||||
len = decode_unsigned(&apdu[dec_len], len_value_type, &unsigned_value);
|
||||
if (len < 0) {
|
||||
return BACNET_STATUS_REJECT;
|
||||
}
|
||||
@@ -229,8 +228,7 @@ int cl_decode_apdu(uint8_t *apdu,
|
||||
&apdu[dec_len], 4, &bcl->Value.type.Boolean);
|
||||
break;
|
||||
case BACNET_APPLICATION_TAG_UNSIGNED_INT:
|
||||
len = decode_context_unsigned(
|
||||
&apdu[dec_len], 4, &unsigned_value);
|
||||
len = decode_context_unsigned(&apdu[dec_len], 4, &unsigned_value);
|
||||
if (len < 0) {
|
||||
return BACNET_STATUS_REJECT;
|
||||
}
|
||||
|
||||
@@ -62,7 +62,8 @@ static const int Properties_Optional[] = { PROP_EVENT_STATE,
|
||||
static const int Properties_Proprietary[] = { -1 };
|
||||
|
||||
/**
|
||||
* Initialize the pointers for the required, the optional and the properitary value properties.
|
||||
* Initialize the pointers for the required, the optional and the properitary
|
||||
* value properties.
|
||||
*
|
||||
* @param pRequired - Pointer to the pointer of required values.
|
||||
* @param pOptional - Pointer to the pointer of optional values.
|
||||
@@ -278,7 +279,8 @@ static char *CharacterString_Value_Description(uint32_t object_instance)
|
||||
* For a given object instance-number, set the description text.
|
||||
*
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param new_descr - C-String pointer to the string, representing the description text
|
||||
* @param new_descr - C-String pointer to the string, representing the
|
||||
* description text
|
||||
*
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
@@ -300,7 +302,8 @@ bool CharacterString_Value_Description_Set(
|
||||
}
|
||||
}
|
||||
} else {
|
||||
memset(&Object_Description[index][0], 0, sizeof(Object_Description[index]));
|
||||
memset(&Object_Description[index][0], 0,
|
||||
sizeof(Object_Description[index]));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,7 +314,8 @@ bool CharacterString_Value_Description_Set(
|
||||
* For a given object instance-number, return the object text.
|
||||
*
|
||||
* @param object_instance - object-instance number of the object
|
||||
* @param object_name - Pointer to the BACnet string object that shall take the object name
|
||||
* @param object_name - Pointer to the BACnet string object that shall take the
|
||||
* object name
|
||||
*
|
||||
* @return True on success, false otherwise.
|
||||
*/
|
||||
@@ -390,7 +394,8 @@ int CharacterString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
}
|
||||
|
||||
/* Valid object? */
|
||||
object_index = CharacterString_Value_Instance_To_Index(rpdata->object_instance);
|
||||
object_index =
|
||||
CharacterString_Value_Instance_To_Index(rpdata->object_instance);
|
||||
if (object_index >= MAX_CHARACTERSTRING_VALUES) {
|
||||
rpdata->error_class = ERROR_CLASS_OBJECT;
|
||||
rpdata->error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||
@@ -408,14 +413,15 @@ int CharacterString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
You could make Description writable and different */
|
||||
case PROP_OBJECT_NAME:
|
||||
if (CharacterString_Value_Object_Name(
|
||||
rpdata->object_instance, &char_string)) {
|
||||
rpdata->object_instance, &char_string)) {
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
}
|
||||
break;
|
||||
case PROP_DESCRIPTION:
|
||||
if (characterstring_init_ansi(&char_string,
|
||||
CharacterString_Value_Description(rpdata->object_instance))) {
|
||||
CharacterString_Value_Description(
|
||||
rpdata->object_instance))) {
|
||||
apdu_len =
|
||||
encode_application_character_string(&apdu[0], &char_string);
|
||||
}
|
||||
@@ -474,7 +480,8 @@ int CharacterString_Value_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
/**
|
||||
* Set the requested property of the character string value.
|
||||
*
|
||||
* @param wp_data Property requested, see for BACNET_WRITE_PROPERTY_DATA details.
|
||||
* @param wp_data Property requested, see for BACNET_WRITE_PROPERTY_DATA
|
||||
* details.
|
||||
*
|
||||
* @return true if successful
|
||||
*/
|
||||
@@ -504,7 +511,8 @@ bool CharacterString_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
|
||||
}
|
||||
|
||||
/* Valid object? */
|
||||
object_index = CharacterString_Value_Instance_To_Index(wp_data->object_instance);
|
||||
object_index =
|
||||
CharacterString_Value_Instance_To_Index(wp_data->object_instance);
|
||||
if (object_index >= MAX_CHARACTERSTRING_VALUES) {
|
||||
wp_data->error_class = ERROR_CLASS_OBJECT;
|
||||
wp_data->error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||
|
||||
@@ -251,13 +251,12 @@ static object_functions_t My_Object_Table[] = {
|
||||
Schedule_Property_Lists, NULL /* ReadRangeInfo */, NULL /* Iterator */,
|
||||
NULL /* Value_Lists */, NULL /* COV */, NULL /* COV Clear */,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
{OBJECT_ACCUMULATOR, Accumulator_Init, Accumulator_Count,
|
||||
{ OBJECT_ACCUMULATOR, Accumulator_Init, Accumulator_Count,
|
||||
Accumulator_Index_To_Instance, Accumulator_Valid_Instance,
|
||||
Accumulator_Object_Name, Accumulator_Read_Property,
|
||||
Accumulator_Write_Property, Accumulator_Property_Lists,
|
||||
NULL /* ReadRangeInfo */ , NULL /* Iterator */ ,
|
||||
NULL /* Value_Lists */ , NULL /* COV */ , NULL /* COV Clear */ ,
|
||||
NULL /* Intrinsic Reporting */ },
|
||||
NULL /* ReadRangeInfo */, NULL /* Iterator */, NULL /* Value_Lists */,
|
||||
NULL /* COV */, NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
|
||||
{ MAX_BACNET_OBJECT_TYPE, NULL /* Init */, NULL /* Count */,
|
||||
NULL /* Index_To_Instance */, NULL /* Valid_Instance */,
|
||||
NULL /* Object_Name */, NULL /* Read_Property */,
|
||||
@@ -926,8 +925,8 @@ bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
|
||||
* @param object_instance [in] The object instance number to be looked up.
|
||||
* @return True if found, else False if no such Object in this device.
|
||||
*/
|
||||
bool Device_Valid_Object_Id
|
||||
(BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
|
||||
bool Device_Valid_Object_Id(
|
||||
BACNET_OBJECT_TYPE object_type, uint32_t object_instance)
|
||||
{
|
||||
bool status = false; /* return value */
|
||||
struct object_functions *pObject = NULL;
|
||||
|
||||
@@ -1210,8 +1210,7 @@ static void Lighting_Output_Ramp_Handler(struct lighting_output_object *pLight,
|
||||
BACNET_LIGHTING_COMMAND *pCommand,
|
||||
uint16_t milliseconds)
|
||||
{
|
||||
if (pLight && pCommand) {
|
||||
}
|
||||
if (pLight && pCommand) { }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1226,8 +1225,7 @@ static void Lighting_Output_Fade_Handler(struct lighting_output_object *pLight,
|
||||
BACNET_LIGHTING_COMMAND *pCommand,
|
||||
uint16_t milliseconds)
|
||||
{
|
||||
if (pLight && pCommand) {
|
||||
}
|
||||
if (pLight && pCommand) { }
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -933,8 +933,8 @@ bool Network_Port_IP_Subnet(
|
||||
if ((prefix > 0) && (prefix <= 32)) {
|
||||
mask = (0xFFFFFFFF << (32 - prefix)) & 0xFFFFFFFF;
|
||||
encode_unsigned32(ip_mask, mask);
|
||||
status = octetstring_init(subnet_mask, ip_mask,
|
||||
sizeof(ip_mask));
|
||||
status =
|
||||
octetstring_init(subnet_mask, ip_mask, sizeof(ip_mask));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1319,7 +1319,7 @@ bool Network_Port_BIP6_Mode_Set(uint32_t object_instance, BACNET_IP_MODE value)
|
||||
if (index < BACNET_NETWORK_PORTS_MAX) {
|
||||
if (Object_List[index].Network_Type == PORT_TYPE_BIP6) {
|
||||
if (Object_List[index].Network.IPv4.Mode != value) {
|
||||
Object_List[index].Changes_Pending = true;
|
||||
Object_List[index].Changes_Pending = true;
|
||||
}
|
||||
Object_List[index].Network.IPv6.Mode = value;
|
||||
status = true;
|
||||
@@ -1857,8 +1857,8 @@ int Network_Port_Read_Property(BACNET_READ_PROPERTY_DATA *rpdata)
|
||||
(rpdata->application_data_len == 0)) {
|
||||
return 0;
|
||||
}
|
||||
Network_Port_Property_List(rpdata->object_instance,
|
||||
&pRequired, &pOptional, &pProprietary);
|
||||
Network_Port_Property_List(
|
||||
rpdata->object_instance, &pRequired, &pOptional, &pProprietary);
|
||||
if ((!property_list_member(pRequired, rpdata->object_property)) &&
|
||||
(!property_list_member(pOptional, rpdata->object_property)) &&
|
||||
(!property_list_member(pProprietary, rpdata->object_property))) {
|
||||
|
||||
@@ -125,4 +125,3 @@ OBJECT_DEVICE_T *objects_device_delete(int index)
|
||||
}
|
||||
return pDevice;
|
||||
}
|
||||
|
||||
|
||||
@@ -89,10 +89,8 @@ void Schedule_Init(void)
|
||||
psched->Present_Value = &psched->Schedule_Default;
|
||||
psched->Schedule_Default.context_specific = false;
|
||||
psched->Schedule_Default.tag = BACNET_APPLICATION_TAG_REAL;
|
||||
psched->Schedule_Default.type.Real =
|
||||
21.0; /* 21 C, room temperature */
|
||||
psched->obj_prop_ref_cnt =
|
||||
0; /* no references, add as needed */
|
||||
psched->Schedule_Default.type.Real = 21.0; /* 21 C, room temperature */
|
||||
psched->obj_prop_ref_cnt = 0; /* no references, add as needed */
|
||||
psched->Priority_For_Writing = 16; /* lowest priority */
|
||||
psched->Out_Of_Service = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user