Fix (most) compilation warnings in Intel C++ Compiler (#38)

* Use BACNET_OBJECT_TYPE for all object type variables.

* Fix ICC "mixing enumerated type" warnings for assignments and parameters.

* Network Port: Use enums for state structs and remove erroneous bounds checks copy-pasted from IP_Subnet_Prefix setter.

* Fix ICC "unreachable statement" warnings.

* Fix ICC "unused variable" warnings when printing is disabled.

* Fix ICC "mixing enumerated type" warnings for struct initializers { 0 } by ensuring the first member is an integer type.

* Send_GetEvent_Global: Return 0 (invalid TSM invoke ID) instead of -1 = 255 (technically valid invoke ID) on failure.

* Fix ICC "pointless comparison" warnings.

* Fix wrong import in objects.c (memset being used).

* Fix signedness warnings and inconsistencies. Include -1 = 255 check in cov_address_get().

* Add some guards for BACAPP_LIGHTING_COMMAND to avoid errors/warnings.

* RPM test fixes

* Address requested changes. (#38)
This commit is contained in:
Geert Linders
2020-01-23 15:18:47 +01:00
committed by Steve Karg
parent 76abcaedd1
commit f8ce70470c
92 changed files with 438 additions and 263 deletions
+8 -7
View File
@@ -645,7 +645,7 @@ unsigned Device_Object_List_Count(void)
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
uint32_t array_index, int *object_type, uint32_t *instance)
uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance)
{
bool status = false;
uint32_t count = 0;
@@ -703,11 +703,11 @@ bool Device_Object_List_Identifier(
* @return True on success or else False if not found.
*/
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -742,7 +742,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(int 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;
@@ -860,7 +861,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
@@ -1110,7 +1111,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
bool status = false; /* return value */
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
int temp;
@@ -1427,7 +1428,7 @@ void Device_local_reporting(void)
struct object_functions *pObject;
uint32_t objects_count;
uint32_t object_instance;
int object_type;
BACNET_OBJECT_TYPE object_type;
uint32_t idx;
objects_count = Device_Object_List_Count();
+2 -2
View File
@@ -107,7 +107,7 @@ unsigned Device_Object_List_Count(void)
}
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -166,7 +166,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
+3 -3
View File
@@ -67,7 +67,7 @@ extern "C" {
bool Device_Valid_Object_Instance_Number(uint32_t object_id);
unsigned Device_Object_List_Count(void);
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
BACNET_DEVICE_STATUS Device_System_Status(void);
@@ -108,9 +108,9 @@ extern "C" {
void Device_Set_Database_Revision(uint8_t revision);
bool Device_Valid_Object_Name(const char *object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
char *Device_Valid_Object_Id(int object_type,
char *Device_Valid_Object_Id(BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Encode_Property_APDU(uint8_t * apdu,
+5 -5
View File
@@ -542,7 +542,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -576,11 +576,11 @@ bool Device_Object_List_Identifier(
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -611,7 +611,7 @@ bool Device_Valid_Object_Name(
}
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -650,7 +650,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
+2 -2
View File
@@ -116,7 +116,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -172,7 +172,7 @@ int Device_Read_Property(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
+3 -3
View File
@@ -81,7 +81,7 @@ extern "C" {
void);
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
BACNET_DEVICE_STATUS Device_System_Status(
@@ -143,10 +143,10 @@ extern "C" {
bool Device_Valid_Object_Name(
const char *object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
char *Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Encode_Property_APDU(
+2 -2
View File
@@ -94,7 +94,7 @@ bool bacnet_name_set(
bool bacnet_name_write_unique(
uint16_t offset,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
@@ -103,7 +103,7 @@ bool bacnet_name_write_unique(
bool status = false;
size_t length = 0;
uint8_t encoding = 0;
int duplicate_type = 0;
BACNET_OBJECT_TYPE duplicate_type = OBJECT_NONE;
uint32_t duplicate_instance = 0;
length = characterstring_length(char_string);
+1 -1
View File
@@ -48,7 +48,7 @@ extern "C" {
char *default_string);
bool bacnet_name_write_unique(
uint16_t offset,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance,
BACNET_CHARACTER_STRING * char_string,
BACNET_ERROR_CLASS * error_class,
+5 -5
View File
@@ -484,7 +484,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -518,11 +518,11 @@ bool Device_Object_List_Identifier(
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -553,7 +553,7 @@ bool Device_Valid_Object_Name(
}
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -592,7 +592,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
+7 -7
View File
@@ -746,7 +746,7 @@ unsigned Device_Object_List_Count(
*/
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -805,11 +805,11 @@ bool Device_Object_List_Identifier(
*/
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -845,7 +845,7 @@ bool Device_Valid_Object_Name(
* @return True if found, else False if no such Object in this device.
*/
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -1047,7 +1047,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
@@ -1349,7 +1349,7 @@ bool Device_Write_Property_Local(
bool status = false; /* return value */
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
int temp;
@@ -1755,7 +1755,7 @@ void Device_local_reporting(
struct object_functions *pObject;
uint32_t objects_count;
uint32_t object_instance;
int object_type;
BACNET_OBJECT_TYPE object_type;
uint32_t idx;
objects_count = Device_Object_List_Count();
+3 -3
View File
@@ -279,7 +279,7 @@ extern "C" {
void);
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
unsigned Device_Count(
@@ -358,10 +358,10 @@ extern "C" {
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Read_Property(
+2 -2
View File
@@ -216,7 +216,7 @@ unsigned Device_Object_List_Count(
/* for discovery, it must be consistent! */
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -296,7 +296,7 @@ int Device_Read_Property_Local(
int len = 0; /* apdu len intermediate value */
BACNET_BIT_STRING bit_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
BACNET_TIME local_time;
+2 -2
View File
@@ -194,7 +194,7 @@ unsigned Device_Object_List_Count(
/* for discovery, it must be consistent! */
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -273,7 +273,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
BACNET_TIME local_time;
+5 -5
View File
@@ -520,7 +520,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -562,11 +562,11 @@ bool Device_Object_List_Identifier(
*/
bool Device_Valid_Object_Name(
const char *object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -595,7 +595,7 @@ bool Device_Valid_Object_Name(
/* returns the name or NULL if not found */
char *Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
char *name = NULL; /* return value */
@@ -618,7 +618,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
+5 -5
View File
@@ -528,7 +528,7 @@ unsigned Device_Object_List_Count(
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -562,11 +562,11 @@ bool Device_Object_List_Identifier(
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -597,7 +597,7 @@ bool Device_Valid_Object_Name(
}
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -636,7 +636,7 @@ int Device_Read_Property_Local(
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
+5 -5
View File
@@ -506,7 +506,7 @@ unsigned Device_Object_List_Count(void)
}
bool Device_Object_List_Identifier(uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance)
{
bool status = false;
@@ -539,11 +539,11 @@ bool Device_Object_List_Identifier(uint32_t array_index,
}
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING * object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -573,7 +573,7 @@ bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING * object_name1,
return found;
}
bool Device_Valid_Object_Id(int object_type,
bool Device_Valid_Object_Id(BACNET_OBJECT_TYPE object_type,
uint32_t object_instance)
{
bool status = false; /* return value */
@@ -610,7 +610,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA * rpdata)
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
+10 -4
View File
@@ -96,9 +96,12 @@ int bacapp_decode_access_rule(uint8_t *apdu, BACNET_ACCESS_RULE *rule)
&apdu[apdu_len], 0, &time_range_specifier);
if (len < 0) {
return -1;
} else {
} else if (time_range_specifier < TIME_RANGE_SPECIFIER_MAX) {
apdu_len += len;
rule->time_range_specifier = time_range_specifier;
rule->time_range_specifier =
(BACNET_ACCESS_RULE_TIME_RANGE_SPECIFIER)time_range_specifier;
} else {
return -1;
}
} else {
return -1;
@@ -123,9 +126,12 @@ int bacapp_decode_access_rule(uint8_t *apdu, BACNET_ACCESS_RULE *rule)
&apdu[apdu_len], 2, &location_specifier);
if (len < 0) {
return -1;
} else {
} else if (location_specifier < LOCATION_SPECIFIER_MAX) {
apdu_len += len;
rule->location_specifier = location_specifier;
rule->location_specifier =
(BACNET_ACCESS_RULE_LOCATION_SPECIFIER)location_specifier;
} else {
return -1;
}
} else {
return -1;
+4 -2
View File
@@ -34,12 +34,14 @@
typedef enum {
TIME_RANGE_SPECIFIER_SPECIFIED = 0,
TIME_RANGE_SPECIFIER_ALWAYS = 1
TIME_RANGE_SPECIFIER_ALWAYS = 1,
TIME_RANGE_SPECIFIER_MAX = 2
} BACNET_ACCESS_RULE_TIME_RANGE_SPECIFIER;
typedef enum {
LOCATION_SPECIFIER_SPECIFIED = 0,
LOCATION_SPECIFIER_ALL = 1
LOCATION_SPECIFIER_ALL = 1,
LOCATION_SPECIFIER_MAX = 2
} BACNET_ACCESS_RULE_LOCATION_SPECIFIER;
typedef struct {
+1 -1
View File
@@ -78,7 +78,7 @@ int alarm_ack_encode_service_request(uint8_t *apdu, BACNET_ALARM_ACK_DATA *data)
apdu_len += len;
len = encode_context_object_id(&apdu[apdu_len], 1,
(int)data->eventObjectIdentifier.type,
data->eventObjectIdentifier.type,
data->eventObjectIdentifier.instance);
apdu_len += len;
+1 -1
View File
@@ -84,7 +84,7 @@ int arf_decode_service_request(
{
int len = 0;
int apdu_len = BACNET_STATUS_ERROR;
uint16_t object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
/* check for value pointers */
+2 -1
View File
@@ -34,8 +34,9 @@
#endif
typedef struct BACnet_Atomic_Read_File_Data {
BACNET_OBJECT_TYPE object_type;
/* number type first to avoid enum cast warning on = { 0 } */
uint32_t object_instance;
BACNET_OBJECT_TYPE object_type;
BACNET_FILE_ACCESS_METHOD access;
union {
struct {
+5 -2
View File
@@ -85,9 +85,12 @@ int bacapp_decode_authentication_factor(
len = decode_context_enumerated(&apdu[apdu_len], 0, &format_type);
if (len < 0) {
return -1;
} else {
} else if (format_type < AUTHENTICATION_FACTOR_MAX) {
apdu_len += len;
af->format_type = format_type;
af->format_type = (BACNET_AUTHENTICATION_FACTOR_TYPE)format_type;
} else {
/* FIXME: Maybe this should return BACNET_STATUS_REJECT */
return -1;
}
} else {
return -1;
+5 -2
View File
@@ -86,9 +86,12 @@ int bacapp_decode_authentication_factor_format(
len = decode_context_enumerated(&apdu[apdu_len], 0, &format_type);
if (len < 0) {
return -1;
} else {
} else if (format_type < AUTHENTICATION_FACTOR_MAX) {
apdu_len += len;
aff->format_type = format_type;
aff->format_type = (BACNET_AUTHENTICATION_FACTOR_TYPE)format_type;
} else {
/* FIXME: Maybe this should return BACNET_STATUS_REJECT */
return -1;
}
} else {
return -1;
+2 -2
View File
@@ -89,7 +89,7 @@ int awf_decode_service_request(
{
int len = 0;
int apdu_len = BACNET_STATUS_ERROR;
uint16_t object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
uint32_t i = 0;
@@ -102,7 +102,7 @@ int awf_decode_service_request(
if (len <= 0) {
return BACNET_STATUS_ERROR;
}
data->object_type = (BACNET_OBJECT_TYPE)object_type;
data->object_type = object_type;
data->object_instance = object_instance;
apdu_len = len;
if (apdu_len < apdu_len_max) {
+3 -3
View File
@@ -133,7 +133,7 @@ int bacapp_encode_application_data(
#if defined(BACAPP_OBJECT_ID)
case BACNET_APPLICATION_TAG_OBJECT_ID:
apdu_len = encode_application_object_id(&apdu[0],
(int)value->type.Object_Id.type,
value->type.Object_Id.type,
value->type.Object_Id.instance);
break;
#endif
@@ -241,7 +241,7 @@ int bacapp_decode_data(uint8_t *apdu,
#endif
#if defined(BACAPP_OBJECT_ID)
case BACNET_APPLICATION_TAG_OBJECT_ID: {
uint16_t object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
len = bacnet_object_id_decode(
&apdu[0], len_value_type, &object_type, &instance);
@@ -530,7 +530,7 @@ int bacapp_encode_context_data_value(uint8_t *apdu,
#if defined(BACAPP_OBJECT_ID)
case BACNET_APPLICATION_TAG_OBJECT_ID:
apdu_len = encode_context_object_id(&apdu[0],
context_tag_number, (int)value->type.Object_Id.type,
context_tag_number, value->type.Object_Id.type,
value->type.Object_Id.instance);
break;
#endif
+21 -19
View File
@@ -724,14 +724,15 @@ int encode_context_bitstring(
/* from clause 20.2.14 Encoding of an Object Identifier Value */
/* returns the number of apdu bytes consumed */
int decode_object_id(uint8_t *apdu, uint16_t *object_type, uint32_t *instance)
int decode_object_id(
uint8_t *apdu, BACNET_OBJECT_TYPE *object_type,uint32_t *instance)
{
uint32_t value = 0;
int len = 0;
len = decode_unsigned32(apdu, &value);
*object_type =
(uint16_t)(((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
*object_type = (BACNET_OBJECT_TYPE)
(((value >> BACNET_INSTANCE_BITS) & BACNET_MAX_OBJECT));
*instance = (value & BACNET_MAX_INSTANCE);
return len;
@@ -739,7 +740,7 @@ int decode_object_id(uint8_t *apdu, uint16_t *object_type, uint32_t *instance)
int bacnet_object_id_decode(uint8_t *apdu,
uint32_t len_value_type,
uint16_t *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *instance)
{
if (len_value_type != 4) {
@@ -763,7 +764,7 @@ int bacnet_object_id_decode(uint8_t *apdu,
*/
int bacnet_object_id_application_decode(uint8_t *apdu,
uint16_t apdu_len_max,
uint16_t *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
int len = 0;
@@ -812,7 +813,7 @@ int bacnet_object_id_application_decode(uint8_t *apdu,
int bacnet_object_id_context_decode(uint8_t *apdu,
uint16_t apdu_len_max,
uint8_t tag_value,
uint16_t *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
int apdu_len = 0;
@@ -849,7 +850,7 @@ int bacnet_object_id_context_decode(uint8_t *apdu,
int decode_context_object_id(uint8_t *apdu,
uint8_t tag_number,
uint16_t *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *instance)
{
int len = 0;
@@ -865,15 +866,14 @@ int decode_context_object_id(uint8_t *apdu,
/* from clause 20.2.14 Encoding of an Object Identifier Value */
/* returns the number of apdu bytes consumed */
int encode_bacnet_object_id(uint8_t *apdu, int object_type, uint32_t instance)
int encode_bacnet_object_id
(uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t instance)
{
uint32_t value = 0;
uint32_t type = 0;
int len = 0;
type = (uint32_t)object_type;
value = ((type & BACNET_MAX_OBJECT) << BACNET_INSTANCE_BITS) |
(instance & BACNET_MAX_INSTANCE);
value = (((uint32_t)object_type & BACNET_MAX_OBJECT)
<< BACNET_INSTANCE_BITS) | (instance & BACNET_MAX_INSTANCE);
len = encode_unsigned32(apdu, value);
return len;
@@ -882,8 +882,10 @@ int encode_bacnet_object_id(uint8_t *apdu, int object_type, uint32_t instance)
/* from clause 20.2.14 Encoding of an Object Identifier Value */
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_context_object_id(
uint8_t *apdu, uint8_t tag_number, int object_type, uint32_t instance)
int encode_context_object_id(uint8_t *apdu,
uint8_t tag_number,
BACNET_OBJECT_TYPE object_type,
uint32_t instance)
{
int len = 0;
@@ -899,7 +901,7 @@ int encode_context_object_id(
/* and 20.2.1 General Rules for Encoding BACnet Tags */
/* returns the number of apdu bytes consumed */
int encode_application_object_id(
uint8_t *apdu, int object_type, uint32_t instance)
uint8_t *apdu, BACNET_OBJECT_TYPE object_type, uint32_t instance)
{
int len = 0;
@@ -2896,8 +2898,8 @@ static void testBACDCodeObject(Test *pTest)
{
uint8_t object_array[32] = { 0 };
uint8_t encoded_array[32] = { 0 };
uint16_t type = OBJECT_BINARY_INPUT;
uint16_t decoded_type = OBJECT_ANALOG_OUTPUT;
BACNET_OBJECT_TYPE type = OBJECT_BINARY_INPUT;
BACNET_OBJECT_TYPE decoded_type = OBJECT_ANALOG_OUTPUT;
uint32_t instance = 123;
uint32_t decoded_instance = 0;
int len = 0;
@@ -3404,10 +3406,10 @@ static void testObjectIDContextDecodes(Test *pTest)
uint8_t large_context_tag = 0xfe;
/* 32 bit number */
uint16_t in_type;
BACNET_OBJECT_TYPE in_type;
uint32_t in_id;
uint16_t out_type;
BACNET_OBJECT_TYPE out_type;
uint32_t out_id;
in_type = 0xde;
+8 -8
View File
@@ -172,44 +172,44 @@ extern "C" {
/* returns the number of apdu bytes consumed */
int decode_object_id(
uint8_t * apdu,
uint16_t * object_type,
BACNET_OBJECT_TYPE * object_type,
uint32_t * object_instance);
int bacnet_object_id_decode(
uint8_t * apdu,
uint32_t len_value,
uint16_t * object_type,
BACNET_OBJECT_TYPE * object_type,
uint32_t * instance);
int bacnet_object_id_application_decode(
uint8_t * apdu,
uint16_t apdu_len_max,
uint16_t * object_type,
BACNET_OBJECT_TYPE * object_type,
uint32_t * object_instance);
int bacnet_object_id_context_decode(
uint8_t * apdu,
uint16_t apdu_len_max,
uint8_t tag_value,
uint16_t * object_type,
BACNET_OBJECT_TYPE * object_type,
uint32_t * instance);
int decode_context_object_id(
uint8_t * apdu,
uint8_t tag_number,
uint16_t * object_type,
BACNET_OBJECT_TYPE * object_type,
uint32_t * instance);
int encode_bacnet_object_id(
uint8_t * apdu,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t instance);
int encode_context_object_id(
uint8_t * apdu,
uint8_t tag_number,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t instance);
int encode_application_object_id(
uint8_t * apdu,
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t instance);
/* from clause 20.2.8 Encoding of an Octet String Value */
+2 -2
View File
@@ -126,7 +126,7 @@
#define BACNET_ARRAY_ALL 0xFFFFFFFFU
/* For device object property references with no device id defined */
#define BACNET_NO_DEV_ID 0xFFFFFFFFu
#define BACNET_NO_DEV_TYPE 0xFFFFu
#define BACNET_NO_DEV_TYPE OBJECT_NONE
/* Priority Array for commandable objects */
#define BACNET_NO_PRIORITY 0
#define BACNET_MIN_PRIORITY 1
@@ -165,7 +165,7 @@ typedef struct BACnet_MAC_Address BACNET_MAC_ADDRESS;
it might be better to have a packed encoding with a library to
easily access the data. */
typedef struct BACnet_Object_Id {
uint16_t type;
BACNET_OBJECT_TYPE type;
uint32_t instance;
} BACNET_OBJECT_ID;
+4 -4
View File
@@ -78,7 +78,7 @@ int bacapp_encode_device_obj_property_ref(
/* object-identifier [0] BACnetObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 0,
(int)value->objectIdentifier.type, value->objectIdentifier.instance);
value->objectIdentifier.type, value->objectIdentifier.instance);
apdu_len += len;
/* property-identifier [1] BACnetPropertyIdentifier */
len = encode_context_enumerated(
@@ -96,7 +96,7 @@ int bacapp_encode_device_obj_property_ref(
* omit */
if (value->deviceIdentifier.type == OBJECT_DEVICE) {
len = encode_context_object_id(&apdu[apdu_len], 3,
(int)value->deviceIdentifier.type,
value->deviceIdentifier.type,
value->deviceIdentifier.instance);
apdu_len += len;
}
@@ -231,13 +231,13 @@ int bacapp_encode_device_obj_ref(
* omit */
if (value->deviceIdentifier.type == OBJECT_DEVICE) {
len = encode_context_object_id(&apdu[apdu_len], 0,
(int)value->deviceIdentifier.type,
value->deviceIdentifier.type,
value->deviceIdentifier.instance);
apdu_len += len;
}
/* object-identifier [1] BACnetObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 1,
(int)value->objectIdentifier.type, value->objectIdentifier.instance);
value->objectIdentifier.type, value->objectIdentifier.instance);
apdu_len += len;
return apdu_len;
+2 -1
View File
@@ -31,9 +31,10 @@
#include "bacnet/bacenum.h"
typedef struct BACnetDeviceObjectPropertyReference {
/* number type first to avoid enum cast warning on = { 0 } */
uint32_t arrayIndex;
BACNET_OBJECT_ID objectIdentifier;
BACNET_PROPERTY_ID propertyIdentifier;
uint32_t arrayIndex;
BACNET_OBJECT_ID deviceIdentifier;
} BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE;
+8 -4
View File
@@ -564,7 +564,8 @@ typedef enum {
EVENT_STATE_FAULT = 1,
EVENT_STATE_OFFNORMAL = 2,
EVENT_STATE_HIGH_LIMIT = 3,
EVENT_STATE_LOW_LIMIT = 4
EVENT_STATE_LOW_LIMIT = 4,
EVENT_STATE_MAX = 5
} BACNET_EVENT_STATE;
typedef enum {
@@ -1165,7 +1166,8 @@ typedef enum {
typedef enum {
NOTIFY_ALARM = 0,
NOTIFY_EVENT = 1,
NOTIFY_ACK_NOTIFICATION = 2
NOTIFY_ACK_NOTIFICATION = 2,
NOTIFY_MAX = 3
} BACNET_NOTIFY_TYPE;
typedef enum {
@@ -1239,7 +1241,8 @@ typedef enum {
which is used to store decoding */
OBJECT_PROPRIETARY_MIN = 128,
OBJECT_PROPRIETARY_MAX = 1023,
MAX_BACNET_OBJECT_TYPE = 1024
MAX_BACNET_OBJECT_TYPE = 1024,
OBJECT_NONE = 0xFFFFu
} BACNET_OBJECT_TYPE;
typedef enum {
@@ -2090,7 +2093,8 @@ typedef enum {
ACCESS_AUTHENTICATION_FACTOR_DISABLE_DISABLED_LOST = 2,
ACCESS_AUTHENTICATION_FACTOR_DISABLE_DISABLED_STOLEN = 3,
ACCESS_AUTHENTICATION_FACTOR_DISABLE_DISABLED_DAMAGED = 4,
ACCESS_AUTHENTICATION_FACTOR_DISABLE_DISABLED_DESTROYED = 5
ACCESS_AUTHENTICATION_FACTOR_DISABLE_DISABLED_DESTROYED = 5,
ACCESS_AUTHENTICATION_FACTOR_DISABLE_MAX = 6
} BACNET_ACCESS_AUTHENTICATION_FACTOR_DISABLE;
/* Authorization Exemption */
+1 -1
View File
@@ -53,7 +53,7 @@ int bacapp_decode_property_state(uint8_t *apdu, BACNET_PROPERTY_STATE *value)
if (-1 == section_length) {
return -1;
}
value->tag = tagnum;
value->tag = (BACNET_PROPERTY_STATE_TYPE)tagnum;
len += section_length;
switch (value->tag) {
case BOOLEAN_VALUE:
-1
View File
@@ -193,7 +193,6 @@ int Send_Network_Layer_Message(BACNET_NETWORK_MESSAGE_TYPE network_message_type,
debug_printf("Not sent: %s message unsupported \n",
bactext_network_layer_msg_name(network_message_type));
return 0;
break; /* Will never reach this line */
}
if (dst != NULL) {
+8 -6
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 */) && (value >= DOOR_VALUE_LOCK) &&
(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;
@@ -233,7 +233,7 @@ bool Access_Door_Present_Value_Relinquish(
BACNET_DOOR_VALUE Access_Door_Relinquish_Default(uint32_t object_instance)
{
BACNET_DOOR_VALUE status = -1;
BACNET_DOOR_VALUE status = DOOR_VALUE_LOCK;
unsigned index = 0;
index = Access_Door_Instance_To_Index(object_instance);
if (index < MAX_ACCESS_DOORS) {
@@ -467,7 +467,7 @@ 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,
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
@@ -505,7 +505,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED,
&wp_data->error_class, &wp_data->error_code);
if (status) {
ad_descr[object_index].door_status = value.type.Enumerated;
ad_descr[object_index].door_status =
(BACNET_DOOR_STATUS)value.type.Enumerated;
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -518,7 +519,8 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED,
&wp_data->error_class, &wp_data->error_code);
if (status) {
ad_descr[object_index].lock_status = value.type.Enumerated;
ad_descr[object_index].lock_status =
(BACNET_LOCK_STATUS)value.type.Enumerated;
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -532,7 +534,7 @@ bool Access_Door_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
&wp_data->error_class, &wp_data->error_code);
if (status) {
ad_descr[object_index].door_alarm_state =
value.type.Enumerated;
(BACNET_DOOR_ALARM_STATE)value.type.Enumerated;
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
+2 -1
View File
@@ -315,7 +315,8 @@ bool Access_Zone_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED,
&wp_data->error_class, &wp_data->error_code);
if (status) {
az_descr[object_index].reliability = value.type.Enumerated;
az_descr[object_index].reliability =
(BACNET_RELIABILITY)value.type.Enumerated;
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
+3
View File
@@ -1105,6 +1105,9 @@ void Analog_Input_Intrinsic_Reporting(uint32_t object_instance)
CurrentAI->Acked_Transitions[TRANSITION_TO_NORMAL]
.Time_Stamp = event_data.timeStamp.value.dateTime;
break;
default: /* shouldn't happen */
break;
}
}
}
+3
View File
@@ -1111,6 +1111,9 @@ void Analog_Value_Intrinsic_Reporting(uint32_t object_instance)
CurrentAV->Acked_Transitions[TRANSITION_TO_NORMAL]
.Time_Stamp = event_data.timeStamp.value.dateTime;
break;
default: /* shouldn't happen */
break;
}
}
}
+5 -5
View File
@@ -232,14 +232,14 @@ unsigned Channel_Last_Priority(uint32_t object_instance)
BACNET_WRITE_STATUS Channel_Write_Status(uint32_t object_instance)
{
unsigned index = 0;
unsigned priority = 0;
BACNET_WRITE_STATUS write_status = BACNET_WRITE_STATUS_IDLE;
index = Channel_Instance_To_Index(object_instance);
if (index < BACNET_CHANNELS_MAX) {
priority = Channel[index].Write_Status;
write_status = Channel[index].Write_Status;
}
return priority;
return write_status;
}
/**
@@ -451,12 +451,12 @@ unsigned Channel_Reference_List_Member_Element_Add(uint32_t object_instance,
* zero if not added
*/
unsigned Channel_Reference_List_Member_Local_Add(uint32_t object_instance,
uint16_t type,
BACNET_OBJECT_TYPE type,
uint32_t instance,
BACNET_PROPERTY_ID propertyIdentifier,
uint32_t arrayIndex)
{
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE member = { { 0 } };
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE member = { 0 };
member.objectIdentifier.type = type;
member.objectIdentifier.instance = instance;
+1 -1
View File
@@ -166,7 +166,7 @@ extern "C" {
BACNET_DEVICE_OBJECT_PROPERTY_REFERENCE *pMemberSrc);
unsigned Channel_Reference_List_Member_Local_Add(
uint32_t object_instance,
uint16_t type,
BACNET_OBJECT_TYPE type,
uint32_t instance,
BACNET_PROPERTY_ID propertyIdentifier,
uint32_t arrayIndex);
@@ -562,7 +562,7 @@ unsigned Device_Object_List_Count(void)
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
uint32_t array_index, int *object_type, uint32_t *instance)
uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance)
{
bool status = false;
unsigned count = 0;
@@ -620,11 +620,11 @@ bool Device_Object_List_Identifier(
* @return True on success or else False if not found.
*/
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -659,7 +659,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(int 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;
@@ -851,7 +852,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
BACNET_BIT_STRING bit_string;
BACNET_CHARACTER_STRING char_string;
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
+4 -3
View File
@@ -50,6 +50,7 @@
#include "bacnet/config.h" /* the custom stuff */
#include "bacnet/basic/object/device.h"
#include "bacnet/basic/services.h"
#include "bacnet/lighting.h"
#include "bacnet/proplist.h"
#include "bacnet/timestamp.h"
#include "bacnet/basic/object/command.h"
@@ -71,8 +72,7 @@ int cl_encode_apdu(uint8_t *apdu, BACNET_ACTION_LIST *bcl)
int len = 0;
int apdu_len = 0;
if (bcl->Device_Id.instance >= 0 &&
bcl->Device_Id.instance <= BACNET_MAX_INSTANCE) {
if (bcl->Device_Id.instance <= BACNET_MAX_INSTANCE) {
len = encode_context_object_id(
&apdu[apdu_len], 0, bcl->Device_Id.type, bcl->Device_Id.instance);
if (len < 0) {
@@ -269,13 +269,14 @@ int cl_decode_apdu(uint8_t *apdu,
&bcl->Value.type.Object_Id.type,
&bcl->Value.type.Object_Id.instance);
break;
#if defined(BACAPP_LIGHTING_COMMAND)
case BACNET_APPLICATION_TAG_LIGHTING_COMMAND:
len = lighting_command_decode(&apdu[dec_len], apdu_len - dec_len,
&bcl->Value.type.Lighting_Command);
break;
#endif
default:
return BACNET_STATUS_REJECT;
break;
}
if (len > 0) {
dec_len += len;
@@ -337,7 +337,8 @@ bool Credential_Data_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
WPValidateArgType(&value, BACNET_APPLICATION_TAG_ENUMERATED,
&wp_data->error_class, &wp_data->error_code);
if (status) {
cdi_descr[object_index].reliability = value.type.Enumerated;
cdi_descr[object_index].reliability =
(BACNET_RELIABILITY)value.type.Enumerated;
}
} else {
wp_data->error_class = ERROR_CLASS_PROPERTY;
+11 -9
View File
@@ -216,7 +216,7 @@ static object_functions_t My_Object_Table[] = {
Trend_Log_Write_Property, Trend_Log_Property_Lists, TrendLogGetRRInfo,
NULL /* Iterator */, NULL /* Value_Lists */, NULL /* COV */,
NULL /* COV Clear */, NULL /* Intrinsic Reporting */ },
#if (BACNET_PROTOCOL_REVISION >= 14)
#if (BACNET_PROTOCOL_REVISION >= 14) && defined(BACAPP_LIGHTING_COMMAND)
{ OBJECT_LIGHTING_OUTPUT, Lighting_Output_Init, Lighting_Output_Count,
Lighting_Output_Index_To_Instance, Lighting_Output_Valid_Instance,
Lighting_Output_Object_Name, Lighting_Output_Read_Property,
@@ -827,7 +827,7 @@ unsigned Device_Object_List_Count(void)
* @return True if found, else false.
*/
bool Device_Object_List_Identifier(
uint32_t array_index, int *object_type, uint32_t *instance)
uint32_t array_index, BACNET_OBJECT_TYPE *object_type, uint32_t *instance)
{
bool status = false;
uint32_t count = 0;
@@ -885,11 +885,11 @@ bool Device_Object_List_Identifier(
* @return True on success or else False if not found.
*/
bool Device_Valid_Object_Name(BACNET_CHARACTER_STRING *object_name1,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t *object_instance)
{
bool found = false;
int type = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE;
uint32_t instance;
uint32_t max_objects = 0, i = 0;
bool check_id = false;
@@ -924,7 +924,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(int 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;
@@ -1072,7 +1073,7 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
BACNET_BIT_STRING bit_string = { 0 };
BACNET_CHARACTER_STRING char_string = { 0 };
uint32_t i = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t instance = 0;
uint32_t count = 0;
uint8_t *apdu = NULL;
@@ -1183,7 +1184,8 @@ int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata)
pObject = Object_Table;
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
if ((pObject->Object_Count) && (pObject->Object_Count() > 0)) {
bitstring_set_bit(&bit_string, pObject->Object_Type, true);
bitstring_set_bit(
&bit_string, (uint8_t)pObject->Object_Type, true);
}
pObject++;
}
@@ -1361,7 +1363,7 @@ bool Device_Write_Property_Local(BACNET_WRITE_PROPERTY_DATA *wp_data)
bool status = false; /* return value */
int len = 0;
BACNET_APPLICATION_DATA_VALUE value;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
int result = 0;
#if defined(BACNET_TIME_MASTER)
@@ -1758,7 +1760,7 @@ void Device_local_reporting(void)
struct object_functions *pObject;
uint32_t objects_count;
uint32_t object_instance;
int object_type;
BACNET_OBJECT_TYPE object_type;
uint32_t idx;
objects_count = Device_Object_List_Count();
+3 -3
View File
@@ -279,7 +279,7 @@ extern "C" {
void);
bool Device_Object_List_Identifier(
uint32_t array_index,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * instance);
unsigned Device_Count(
@@ -358,10 +358,10 @@ extern "C" {
bool Device_Valid_Object_Name(
BACNET_CHARACTER_STRING * object_name,
int *object_type,
BACNET_OBJECT_TYPE *object_type,
uint32_t * object_instance);
bool Device_Valid_Object_Id(
int object_type,
BACNET_OBJECT_TYPE object_type,
uint32_t object_instance);
int Device_Read_Property(
+3 -3
View File
@@ -112,8 +112,8 @@ uint16_t iCurrent_Device_Idx = 0;
* @param Object_Instance [in] Set the new Device to this instance number.
* @param sObject_Name [in] Use this Object Name for the Device.
* @param sDescription [in] Set this Description for the Device.
* @return The index of this instance in the Devices[] array,
* or -1 if there isn't enough room to add this Device.
* @return The index of this instance in the Devices[] array, or UINT16_MAX if
* there isn't enough room to add this Device.
*/
uint16_t Add_Routed_Device(uint32_t Object_Instance,
BACNET_CHARACTER_STRING *sObject_Name,
@@ -141,7 +141,7 @@ uint16_t Add_Routed_Device(uint32_t Object_Instance,
pDev->Database_Revision = 0; /* Reset/Initialize now */
return i;
} else {
return -1;
return UINT16_MAX;
}
}
+1 -1
View File
@@ -330,7 +330,7 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
object_index = Life_Safety_Point_Instance_To_Index(
wp_data->object_instance);
Life_Safety_Point_Mode[object_index] =
value.type.Enumerated;
(BACNET_LIFE_SAFETY_MODE)value.type.Enumerated;
} else {
status = false;
wp_data->error_class = ERROR_CLASS_PROPERTY;
+1 -1
View File
@@ -581,7 +581,7 @@ bool Multistate_Input_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
BACNET_APPLICATION_DATA_VALUE value;
uint32_t max_states = 0;
uint32_t array_index = 0;
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
/* decode the first chunk of the request */
+16 -20
View File
@@ -54,7 +54,7 @@ struct bacnet_ipv4_port {
uint8_t IP_Gateway[4];
uint8_t IP_DNS_Server[BIP_DNS_MAX][4];
uint16_t Port;
uint8_t Mode;
BACNET_IP_MODE Mode;
bool IP_DHCP_Enable;
uint32_t IP_DHCP_Lease_Seconds;
uint32_t IP_DHCP_Lease_Seconds_Remaining;
@@ -75,7 +75,7 @@ struct bacnet_ipv6_port {
uint8_t IP_Multicast_Address[IPV6_ADDR_SIZE];
uint8_t IP_DHCP_Server[IPV6_ADDR_SIZE];
uint16_t Port;
uint8_t Mode;
BACNET_IP_MODE Mode;
char Zone_Index[ZONE_INDEX_SIZE];
};
@@ -92,12 +92,12 @@ struct mstp_port {
struct object_data {
uint32_t Instance_Number;
char *Object_Name;
uint8_t Reliability;
BACNET_RELIABILITY Reliability;
bool Out_Of_Service : 1;
bool Changes_Pending : 1;
uint8_t Network_Type;
uint16_t Network_Number;
uint8_t Quality;
BACNET_PORT_QUALITY Quality;
uint16_t APDU_Length;
float Link_Speed;
union {
@@ -429,7 +429,7 @@ bool Network_Port_Reliability_Set(
index = Network_Port_Instance_To_Index(object_instance);
if (index < BACNET_NETWORK_PORTS_MAX) {
Object_List[index].Reliability = (uint8_t)value;
Object_List[index].Reliability = value;
status = true;
}
@@ -558,7 +558,7 @@ bool Network_Port_Quality_Set(
index = Network_Port_Instance_To_Index(object_instance);
if (index < BACNET_NETWORK_PORTS_MAX) {
Object_List[index].Quality = (uint8_t)value;
Object_List[index].Quality = value;
status = true;
}
@@ -1182,7 +1182,7 @@ bool Network_Port_BIP_Port_Set(uint32_t object_instance, uint16_t value)
*/
BACNET_IP_MODE Network_Port_BIP_Mode(uint32_t object_instance)
{
BACNET_IP_MODE value = 0;
BACNET_IP_MODE value = BACNET_IP_MODE_NORMAL;
unsigned index = 0;
index = Network_Port_Instance_To_Index(object_instance);
@@ -1212,13 +1212,11 @@ bool Network_Port_BIP_Mode_Set(uint32_t object_instance, BACNET_IP_MODE value)
index = Network_Port_Instance_To_Index(object_instance);
if (index < BACNET_NETWORK_PORTS_MAX) {
if (Object_List[index].Network_Type == PORT_TYPE_BIP) {
if (value <= 32) {
if (Object_List[index].Network.IPv4.Mode != value) {
Object_List[index].Changes_Pending = true;
}
Object_List[index].Network.IPv4.Mode = value;
status = true;
if (Object_List[index].Network.IPv4.Mode != value) {
Object_List[index].Changes_Pending = true;
}
Object_List[index].Network.IPv4.Mode = value;
status = true;
}
}
@@ -1287,7 +1285,7 @@ bool Network_Port_BBMD_Accept_FD_Registrations_Set(
*/
BACNET_IP_MODE Network_Port_BIP6_Mode(uint32_t object_instance)
{
BACNET_IP_MODE value = 0;
BACNET_IP_MODE value = BACNET_IP_MODE_NORMAL;
unsigned index = 0;
index = Network_Port_Instance_To_Index(object_instance);
@@ -1317,13 +1315,11 @@ bool Network_Port_BIP6_Mode_Set(uint32_t object_instance, BACNET_IP_MODE value)
index = Network_Port_Instance_To_Index(object_instance);
if (index < BACNET_NETWORK_PORTS_MAX) {
if (Object_List[index].Network_Type == PORT_TYPE_BIP6) {
if (value <= 32) {
if (Object_List[index].Network.IPv4.Mode != value) {
Object_List[index].Changes_Pending = true;
}
Object_List[index].Network.IPv6.Mode = value;
status = true;
if (Object_List[index].Network.IPv4.Mode != value) {
Object_List[index].Changes_Pending = true;
}
Object_List[index].Network.IPv6.Mode = value;
status = true;
}
}
+1 -1
View File
@@ -35,7 +35,7 @@
#include <stddef.h>
#include <stdlib.h>
#include <stdio.h>
#include <memory.h>
#include <string.h>
#include "bacnet/basic/sys/keylist.h"
#include "bacnet/basic/object/objects.h"
+2 -1
View File
@@ -545,7 +545,8 @@ bool Trend_Log_Write_Property(BACNET_WRITE_PROPERTY_DATA *wp_data)
&wp_data->error_class, &wp_data->error_code);
if (status) {
if (value.type.Enumerated != LOGGING_TYPE_COV) {
CurrentLog->LoggingType = value.type.Enumerated;
CurrentLog->LoggingType =
(BACNET_LOGGING_TYPE)value.type.Enumerated;
if (value.type.Enumerated == LOGGING_TYPE_POLLED) {
/* As per 12.25.27 pick a suitable default if interval
* is 0 */
+6 -1
View File
@@ -79,7 +79,9 @@ void handler_alarm_ack(uint8_t *service_request,
{
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
int ack_result = 0;
BACNET_ADDRESS my_address;
BACNET_NPDU_DATA npdu_data;
@@ -182,7 +184,10 @@ void handler_alarm_ack(uint8_t *service_request,
AA_ABORT:
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+8 -5
View File
@@ -68,7 +68,7 @@ typedef struct BACnet_COV_Subscription_Flags {
typedef struct BACnet_COV_Subscription {
BACNET_COV_SUBSCRIPTION_FLAGS flag;
uint8_t dest_index;
unsigned dest_index;
uint8_t invokeID; /* for confirmed COV */
uint32_t subscriberProcessIdentifier;
uint32_t lifetime; /* optional */
@@ -92,7 +92,7 @@ static BACNET_COV_ADDRESS COV_Addresses[MAX_COV_ADDRESSES];
*
* @return true if valid address, false if not valid or not found
*/
static BACNET_ADDRESS *cov_address_get(int index)
static BACNET_ADDRESS *cov_address_get(unsigned index)
{
BACNET_ADDRESS *cov_dest = NULL;
@@ -324,8 +324,9 @@ void handler_cov_init(void)
unsigned index = 0;
for (index = 0; index < MAX_COV_SUBCRIPTIONS; index++) {
/* initialize with invalid COV address */
COV_Subscriptions[index].flag.valid = false;
COV_Subscriptions[index].dest_index = -1;
COV_Subscriptions[index].dest_index = MAX_COV_ADDRESSES;
COV_Subscriptions[index].subscriberProcessIdentifier = 0;
COV_Subscriptions[index].monitoredObjectIdentifier.type =
OBJECT_ANALOG_INPUT;
@@ -374,8 +375,9 @@ static bool cov_list_subscribe(BACNET_ADDRESS *src,
address_match) {
existing_entry = true;
if (cov_data->cancellationRequest) {
/* initialize with invalid COV address */
COV_Subscriptions[index].flag.valid = false;
COV_Subscriptions[index].dest_index = -1;
COV_Subscriptions[index].dest_index = MAX_COV_ADDRESSES;
cov_address_remove_unused();
} else {
COV_Subscriptions[index].dest_index = cov_address_add(src);
@@ -536,8 +538,9 @@ static void cov_lifetime_expiration_handler(
COV_Subscriptions[index].lifetime);
fprintf(stderr, "\n");
#endif
/* initialize with invalid COV address */
COV_Subscriptions[index].flag.valid = false;
COV_Subscriptions[index].dest_index = -1;
COV_Subscriptions[index].dest_index = MAX_COV_ADDRESSES;
cov_address_remove_unused();
if (COV_Subscriptions[index].flag.issueConfirmedNotifications) {
if (COV_Subscriptions[index].invokeID) {
+6 -1
View File
@@ -85,7 +85,9 @@ void handler_get_event_information(uint8_t *service_request,
BACNET_NPDU_DATA npdu_data;
bool error = false;
bool more_events = false;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_ERROR_CLASS error_class = ERROR_CLASS_OBJECT;
BACNET_ERROR_CODE error_code = ERROR_CODE_UNKNOWN_OBJECT;
BACNET_ADDRESS my_address;
@@ -222,7 +224,10 @@ GET_EVENT_ERROR:
}
GET_EVENT_ABORT:
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -51,7 +51,9 @@ void handler_lso(uint8_t *service_request,
int len = 0;
int pdu_len = 0;
BACNET_NPDU_DATA npdu_data;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_ADDRESS my_address;
/* encode the NPDU portion of the packet */
@@ -106,7 +108,10 @@ void handler_lso(uint8_t *service_request,
LSO_ABORT:
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+7 -1
View File
@@ -46,13 +46,17 @@
*/
void rp_ack_print_data(BACNET_READ_PROPERTY_DATA *data)
{
#ifdef BACAPP_PRINT_ENABLED
BACNET_OBJECT_PROPERTY_VALUE object_value; /* for bacapp printing */
#endif
BACNET_APPLICATION_DATA_VALUE value; /* for decode value data */
int len = 0;
uint8_t *application_data;
int application_data_len;
bool first_value = true;
#if PRINT_ENABLED
bool print_brace = false;
#endif
if (data) {
application_data = data->application_data;
@@ -66,15 +70,17 @@ void rp_ack_print_data(BACNET_READ_PROPERTY_DATA *data)
first_value = false;
#if PRINT_ENABLED
fprintf(stdout, "{");
#endif
print_brace = true;
#endif
}
#ifdef BACAPP_PRINT_ENABLED
object_value.object_type = data->object_type;
object_value.object_instance = data->object_instance;
object_value.object_property = data->object_property;
object_value.array_index = data->array_index;
object_value.value = &value;
bacapp_print_value(stdout, &object_value);
#endif
if (len > 0) {
if (len < application_data_len) {
application_data += len;
+9 -2
View File
@@ -151,7 +151,8 @@ int rpm_ack_decode_service_request(
apdu += len;
/* FIXME: we could validate that the tag is enumerated... */
len = decode_enumerated(apdu, len_value, &error_value);
rpm_property->error.error_class = error_value;
rpm_property->error.error_class =
(BACNET_ERROR_CLASS)error_value;
decoded_len += len;
apdu_len -= len;
apdu += len;
@@ -162,7 +163,7 @@ int rpm_ack_decode_service_request(
apdu += len;
/* FIXME: we could validate that the tag is enumerated... */
len = decode_enumerated(apdu, len_value, &error_value);
rpm_property->error.error_code = error_value;
rpm_property->error.error_code = (BACNET_ERROR_CODE)error_value;
decoded_len += len;
apdu_len -= len;
apdu += len;
@@ -195,7 +196,9 @@ int rpm_ack_decode_service_request(
/* for debugging... */
void rpm_ack_print_data(BACNET_READ_ACCESS_DATA *rpm_data)
{
#ifdef BACAPP_PRINT_ENABLED
BACNET_OBJECT_PROPERTY_VALUE object_value; /* for bacapp printing */
#endif
BACNET_PROPERTY_REFERENCE *listOfProperties;
BACNET_APPLICATION_DATA_VALUE *value;
#if PRINT_ENABLED
@@ -236,15 +239,19 @@ void rpm_ack_print_data(BACNET_READ_ACCESS_DATA *rpm_data)
array_value = false;
}
#endif
#ifdef BACAPP_PRINT_ENABLED
object_value.object_type = rpm_data->object_type;
object_value.object_instance = rpm_data->object_instance;
#endif
while (value) {
#ifdef BACAPP_PRINT_ENABLED
object_value.object_property =
listOfProperties->propertyIdentifier;
object_value.array_index =
listOfProperties->propertyArrayIndex;
object_value.value = value;
bacapp_print_value(stdout, &object_value);
#endif
#if PRINT_ENABLED
if (value->next) {
fprintf(stdout, ",\r\n ");
+6 -1
View File
@@ -109,7 +109,9 @@ void handler_read_range(uint8_t *service_request,
int pdu_len = 0;
BACNET_NPDU_DATA npdu_data;
bool error = false;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_ADDRESS my_address;
data.error_class = ERROR_CLASS_OBJECT;
@@ -180,7 +182,10 @@ void handler_read_range(uint8_t *service_request,
}
RR_ABORT:
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
src, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+7 -1
View File
@@ -42,13 +42,17 @@
/* for debugging... */
static void PrintReadRangeData(BACNET_READ_RANGE_DATA *data)
{
#ifdef BACAPP_PRINT_ENABLED
BACNET_OBJECT_PROPERTY_VALUE object_value; /* for bacapp printing */
#endif
BACNET_APPLICATION_DATA_VALUE value; /* for decode value data */
int len = 0;
uint8_t *application_data;
int application_data_len;
bool first_value = true;
#if PRINT_ENABLED
bool print_brace = false;
#endif
if (data) {
application_data = data->application_data;
@@ -62,15 +66,17 @@ static void PrintReadRangeData(BACNET_READ_RANGE_DATA *data)
first_value = false;
#if PRINT_ENABLED
fprintf(stdout, "{");
#endif
print_brace = true;
#endif
}
#ifdef BACAPP_PRINT_ENABLED
object_value.object_type = data->object_type;
object_value.object_instance = data->object_instance;
object_value.object_property = data->object_property;
object_value.array_index = data->array_index;
object_value.value = &value;
bacapp_print_value(stdout, &object_value);
#endif
if (len > 0) {
if (len < application_data_len) {
application_data += len;
+5 -2
View File
@@ -63,8 +63,8 @@ void handler_ucov_notification(
BACNET_PROPERTY_VALUE property_value[MAX_COV_PROPERTIES];
#if PRINT_ENABLED
BACNET_PROPERTY_VALUE *pProperty_value = NULL;
#endif
int len = 0;
#endif
/* src not needed for this application */
(void)src;
@@ -76,7 +76,10 @@ void handler_ucov_notification(
fprintf(stderr, "UCOV: Received Notification!\n");
#endif
/* decode the service request only */
len = cov_notify_decode_service_request(
#if PRINT_ENABLED
len =
#endif
cov_notify_decode_service_request(
service_request, service_len, &cov_data);
#if PRINT_ENABLED
if (len > 0) {
+7 -1
View File
@@ -41,13 +41,17 @@
void private_transfer_print_data(BACNET_PRIVATE_TRANSFER_DATA *private_data)
{
#ifdef BACAPP_PRINT_ENABLED
BACNET_OBJECT_PROPERTY_VALUE object_value; /* for bacapp printing */
#endif
BACNET_APPLICATION_DATA_VALUE value; /* for decode value data */
int len = 0;
uint8_t *application_data;
int application_data_len;
bool first_value = true;
#if PRINT_ENABLED
bool print_brace = false;
#endif
if (private_data) {
#if PRINT_ENABLED
@@ -65,16 +69,18 @@ void private_transfer_print_data(BACNET_PRIVATE_TRANSFER_DATA *private_data)
first_value = false;
#if PRINT_ENABLED
fprintf(stdout, "{");
#endif
print_brace = true;
#endif
}
/* private transfer doesn't provide any clues */
#ifdef BACAPP_PRINT_ENABLED
object_value.object_type = MAX_BACNET_OBJECT_TYPE;
object_value.object_instance = BACNET_MAX_INSTANCE;
object_value.object_property = MAX_BACNET_PROPERTY_ID;
object_value.array_index = BACNET_ARRAY_ALL;
object_value.value = &value;
bacapp_print_value(stdout, &object_value);
#endif
if (len > 0) {
if (len < application_data_len) {
application_data += len;
+1 -1
View File
@@ -43,7 +43,7 @@
*/
static void match_name_or_object(BACNET_WHO_HAS_DATA *data)
{
int object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
bool found = false;
BACNET_CHARACTER_STRING object_name;
+6 -1
View File
@@ -55,7 +55,9 @@ uint8_t Send_Alarm_Acknowledgement(
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
if (!dcc_communication_enabled()) {
@@ -85,7 +87,10 @@ uint8_t Send_Alarm_Acknowledgement(
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -55,7 +55,9 @@ uint8_t Send_Atomic_Read_File_Stream(uint32_t device_id,
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_ATOMIC_READ_FILE_DATA data;
/* if we are forbidden to send, don't send! */
@@ -92,7 +94,10 @@ uint8_t Send_Atomic_Read_File_Stream(uint32_t device_id,
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -55,7 +55,9 @@ uint8_t Send_Atomic_Write_File_Stream(uint32_t device_id,
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_ATOMIC_WRITE_FILE_DATA data;
/* if we are forbidden to send, don't send! */
@@ -94,7 +96,10 @@ uint8_t Send_Atomic_Write_File_Stream(uint32_t device_id,
if ((unsigned)pdu_len <= max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -50,7 +50,9 @@ uint8_t Send_CEvent_Notify(
{
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
BACNET_ADDRESS dest;
BACNET_ADDRESS my_address;
@@ -86,7 +88,10 @@ uint8_t Send_CEvent_Notify(
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0) {
+6 -1
View File
@@ -64,7 +64,9 @@ uint8_t Send_Device_Communication_Control_Request(uint32_t device_id,
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_CHARACTER_STRING password_string;
BACNET_NPDU_DATA npdu_data;
@@ -98,7 +100,10 @@ uint8_t Send_Device_Communication_Control_Request(uint32_t device_id,
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+7 -2
View File
@@ -52,7 +52,9 @@ uint8_t Send_GetEvent(BACNET_ADDRESS *target_address,
{
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
uint8_t invoke_id = 0;
BACNET_NPDU_DATA npdu_data;
BACNET_ADDRESS my_address;
@@ -70,7 +72,10 @@ uint8_t Send_GetEvent(BACNET_ADDRESS *target_address,
len = getevent_encode_apdu(&Handler_Transmit_Buffer[pdu_len], invoke_id,
lastReceivedObjectIdentifier);
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
target_address, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
@@ -97,7 +102,7 @@ uint8_t Send_GetEvent_Global(void)
BACNET_ADDRESS dest;
if (!dcc_communication_enabled()) {
return -1;
return 0;
}
datalink_get_broadcast_address(&dest);
+6 -1
View File
@@ -55,7 +55,9 @@ uint8_t Send_Life_Safety_Operation_Data(
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
if (!dcc_communication_enabled()) {
@@ -85,7 +87,10 @@ uint8_t Send_Life_Safety_Operation_Data(
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -61,7 +61,9 @@ uint8_t Send_Reinitialize_Device_Request(
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_CHARACTER_STRING password_string;
BACNET_NPDU_DATA npdu_data;
@@ -95,7 +97,10 @@ uint8_t Send_Reinitialize_Device_Request(
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -54,7 +54,9 @@ uint8_t Send_ReadRange_Request(uint32_t device_id, /* destination device */
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
if (!dcc_communication_enabled()) {
@@ -91,7 +93,10 @@ uint8_t Send_ReadRange_Request(uint32_t device_id, /* destination device */
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -65,7 +65,9 @@ uint8_t Send_Read_Property_Multiple_Request(uint8_t *pdu,
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
if (!dcc_communication_enabled()) {
@@ -98,7 +100,10 @@ uint8_t Send_Read_Property_Multiple_Request(uint8_t *pdu,
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(
invoke_id, &dest, &npdu_data, &pdu[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
fprintf(stderr,
+12 -2
View File
@@ -54,7 +54,9 @@ void Send_TimeSync_Remote(
{
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
BACNET_ADDRESS my_address;
@@ -71,7 +73,10 @@ void Send_TimeSync_Remote(
len = timesync_encode_apdu(&Handler_Transmit_Buffer[pdu_len], bdate, btime);
pdu_len += len;
/* send it out the datalink */
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
@@ -106,7 +111,9 @@ void Send_TimeSyncUTC_Remote(
{
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
BACNET_ADDRESS my_address;
@@ -123,7 +130,10 @@ void Send_TimeSyncUTC_Remote(
len = timesync_utc_encode_apdu(
&Handler_Transmit_Buffer[pdu_len], bdate, btime);
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+12 -2
View File
@@ -58,7 +58,9 @@ void Send_WhoHas_Name(
int len = 0;
int pdu_len = 0;
BACNET_ADDRESS dest;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_WHO_HAS_DATA data;
BACNET_NPDU_DATA npdu_data;
BACNET_ADDRESS my_address;
@@ -83,7 +85,10 @@ void Send_WhoHas_Name(
len = whohas_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &data);
pdu_len += len;
/* send the data */
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
@@ -111,7 +116,9 @@ void Send_WhoHas_Object(int32_t low_limit,
int len = 0;
int pdu_len = 0;
BACNET_ADDRESS dest;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_WHO_HAS_DATA data;
BACNET_NPDU_DATA npdu_data;
BACNET_ADDRESS my_address;
@@ -136,7 +143,10 @@ void Send_WhoHas_Object(int32_t low_limit,
data.object.identifier.instance = object_instance;
len = whohas_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &data);
pdu_len += len;
bytes_sent = datalink_send_pdu(
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(
&dest, &npdu_data, &Handler_Transmit_Buffer[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0)
+6 -1
View File
@@ -68,7 +68,9 @@ uint8_t Send_Write_Property_Multiple_Request(uint8_t *pdu,
bool status = false;
int len = 0;
int pdu_len = 0;
#if PRINT_ENABLED
int bytes_sent = 0;
#endif
BACNET_NPDU_DATA npdu_data;
/* if we are forbidden to send, don't send! */
@@ -99,7 +101,10 @@ uint8_t Send_Write_Property_Multiple_Request(uint8_t *pdu,
if ((unsigned)pdu_len < max_apdu) {
tsm_set_confirmed_unsegmented_transaction(
invoke_id, &dest, &npdu_data, &pdu[0], (uint16_t)pdu_len);
bytes_sent = datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
#if PRINT_ENABLED
bytes_sent =
#endif
datalink_send_pdu(&dest, &npdu_data, &pdu[0], pdu_len);
#if PRINT_ENABLED
if (bytes_sent <= 0) {
fprintf(stderr,
+6 -6
View File
@@ -67,7 +67,7 @@ static int notify_encode_apdu(
apdu_len += len;
/* tag 2 - monitoredObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 2,
(int)data->monitoredObjectIdentifier.type,
data->monitoredObjectIdentifier.type,
data->monitoredObjectIdentifier.instance);
apdu_len += len;
/* tag 3 - timeRemaining */
@@ -182,7 +182,7 @@ int cov_notify_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t decoded_value = 0; /* for decoding */
uint16_t decoded_type = 0; /* for decoding */
BACNET_OBJECT_TYPE decoded_type = OBJECT_NONE; /* for decoding */
uint32_t property = 0; /* for decoding */
BACNET_PROPERTY_VALUE *value = NULL; /* value in list */
BACNET_APPLICATION_DATA_VALUE *app_data = NULL;
@@ -350,7 +350,7 @@ int cov_subscribe_encode_apdu(uint8_t *apdu,
apdu_len += len;
/* tag 1 - monitoredObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 1,
(int)data->monitoredObjectIdentifier.type,
data->monitoredObjectIdentifier.type,
data->monitoredObjectIdentifier.instance);
apdu_len += len;
/*
@@ -380,7 +380,7 @@ int cov_subscribe_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t decoded_value = 0; /* for decoding */
uint16_t decoded_type = 0; /* for decoding */
BACNET_OBJECT_TYPE decoded_type = OBJECT_NONE; /* for decoding */
if (apdu_len && data) {
/* tag 0 - subscriberProcessIdentifier */
@@ -473,7 +473,7 @@ int cov_subscribe_property_encode_apdu(uint8_t *apdu,
apdu_len += len;
/* tag 1 - monitoredObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 1,
(int)data->monitoredObjectIdentifier.type,
data->monitoredObjectIdentifier.type,
data->monitoredObjectIdentifier.instance);
apdu_len += len;
if (!data->cancellationRequest) {
@@ -517,7 +517,7 @@ int cov_subscribe_property_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t decoded_value = 0; /* for decoding */
uint16_t decoded_type = 0; /* for decoding */
BACNET_OBJECT_TYPE decoded_type = OBJECT_NONE; /* for decoding */
uint32_t property = 0; /* for decoding */
if (apdu_len && data) {
@@ -79,9 +79,11 @@ int bacapp_decode_credential_authentication_factor(
len = decode_context_enumerated(&apdu[apdu_len], 0, &disable);
if (len < 0) {
return -1;
} else {
} else if (disable < ACCESS_AUTHENTICATION_FACTOR_DISABLE_MAX) {
apdu_len += len;
caf->disable = disable;
caf->disable = (BACNET_ACCESS_AUTHENTICATION_FACTOR_DISABLE)disable;
} else {
return -1;
}
} else {
return -1;
+1 -1
View File
@@ -168,7 +168,7 @@ int dcc_decode_service_request(uint8_t *apdu,
BACNET_CHARACTER_STRING *password)
{
int apdu_len = 0;
unsigned len = 0;
int len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint32_t value32 = 0;
+2 -2
View File
@@ -100,13 +100,13 @@ int event_notify_encode_service_request(
apdu_len += len;
/* tag 1 - initiatingObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 1,
(int)data->initiatingObjectIdentifier.type,
data->initiatingObjectIdentifier.type,
data->initiatingObjectIdentifier.instance);
apdu_len += len;
/* tag 2 - eventObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 2,
(int)data->eventObjectIdentifier.type,
data->eventObjectIdentifier.type,
data->eventObjectIdentifier.instance);
apdu_len += len;
+1 -1
View File
@@ -98,7 +98,7 @@ int get_alarm_summary_ack_encode_apdu_data(uint8_t *apdu,
} else if (max_apdu >= 10) {
/* tag 0 - Object Identifier */
apdu_len += encode_application_object_id(&apdu[apdu_len],
(int)get_alarm_data->objectIdentifier.type,
get_alarm_data->objectIdentifier.type,
get_alarm_data->objectIdentifier.instance);
/* tag 1 - Alarm State */
apdu_len += encode_application_enumerated(
+12 -4
View File
@@ -56,7 +56,7 @@ int getevent_encode_apdu(uint8_t *apdu,
/* encode optional parameter */
if (lastReceivedObjectIdentifier) {
len = encode_context_object_id(&apdu[apdu_len], 0,
(int)lastReceivedObjectIdentifier->type,
lastReceivedObjectIdentifier->type,
lastReceivedObjectIdentifier->instance);
apdu_len += len;
}
@@ -117,7 +117,7 @@ int getevent_ack_encode_apdu_data(uint8_t *apdu,
while (event_data) {
/* Tag 0: objectIdentifier */
apdu_len += encode_context_object_id(&apdu[apdu_len], 0,
(int)event_data->objectIdentifier.type,
event_data->objectIdentifier.type,
event_data->objectIdentifier.instance);
/* Tag 1: eventState */
apdu_len += encode_context_enumerated(
@@ -201,7 +201,11 @@ int getevent_ack_decode_service_request(uint8_t *apdu,
len += decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value);
len += decode_enumerated(&apdu[len], len_value, &enum_value);
event_data->eventState = enum_value;
if (enum_value < EVENT_STATE_MAX) {
event_data->eventState = (BACNET_EVENT_STATE)enum_value;
} else {
return -1;
}
} else {
return -1;
}
@@ -236,7 +240,11 @@ int getevent_ack_decode_service_request(uint8_t *apdu,
len += decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value);
len += decode_enumerated(&apdu[len], len_value, &enum_value);
event_data->notifyType = enum_value;
if (enum_value < NOTIFY_MAX) {
event_data->notifyType = (BACNET_NOTIFY_TYPE)enum_value;
} else {
return -1;
}
} else {
return -1;
}
+2 -1
View File
@@ -78,7 +78,8 @@ int iam_decode_service_request(uint8_t *apdu,
{
int len = 0;
int apdu_len = 0; /* total length of the apdu, return value */
uint16_t object_type = 0; /* should be a Device Object */
/* should be a Device Object */
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint32_t object_instance = 0;
uint8_t tag_number = 0;
uint32_t len_value = 0;
+3 -3
View File
@@ -50,11 +50,11 @@ int ihave_encode_apdu(uint8_t *apdu, BACNET_I_HAVE_DATA *data)
apdu_len = 2;
/* deviceIdentifier */
len = encode_application_object_id(&apdu[apdu_len],
(int)data->device_id.type, data->device_id.instance);
data->device_id.type, data->device_id.instance);
apdu_len += len;
/* objectIdentifier */
len = encode_application_object_id(&apdu[apdu_len],
(int)data->object_id.type, data->object_id.instance);
data->object_id.type, data->object_id.instance);
apdu_len += len;
/* objectName */
len = encode_application_character_string(
@@ -74,7 +74,7 @@ int ihave_decode_service_request(
int len = 0;
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint16_t decoded_type = 0; /* for decoding */
BACNET_OBJECT_TYPE decoded_type = OBJECT_NONE; /* for decoding */
if (apdu_len && data) {
/* deviceIdentifier */
+5 -1
View File
@@ -142,7 +142,11 @@ int lighting_command_decode(
len =
decode_enumerated(&apdu[apdu_len], len_value_type, &unsigned_value);
if (len > 0) {
data->operation = unsigned_value;
if (unsigned_value <= BACNET_LIGHTS_PROPRIETARY_LAST) {
data->operation = (BACNET_LIGHTING_OPERATION)unsigned_value;
} else {
return BACNET_STATUS_ERROR;
}
}
apdu_len += len;
/* Tag 1: target-level - OPTIONAL */
+2 -2
View File
@@ -66,7 +66,7 @@ int lso_encode_apdu(uint8_t *apdu, uint8_t invoke_id, BACNET_LSO_DATA *data)
*/
len = encode_context_object_id(&apdu[apdu_len], 3,
(int)data->targetObject.type, data->targetObject.instance);
data->targetObject.type, data->targetObject.instance);
apdu_len += len;
}
@@ -115,7 +115,7 @@ int lso_decode_service_request(
}
len += section_length;
} else {
data->targetObject.type = 0;
data->targetObject.type = OBJECT_NONE;
data->targetObject.instance = 0;
}
return len;
+5 -5
View File
@@ -145,7 +145,7 @@ int rr_decode_service_request(
unsigned TagLen = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint16_t type = 0; /* for decoding */
BACNET_OBJECT_TYPE type = OBJECT_NONE; /* for decoding */
uint32_t UnsignedTemp;
/* check for value pointers */
@@ -155,7 +155,7 @@ int rr_decode_service_request(
return -1;
}
len += decode_object_id(&apdu[len], &type, &rrdata->object_instance);
rrdata->object_type = (BACNET_OBJECT_TYPE)type;
rrdata->object_type = type;
/* Tag 1: Property ID */
len += decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value_type);
@@ -339,7 +339,7 @@ int rr_ack_decode_service_request(uint8_t *apdu,
int tag_len = 0; /* length of tag decode */
int len = 0; /* total length of decodes */
int start_len;
uint16_t object = 0; /* object type */
BACNET_OBJECT_TYPE object_type = OBJECT_NONE; /* object type */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
@@ -349,8 +349,8 @@ int rr_ack_decode_service_request(uint8_t *apdu,
return -1;
}
len = 1;
len += decode_object_id(&apdu[len], &object, &rrdata->object_instance);
rrdata->object_type = (BACNET_OBJECT_TYPE)object;
len += decode_object_id(&apdu[len], &object_type, &rrdata->object_instance);
rrdata->object_type = object_type;
/* Tag 1: Property ID */
len +=
+6 -6
View File
@@ -86,7 +86,7 @@ int rp_decode_service_request(
unsigned len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint16_t type = 0; /* for decoding */
BACNET_OBJECT_TYPE type = OBJECT_NONE; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
@@ -105,7 +105,7 @@ int rp_decode_service_request(
return BACNET_STATUS_REJECT;
}
len += decode_object_id(&apdu[len], &type, &rpdata->object_instance);
rpdata->object_type = (BACNET_OBJECT_TYPE)type;
rpdata->object_type = type;
/* Tag 1: Property ID */
len += decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value_type);
@@ -227,7 +227,7 @@ int rp_ack_decode_service_request(uint8_t *apdu,
uint32_t len_value_type = 0;
int tag_len = 0; /* length of tag decode */
int len = 0; /* total length of decodes */
uint16_t object = 0; /* object type */
BACNET_OBJECT_TYPE object_type = OBJECT_NONE; /* object type */
uint32_t property = 0; /* for decoding */
uint32_t array_value = 0; /* for decoding */
@@ -237,8 +237,8 @@ int rp_ack_decode_service_request(uint8_t *apdu,
return -1;
}
len = 1;
len += decode_object_id(&apdu[len], &object, &rpdata->object_instance);
rpdata->object_type = (BACNET_OBJECT_TYPE)object;
len += decode_object_id(&apdu[len], &object_type, &rpdata->object_instance);
rpdata->object_type = object_type;
/* Tag 1: Property ID */
len +=
decode_tag_number_and_value(&apdu[len], &tag_number, &len_value_type);
@@ -343,7 +343,7 @@ void testReadPropertyAck(Test *pTest)
BACNET_READ_PROPERTY_DATA test_data;
BACNET_OBJECT_TYPE object_type = OBJECT_DEVICE;
uint32_t object_instance = 0;
uint16_t object = 0;
BACNET_OBJECT_TYPE object = 0;
rpdata.object_type = OBJECT_DEVICE;
rpdata.object_instance = 1;
+10 -10
View File
@@ -191,8 +191,8 @@ int rpm_encode_apdu(uint8_t *apdu,
int rpm_decode_object_id(
uint8_t *apdu, unsigned apdu_len, BACNET_RPM_DATA *rpmdata)
{
unsigned len = 0;
uint16_t type = 0; /* for decoding */
int len = 0;
BACNET_OBJECT_TYPE type = OBJECT_NONE; /* for decoding */
/* check for value pointers */
if (apdu && apdu_len && rpmdata) {
@@ -206,7 +206,7 @@ int rpm_decode_object_id(
return BACNET_STATUS_REJECT;
}
len += decode_object_id(&apdu[len], &type, &rpmdata->object_instance);
rpmdata->object_type = (BACNET_OBJECT_TYPE)type;
rpmdata->object_type = type;
/* Tag 1: sequence of ReadAccessSpecification */
if (!decode_is_opening_tag_number(&apdu[len], 1)) {
rpmdata->error_code = ERROR_CODE_REJECT_INVALID_TAG;
@@ -215,7 +215,7 @@ int rpm_decode_object_id(
len++; /* opening tag is only one octet */
}
return (int)len;
return len;
}
int rpm_decode_object_end(uint8_t *apdu, unsigned apdu_len)
@@ -242,8 +242,8 @@ int rpm_decode_object_end(uint8_t *apdu, unsigned apdu_len)
int rpm_decode_object_property(
uint8_t *apdu, unsigned apdu_len, BACNET_RPM_DATA *rpmdata)
{
unsigned len = 0;
unsigned option_len = 0;
int len = 0;
int option_len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint32_t property = 0; /* for decoding */
@@ -274,7 +274,7 @@ int rpm_decode_object_property(
rpmdata->array_index = BACNET_ARRAY_ALL;
/* Tag 1: Optional propertyArrayIndex */
if (IS_CONTEXT_SPECIFIC(apdu[len]) && !IS_CLOSING_TAG(apdu[len])) {
option_len = (unsigned)decode_tag_number_and_value(
option_len = decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value_type);
if (tag_number == 1) {
len += option_len;
@@ -291,7 +291,7 @@ int rpm_decode_object_property(
}
}
return (int)len;
return len;
}
int rpm_ack_encode_apdu_init(uint8_t *apdu, uint8_t invoke_id)
@@ -400,7 +400,7 @@ int rpm_ack_decode_object_id(uint8_t *apdu,
uint32_t *object_instance)
{
unsigned len = 0;
uint16_t type = 0; /* for decoding */
BACNET_OBJECT_TYPE type = OBJECT_NONE; /* for decoding */
/* check for value pointers */
if (apdu && apdu_len && object_type && object_instance) {
@@ -410,7 +410,7 @@ int rpm_ack_decode_object_id(uint8_t *apdu,
}
len += decode_object_id(&apdu[len], &type, object_instance);
if (object_type) {
*object_type = (BACNET_OBJECT_TYPE)type;
*object_type = type;
}
/* Tag 1: listOfResults */
if (!decode_is_opening_tag_number(&apdu[len], 1)) {
+1 -1
View File
@@ -145,7 +145,7 @@ int timesync_encode_timesync_recipients(
if (max_apdu >= (1 + 4)) {
/* CHOICE - device [0] BACnetObjectIdentifier */
len = encode_context_object_id(&apdu[apdu_len], 0,
(int)pRecipient->type.device.type,
pRecipient->type.device.type,
pRecipient->type.device.instance);
apdu_len += len;
} else {
+2 -2
View File
@@ -66,7 +66,7 @@ int whohas_encode_apdu(uint8_t *apdu, BACNET_WHO_HAS_DATA *data)
apdu_len += len;
} else {
len = encode_context_object_id(&apdu[apdu_len], 2,
(int)data->object.identifier.type,
data->object.identifier.type,
data->object.identifier.instance);
apdu_len += len;
}
@@ -83,7 +83,7 @@ int whohas_decode_service_request(
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t decoded_value = 0; /* for decoding */
uint16_t decoded_type = 0; /* for decoding */
BACNET_OBJECT_TYPE decoded_type = OBJECT_NONE; /* for decoding */
if (apdu_len && data) {
/* optional limits - must be used as a pair */
+2 -2
View File
@@ -94,7 +94,7 @@ int wp_decode_service_request(
int tag_len = 0;
uint8_t tag_number = 0;
uint32_t len_value_type = 0;
uint16_t type = 0; /* for decoding */
BACNET_OBJECT_TYPE type = OBJECT_NONE; /* for decoding */
uint32_t property = 0; /* for decoding */
uint32_t unsigned_value = 0;
int i = 0; /* loop counter */
@@ -106,7 +106,7 @@ int wp_decode_service_request(
return -1;
}
len += decode_object_id(&apdu[len], &type, &wpdata->object_instance);
wpdata->object_type = (BACNET_OBJECT_TYPE)type;
wpdata->object_type = type;
/* Tag 1: Property ID */
len += decode_tag_number_and_value(
&apdu[len], &tag_number, &len_value_type);
+2 -1
View File
@@ -34,8 +34,9 @@
It could also have more than one value or element. */
typedef struct BACnet_Write_Property_Data {
BACNET_OBJECT_TYPE object_type;
/* number type first to avoid enum cast warning on = { 0 } */
uint32_t object_instance;
BACNET_OBJECT_TYPE object_type;
BACNET_PROPERTY_ID object_property;
uint32_t array_index; /* use BACNET_ARRAY_ALL when not setting */
uint8_t application_data[MAX_APDU];
+2 -2
View File
@@ -55,7 +55,7 @@ int wpm_decode_object_id(
uint8_t tag_number = 0;
uint32_t len_value = 0;
uint32_t object_instance = 0;
uint16_t object_type = 0;
BACNET_OBJECT_TYPE object_type = OBJECT_NONE;
uint16_t len = 0;
if (apdu && (apdu_len > 5) && wp_data) {
@@ -108,7 +108,7 @@ int wpm_decode_object_property(
len += decode_tag_number_and_value(&apdu[len], &tag_number, &len_value);
if (tag_number == 0) {
len += decode_enumerated(&apdu[len], len_value, &ulVal);
wp_data->object_property = ulVal;
wp_data->object_property = (BACNET_PROPERTY_ID)ulVal;
} else {
wp_data->error_code = ERROR_CODE_REJECT_INVALID_TAG;
return BACNET_STATUS_REJECT;