make pretty using clang-format 10

This commit is contained in:
Steve Karg
2020-06-19 14:44:32 -05:00
parent be57c73508
commit 15dce68947
71 changed files with 660 additions and 597 deletions
+2 -2
View File
@@ -1026,8 +1026,8 @@ void bvlc6_init(void)
VMAC_Init();
BVLC6_Result_Code = BVLC6_RESULT_SUCCESSFUL_COMPLETION;
BVLC6_Function_Code = BVLC6_RESULT;
bvlc6_address_set(&Remote_BBMD, 0, 0, 0, 0, 0, 0, 0,
BIP6_MULTICAST_GROUP_ID);
bvlc6_address_set(
&Remote_BBMD, 0, 0, 0, 0, 0, 0, 0, BIP6_MULTICAST_GROUP_ID);
#if defined(BACDL_BIP6) && BBMD6_ENABLED
memset(&BBMD_Table, 0, sizeof(BBMD_Table));
memset(&FD_Table, 0, sizeof(FD_Table));
+21 -13
View File
@@ -121,7 +121,7 @@ bool address_match(BACNET_ADDRESS *dest, BACNET_ADDRESS *src)
uint8_t max_len = 0;
if (dest == src) {
return(true);
return (true);
}
if (dest->mac_len != src->mac_len) {
return false;
@@ -624,7 +624,8 @@ void address_add(uint32_t device_id, unsigned max_apdu, BACNET_ADDRESS *src)
}
}
/* If adding has failed, see if we can squeeze it in by removed the oldest entry. */
/* If adding has failed, see if we can squeeze it in by removed the oldest
* entry. */
if (!found) {
pMatch = address_remove_oldest();
if (pMatch != NULL) {
@@ -775,8 +776,10 @@ void address_add_binding(
*
* @param index Table index [0..MAX_ADDRESS_CACHE-1]
* @param device_id Pointer to the variable taking the device id.
* @param device_ttl Pointer to the variable taking the Time To Life for the device.
* @param max_apdu Pointer to the variable taking the max APDU size of the device.
* @param device_ttl Pointer to the variable taking the Time To Life for the
* device.
* @param max_apdu Pointer to the variable taking the max APDU size of the
* device.
* @param src Pointer to the BACnet address.
*
* @return true/false
@@ -818,7 +821,8 @@ bool address_device_get_by_index(unsigned index,
*
* @param index Table index [0..MAX_ADDRESS_CACHE-1]
* @param device_id Pointer to the variable taking the device id.
* @param max_apdu Pointer to the variable taking the max APDU size of the device.
* @param max_apdu Pointer to the variable taking the max APDU size of the
* device.
* @param src Pointer to the BACnet address.
*
* @return true/false
@@ -876,8 +880,9 @@ int address_list_encode(uint8_t *apdu, unsigned apdu_len)
if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ)) ==
BAC_ADDR_IN_USE) {
iLen += encode_application_object_id(
&apdu[iLen], OBJECT_DEVICE, pMatch->device_id);
iLen += encode_application_unsigned(&apdu[iLen], pMatch->address.net);
&apdu[iLen], OBJECT_DEVICE, pMatch->device_id);
iLen +=
encode_application_unsigned(&apdu[iLen], pMatch->address.net);
if ((unsigned)iLen >= apdu_len) {
break;
}
@@ -891,7 +896,8 @@ int address_list_encode(uint8_t *apdu, unsigned apdu_len)
}
octetstring_init(
&MAC_Address, pMatch->address.adr, pMatch->address.len);
iLen += encode_application_octet_string(&apdu[iLen], &MAC_Address);
iLen +=
encode_application_octet_string(&apdu[iLen], &MAC_Address);
} else {
/* MAC*/
if ((unsigned)(iLen + pMatch->address.mac_len) >= apdu_len) {
@@ -899,7 +905,8 @@ int address_list_encode(uint8_t *apdu, unsigned apdu_len)
}
octetstring_init(
&MAC_Address, pMatch->address.mac, pMatch->address.mac_len);
iLen += encode_application_octet_string(&apdu[iLen], &MAC_Address);
iLen +=
encode_application_octet_string(&apdu[iLen], &MAC_Address);
}
/* Any space left? */
if ((unsigned)iLen >= apdu_len) {
@@ -1030,7 +1037,7 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
pMatch++;
/* Shall not happen as the count has been checked first. */
if (pMatch > &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
return(0); /* Issue with the table. */
return (0); /* Issue with the table. */
}
}
@@ -1045,7 +1052,7 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
}
/* Shall not happen as the count has been checked first. */
if (pMatch > &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
return(0); /* Issue with the table. */
return (0); /* Issue with the table. */
}
}
@@ -1093,7 +1100,7 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
pMatch++;
/* Can normally not happen. */
if (pMatch > &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
return(0); /* Issue with the table. */
return (0); /* Issue with the table. */
}
}
}
@@ -1116,7 +1123,8 @@ int rr_address_list_encode(uint8_t *apdu, BACNET_READ_RANGE_DATA *pRequest)
* is never called at all the whole cache is effectivly rendered static and
* entries never expire unless explictely deleted.
*
* @param uSeconds Approximate number of seconds since last call to this function
* @param uSeconds Approximate number of seconds since last call to this
* function
*/
void address_cache_timer(uint16_t uSeconds)
{
+2 -1
View File
@@ -76,7 +76,8 @@ void npdu_handler(BACNET_ADDRESS *src, /* source address */
/* only handle the version that we know how to handle */
if (pdu[0] == BACNET_PROTOCOL_VERSION) {
apdu_offset = bacnet_npdu_decode(&pdu[0], pdu_len, &dest, src, &npdu_data);
apdu_offset =
bacnet_npdu_decode(&pdu[0], pdu_len, &dest, src, &npdu_data);
if (npdu_data.network_layer_message) {
/*FIXME: network layer message received! Handle it! */
#if PRINT_ENABLED
+52 -77
View File
@@ -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;
+3 -2
View File
@@ -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
+6 -3
View File
@@ -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
*/
+6 -3
View File
@@ -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;
+2 -4
View File
@@ -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;
}
+17 -9
View File
@@ -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;
+5 -6
View File
@@ -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;
+2 -4
View File
@@ -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) { }
}
/**
+5 -5
View File
@@ -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))) {
-1
View File
@@ -125,4 +125,3 @@ OBJECT_DEVICE_T *objects_device_delete(int index)
}
return pDevice;
}
+2 -4
View File
@@ -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;
}
+2 -2
View File
@@ -187,8 +187,8 @@ AA_ABORT:
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+36 -24
View File
@@ -307,7 +307,8 @@ static error_function Error_Function[MAX_BACNET_CONFIRMED_SERVICE];
* @brief Set a error handler function for the given confirmed service.
*
* @param service_choice Service, see SERVICE_CONFIRMED_X enumeration.
* @param pFunction Pointer to the function, being in charge of the error handling.
* @param pFunction Pointer to the function, being in charge of the error
* handling.
*/
void apdu_set_error_handler(
BACNET_CONFIRMED_SERVICE service_choice, error_function pFunction)
@@ -374,7 +375,7 @@ uint16_t apdu_decode_confirmed_service_request(uint8_t *apdu, /* APDU data */
service_data->invoke_id = apdu[2];
len = 3;
if (service_data->segmented_message) {
if (apdu_len >= (len+2)) {
if (apdu_len >= (len + 2)) {
service_data->sequence_number = apdu[len++];
service_data->proposed_window_number = apdu[len++];
} else {
@@ -386,7 +387,7 @@ uint16_t apdu_decode_confirmed_service_request(uint8_t *apdu, /* APDU data */
*service_choice = apdu[len++];
*service_request = NULL;
*service_request_len = 0;
} else if (apdu_len >= (len+2)) {
} else if (apdu_len >= (len + 2)) {
*service_choice = apdu[len++];
*service_request = &apdu[len];
*service_request_len = apdu_len - len;
@@ -534,10 +535,11 @@ void apdu_handler(BACNET_ADDRESS *src,
service_request_len = apdu_len - 2;
if (apdu_unconfirmed_dcc_disabled(service_choice)) {
/* When network communications are disabled,
only DeviceCommunicationControl and ReinitializeDevice
APDUs shall be processed and no messages shall be
initiated. If communications have been initiation
disabled, then WhoIs may be processed. */
only DeviceCommunicationControl and
ReinitializeDevice APDUs shall be processed and no
messages shall be initiated. If communications have
been initiation disabled, then WhoIs may be
processed. */
break;
}
if (service_choice < MAX_BACNET_UNCONFIRMED_SERVICE) {
@@ -573,7 +575,8 @@ void apdu_handler(BACNET_ADDRESS *src,
case SERVICE_CONFIRMED_VT_CLOSE:
/* Security Services */
case SERVICE_CONFIRMED_REQUEST_KEY:
if (Confirmed_ACK_Function[service_choice] != NULL) {
if (Confirmed_ACK_Function[service_choice] !=
NULL) {
((confirmed_simple_ack_function)
Confirmed_ACK_Function[service_choice])(
src, invoke_id);
@@ -619,7 +622,8 @@ void apdu_handler(BACNET_ADDRESS *src,
case SERVICE_CONFIRMED_VT_DATA:
/* Security Services */
case SERVICE_CONFIRMED_AUTHENTICATE:
if (Confirmed_ACK_Function[service_choice] != NULL) {
if (Confirmed_ACK_Function[service_choice] !=
NULL) {
(Confirmed_ACK_Function[service_choice])(
service_request, service_request_len, src,
&service_ack_data);
@@ -642,18 +646,20 @@ void apdu_handler(BACNET_ADDRESS *src,
service_choice = apdu[2];
len = 3;
/* FIXME: Currently special case for C_P_T but there are others
which may need consideration such as ChangeList-Error,
CreateObject-Error, WritePropertyMultiple-Error and
VTClose_Error but they may be left as is for now until
support for these services is added */
/* FIXME: Currently special case for C_P_T but there are
others which may need consideration such as
ChangeList-Error, CreateObject-Error,
WritePropertyMultiple-Error and VTClose_Error but they
may be left as is for now until support for these
services is added */
if (service_choice ==
SERVICE_CONFIRMED_PRIVATE_TRANSFER) { /* skip over
opening tag 0 */
opening tag 0
*/
if (decode_is_opening_tag_number(&apdu[len], 0)) {
len++; /* a tag number of 0 is not extended so only one
octet */
len++; /* a tag number of 0 is not extended so only
one octet */
}
}
@@ -662,24 +668,30 @@ void apdu_handler(BACNET_ADDRESS *src,
&apdu[len], &tag_number, &len_value);
if (len < apdu_len) {
/* FIXME: we could validate that the tag is enumerated... */
len += decode_enumerated(&apdu[len], len_value, &error_class);
/* FIXME: we could validate that the tag is
* enumerated... */
len += decode_enumerated(
&apdu[len], len_value, &error_class);
if (len < apdu_len) {
len += decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value);
if (len < apdu_len) {
/* FIXME: we could validate that the tag is enumerated... */
len += decode_enumerated(&apdu[len], len_value, &error_code);
/* FIXME: we could validate that the tag is
* enumerated... */
len += decode_enumerated(
&apdu[len], len_value, &error_code);
if (service_choice ==
SERVICE_CONFIRMED_PRIVATE_TRANSFER) {
if (len < apdu_len) {
/* skip over closing tag 0 */
if (decode_is_closing_tag_number(&apdu[len], 0)) {
len++; /* a tag number of 0 is not extended so
only one octet */
if (decode_is_closing_tag_number(
&apdu[len], 0)) {
len++; /* a tag number of 0 is
not extended so only
one octet */
}
}
}
+2 -2
View File
@@ -227,8 +227,8 @@ GET_EVENT_ABORT:
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to send PDU (%s)!\n", strerror(errno));
+2 -2
View File
@@ -111,8 +111,8 @@ LSO_ABORT:
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+113 -91
View File
@@ -208,9 +208,9 @@ void handler_read_property_multiple(uint8_t *service_request,
if (service_data->segmented_message) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
#if PRINT_ENABLED
#if PRINT_ENABLED
fprintf(stderr, "RPM: Segmented message. Sending Abort!\r\n");
#endif
#endif
} else {
/* decode apdu request & encode apdu reply
encode complex ack, invoke id, service choice */
@@ -219,16 +219,16 @@ void handler_read_property_multiple(uint8_t *service_request,
for (;;) {
/* Start by looking for an object ID */
len = rpm_decode_object_id(
&service_request[decode_len], service_len - decode_len, &rpmdata);
len = rpm_decode_object_id(&service_request[decode_len],
service_len - decode_len, &rpmdata);
if (len >= 0) {
/* Got one so skip to next stage */
decode_len += len;
} else {
/* bad encoding - skip to error/reject/abort handling */
#if PRINT_ENABLED
#if PRINT_ENABLED
fprintf(stderr, "RPM: Bad Encoding.\n");
#endif
#endif
error = len;
berror = true;
break;
@@ -242,14 +242,14 @@ void handler_read_property_multiple(uint8_t *service_request,
/* Stick this object id into the reply - if it will fit */
len = rpm_ack_encode_apdu_object_begin(&Temp_Buf[0], &rpmdata);
copy_len =
memcopy(&Handler_Transmit_Buffer[npdu_len], &Temp_Buf[0],
apdu_len, len, MAX_APDU);
copy_len = memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len, MAX_APDU);
if (copy_len == 0) {
#if PRINT_ENABLED
#if PRINT_ENABLED
fprintf(stderr, "RPM: Response too big!\r\n");
#endif
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
#endif
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
berror = true;
break;
@@ -259,16 +259,18 @@ void handler_read_property_multiple(uint8_t *service_request,
/* do each property of this object of the RPM request */
for (;;) {
/* Fetch a property */
len = rpm_decode_object_property(&service_request[decode_len],
service_len - decode_len, &rpmdata);
len =
rpm_decode_object_property(&service_request[decode_len],
service_len - decode_len, &rpmdata);
if (len < 0) {
/* bad encoding - skip to error/reject/abort handling */
#if PRINT_ENABLED
#if PRINT_ENABLED
fprintf(stderr, "RPM: Bad Encoding.\n");
#endif
#endif
error = len;
berror = true;
break; // The berror flag ensures that both loops will be broken!
break; // The berror flag ensures that both loops will
// be broken!
}
decode_len += len;
/* handle the special properties */
@@ -281,43 +283,49 @@ void handler_read_property_multiple(uint8_t *service_request,
BACNET_PROPERTY_ID special_object_property;
if (rpmdata.array_index != BACNET_ARRAY_ALL) {
/* No array index options for this special property.
Encode error for this object property response */
len = rpm_ack_encode_apdu_object_property(&Temp_Buf[0],
rpmdata.object_property, rpmdata.array_index);
len = rpm_ack_encode_apdu_object_property(
&Temp_Buf[0], rpmdata.object_property,
rpmdata.array_index);
copy_len = memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len, MAX_APDU);
copy_len =
memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len, MAX_APDU);
if (copy_len == 0) {
#if PRINT_ENABLED
fprintf(
stderr, "RPM: Too full to encode property!\r\n");
#endif
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
berror = true;
break; // The berror flag ensures that both loops will be broken!
}
apdu_len += len;
len = rpm_ack_encode_apdu_object_property_error(
&Temp_Buf[0], ERROR_CLASS_PROPERTY,
ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY);
copy_len = memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len, MAX_APDU);
if (copy_len == 0) {
#if PRINT_ENABLED
fprintf(stderr, "RPM: Too full to encode error!\r\n");
#endif
#if PRINT_ENABLED
fprintf(stderr,
"RPM: Too full to encode property!\r\n");
#endif
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
berror = true;
break; // The berror flag ensures that both loops will be broken!
break; // The berror flag ensures that both
// loops will be broken!
}
apdu_len += len;
len = rpm_ack_encode_apdu_object_property_error(
&Temp_Buf[0], ERROR_CLASS_PROPERTY,
ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY);
copy_len =
memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len, MAX_APDU);
if (copy_len == 0) {
#if PRINT_ENABLED
fprintf(stderr,
"RPM: Too full to encode error!\r\n");
#endif
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
berror = true;
break; // The berror flag ensures that both
// loops will be broken!
}
apdu_len += len;
} else {
@@ -328,65 +336,75 @@ void handler_read_property_multiple(uint8_t *service_request,
&property_list, special_object_property);
if (property_count == 0) {
/* This only happens with the OPTIONAL property */
/* This only happens with the OPTIONAL property
*/
/* 135-2016bl-2. Clarify ReadPropertyMultiple
response on OPTIONAL when empty. */
/* If no optional properties are supported then
an empty 'List of Results' shall be returned
for the specified property.*/
} else {
for (index = 0; index < property_count; index++) {
rpmdata.object_property = RPM_Object_Property(
&property_list, special_object_property, index);
for (index = 0; index < property_count;
index++) {
rpmdata.object_property =
RPM_Object_Property(&property_list,
special_object_property, index);
len = RPM_Encode_Property(
&Handler_Transmit_Buffer[npdu_len],
(uint16_t)apdu_len, MAX_APDU, &rpmdata);
&Handler_Transmit_Buffer[npdu_len],
(uint16_t)apdu_len, MAX_APDU, &rpmdata);
if (len > 0) {
apdu_len += len;
} else {
#if PRINT_ENABLED
fprintf(
stderr, "RPM: Too full for property!\r\n");
#endif
#if PRINT_ENABLED
fprintf(stderr,
"RPM: Too full for property!\r\n");
#endif
error = len;
berror = true;
break; // The berror flag ensures that both loops will be broken!
break; // The berror flag ensures that
// both loops will be broken!
}
}
}
}
} else {
/* handle an individual property */
len = RPM_Encode_Property(&Handler_Transmit_Buffer[npdu_len],
(uint16_t)apdu_len, MAX_APDU, &rpmdata);
len = RPM_Encode_Property(
&Handler_Transmit_Buffer[npdu_len],
(uint16_t)apdu_len, MAX_APDU, &rpmdata);
if (len > 0) {
apdu_len += len;
} else {
#if PRINT_ENABLED
fprintf(
stderr, "RPM: Too full for individual property!\r\n");
#endif
#if PRINT_ENABLED
fprintf(stderr,
"RPM: Too full for individual property!\r\n");
#endif
error = len;
berror = true;
break; // The berror flag ensures that both loops will be broken!
break; // The berror flag ensures that both loops
// will be broken!
}
}
if (decode_is_closing_tag_number(&service_request[decode_len], 1)) {
/* Reached end of property list so cap the result list */
if (decode_is_closing_tag_number(
&service_request[decode_len], 1)) {
/* Reached end of property list so cap the result list
*/
decode_len++;
len = rpm_ack_encode_apdu_object_end(&Temp_Buf[0]);
copy_len = memcopy(&Handler_Transmit_Buffer[npdu_len],
&Temp_Buf[0], apdu_len, len, MAX_APDU);
&Temp_Buf[0], apdu_len, len, MAX_APDU);
if (copy_len == 0) {
#if PRINT_ENABLED
fprintf(stderr, "RPM: Too full to encode object end!\r\n");
#endif
#if PRINT_ENABLED
fprintf(stderr,
"RPM: Too full to encode object end!\r\n");
#endif
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
berror = true;
break; // The berror flag ensures that both loops will be broken!
break; // The berror flag ensures that both loops
// will be broken!
} else {
apdu_len += copy_len;
}
@@ -406,11 +424,13 @@ void handler_read_property_multiple(uint8_t *service_request,
if (!berror) {
if (apdu_len > service_data->max_resp) {
/* too big for the sender - send an abort */
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT;
#if PRINT_ENABLED
fprintf(stderr, "RPM: Message too large. Sending Abort!\n");
#endif
#if PRINT_ENABLED
fprintf(
stderr, "RPM: Message too large. Sending Abort!\n");
#endif
}
}
}
@@ -419,34 +439,36 @@ void handler_read_property_multiple(uint8_t *service_request,
if (error) {
if (error == BACNET_STATUS_ABORT) {
apdu_len = abort_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
abort_convert_error_code(rpmdata.error_code), true);
#if PRINT_ENABLED
service_data->invoke_id,
abort_convert_error_code(rpmdata.error_code), true);
#if PRINT_ENABLED
fprintf(stderr, "RPM: Sending Abort!\n");
#endif
#endif
} else if (error == BACNET_STATUS_ERROR) {
apdu_len = bacerror_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id, SERVICE_CONFIRMED_READ_PROP_MULTIPLE,
rpmdata.error_class, rpmdata.error_code);
#if PRINT_ENABLED
apdu_len = bacerror_encode_apdu(
&Handler_Transmit_Buffer[npdu_len], service_data->invoke_id,
SERVICE_CONFIRMED_READ_PROP_MULTIPLE, rpmdata.error_class,
rpmdata.error_code);
#if PRINT_ENABLED
fprintf(stderr, "RPM: Sending Error!\n");
#endif
#endif
} else if (error == BACNET_STATUS_REJECT) {
apdu_len = reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
reject_convert_error_code(rpmdata.error_code));
#if PRINT_ENABLED
apdu_len = reject_encode_apdu(
&Handler_Transmit_Buffer[npdu_len], service_data->invoke_id,
reject_convert_error_code(rpmdata.error_code));
#if PRINT_ENABLED
fprintf(stderr, "RPM: Sending Reject!\n");
#endif
#endif
}
}
pdu_len = apdu_len + npdu_len;
bytes_sent = datalink_send_pdu(src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
bytes_sent = datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
if (bytes_sent <= 0) {
#if PRINT_ENABLED
#if PRINT_ENABLED
fprintf(stderr, "RPM: Failed to send PDU (%s)!\n", strerror(errno));
#endif
#endif
}
}
}
+4 -5
View File
@@ -293,8 +293,7 @@ void rpm_ack_print_data(BACNET_READ_ACCESS_DATA *rpm_data)
* @param rpm_data - #BACNET_READ_ACCESS_DATA
* @return RPM data from the next element in the linked list
*/
static BACNET_READ_ACCESS_DATA *rpm_data_free(
BACNET_READ_ACCESS_DATA *rpm_data)
static BACNET_READ_ACCESS_DATA *rpm_data_free(BACNET_READ_ACCESS_DATA *rpm_data)
{
BACNET_READ_ACCESS_DATA *old_rpm_data = NULL;
BACNET_PROPERTY_REFERENCE *rpm_property = NULL;
@@ -343,7 +342,7 @@ void handler_read_property_multiple_ack(uint8_t *service_request,
BACNET_CONFIRMED_SERVICE_ACK_DATA *service_data)
{
int len = 0;
BACNET_READ_ACCESS_DATA * rpm_data;
BACNET_READ_ACCESS_DATA *rpm_data;
(void)src;
(void)service_data; /* we could use these... */
@@ -358,9 +357,9 @@ void handler_read_property_multiple_ack(uint8_t *service_request,
rpm_data = rpm_data_free(rpm_data);
}
} else {
#if 1
#if 1
fprintf(stderr, "RPM Ack Malformed! Freeing memory...\n");
#endif
#endif
while (rpm_data) {
rpm_data = rpm_data_free(rpm_data);
}
+2 -2
View File
@@ -185,8 +185,8 @@ RR_ABORT:
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to send PDU (%s)!\n", strerror(errno));
+2 -2
View File
@@ -79,8 +79,8 @@ void handler_ucov_notification(
#if PRINT_ENABLED
len =
#endif
cov_notify_decode_service_request(
service_request, service_len, &cov_data);
cov_notify_decode_service_request(
service_request, service_len, &cov_data);
#if PRINT_ENABLED
if (len > 0) {
fprintf(stderr, "UCOV: PID=%u ", cov_data.subscriberProcessIdentifier);
+3 -2
View File
@@ -98,7 +98,8 @@ void handler_write_property(uint8_t *service_request,
#if PRINT_ENABLED
if (len > 0)
fprintf(stderr,
"WP: type=%lu instance=%lu property=%lu priority=%lu index=%ld\n",
"WP: type=%lu instance=%lu property=%lu priority=%lu "
"index=%ld\n",
(unsigned long)wp_data.object_type,
(unsigned long)wp_data.object_instance,
(unsigned long)wp_data.object_property,
@@ -137,7 +138,7 @@ void handler_write_property(uint8_t *service_request,
/* Send PDU */
pdu_len += len;
bytes_sent = datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
if (bytes_sent <= 0) {
#if PRINT_ENABLED
fprintf(stderr, "WP: Failed to send PDU (%s)!\n", strerror(errno));
+2 -2
View File
@@ -90,8 +90,8 @@ uint8_t Send_Alarm_Acknowledgement(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to Send Alarm Ack Request (%s)!\n",
+2 -2
View File
@@ -97,8 +97,8 @@ uint8_t Send_Atomic_Read_File_Stream(uint32_t device_id,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to Send AtomicReadFile Request (%s)!\n",
+2 -2
View File
@@ -99,8 +99,8 @@ uint8_t Send_Atomic_Write_File_Stream(uint32_t device_id,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+2 -2
View File
@@ -91,8 +91,8 @@ uint8_t Send_CEvent_Notify(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0) {
fprintf(stderr,
+2 -2
View File
@@ -103,8 +103,8 @@ uint8_t Send_Device_Communication_Control_Request(uint32_t device_id,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+2 -2
View File
@@ -75,8 +75,8 @@ uint8_t Send_GetEvent(BACNET_ADDRESS *target_address,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
target_address, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(target_address, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+2 -2
View File
@@ -90,8 +90,8 @@ uint8_t Send_Life_Safety_Operation_Data(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to Send Life Safe Op Request (%s)!\n",
+2 -2
View File
@@ -100,8 +100,8 @@ uint8_t Send_Reinitialize_Device_Request(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+2 -2
View File
@@ -96,8 +96,8 @@ uint8_t Send_ReadRange_Request(uint32_t device_id, /* destination device */
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to Send ReadRange Request (%s)!\n",
+1 -1
View File
@@ -103,7 +103,7 @@ uint8_t Send_Read_Property_Multiple_Request(uint8_t *pdu,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+4 -4
View File
@@ -76,8 +76,8 @@ void Send_TimeSync_Remote(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr, "Failed to Send Time-Synchronization Request (%s)!\n",
@@ -133,8 +133,8 @@ void Send_TimeSyncUTC_Remote(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+4 -4
View File
@@ -88,8 +88,8 @@ void Send_WhoHas_Name(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(
@@ -146,8 +146,8 @@ void Send_WhoHas_Object(int32_t low_limit,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(
+1 -1
View File
@@ -104,7 +104,7 @@ uint8_t Send_Write_Property_Multiple_Request(uint8_t *pdu,
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0) {
fprintf(stderr,
+2 -3
View File
@@ -103,8 +103,7 @@ static int CheckArraySize(OS_Keylist list)
}
if (new_size) {
/* Allocate more room for node pointer array */
new_array = calloc((size_t)new_size,
sizeof(struct Keylist_Node *));
new_array = calloc((size_t)new_size, sizeof(struct Keylist_Node *));
/* See if we got the memory we wanted */
if (!new_array) {
@@ -453,7 +452,7 @@ int Keylist_Count(OS_Keylist list)
cnt = list->count;
}
return(cnt);
return (cnt);
}
/******************************************************************** */
+1 -1
View File
@@ -118,7 +118,7 @@ unsigned long mstimer_remaining(struct mstimer *t)
*/
unsigned long mstimer_elapsed(struct mstimer *t)
{
return mstimer_now() - t->start;
return mstimer_now() - t->start;
}
/**
+1 -2
View File
@@ -154,8 +154,7 @@ uint8_t tsm_transaction_idle_count(void)
const BACNET_TSM_DATA *plist = TSM_List;
for (i = 0; i < MAX_TSM_TRANSACTIONS; i++, plist++) {
if ((plist->InvokeID == 0) &&
(plist->state == TSM_STATE_IDLE)) {
if ((plist->InvokeID == 0) && (plist->state == TSM_STATE_IDLE)) {
/* one is available! */
count++;
}