Added casts to remove warnings on IAR compiler.
This commit is contained in:
@@ -1034,9 +1034,10 @@ typedef enum {
|
|||||||
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE = 6,
|
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE = 6,
|
||||||
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE_ACK = 7,
|
NETWORK_MESSAGE_INITIALIZE_ROUTING_TABLE_ACK = 7,
|
||||||
NETWORK_MESSAGE_ESTABLISH_CONNECTION_TO_NETWORK = 8,
|
NETWORK_MESSAGE_ESTABLISH_CONNECTION_TO_NETWORK = 8,
|
||||||
NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK = 9
|
NETWORK_MESSAGE_DISCONNECT_CONNECTION_TO_NETWORK = 9,
|
||||||
/* X'0A' to X'7F': Reserved for use by ASHRAE, */
|
/* X'0A' to X'7F': Reserved for use by ASHRAE, */
|
||||||
/* X'80' to X'FF': Available for vendor proprietary messages */
|
/* X'80' to X'FF': Available for vendor proprietary messages */
|
||||||
|
NETWORK_MESSAGE_INVALID = 0x100
|
||||||
} BACNET_NETWORK_MESSAGE_TYPE;
|
} BACNET_NETWORK_MESSAGE_TYPE;
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -184,7 +184,7 @@ int dcc_decode_service_request(uint8_t * apdu,
|
|||||||
&tag_number, &len_value_type);
|
&tag_number, &len_value_type);
|
||||||
len += decode_enumerated(&apdu[len], len_value_type, &value);
|
len += decode_enumerated(&apdu[len], len_value_type, &value);
|
||||||
if (enable_disable)
|
if (enable_disable)
|
||||||
*enable_disable = value;
|
*enable_disable = (BACNET_COMMUNICATION_ENABLE_DISABLE)value;
|
||||||
/* Tag 2: password --optional-- */
|
/* Tag 2: password --optional-- */
|
||||||
if (len < apdu_len) {
|
if (len < apdu_len) {
|
||||||
if (!decode_is_context_tag(&apdu[len], 2))
|
if (!decode_is_context_tag(&apdu[len], 2))
|
||||||
|
|||||||
@@ -298,7 +298,7 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
(priority != 6 /* reserved */ ) &&
|
(priority != 6 /* reserved */ ) &&
|
||||||
(value.type.Enumerated >= MIN_BINARY_PV) &&
|
(value.type.Enumerated >= MIN_BINARY_PV) &&
|
||||||
(value.type.Enumerated <= MAX_BINARY_PV)) {
|
(value.type.Enumerated <= MAX_BINARY_PV)) {
|
||||||
level = value.type.Enumerated;
|
level = (BACNET_BINARY_PV)value.type.Enumerated;
|
||||||
object_index =
|
object_index =
|
||||||
Binary_Output_Instance_To_Index(wp_data->
|
Binary_Output_Instance_To_Index(wp_data->
|
||||||
object_instance);
|
object_instance);
|
||||||
@@ -306,8 +306,8 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
Binary_Output_Level[object_index][priority] = level;
|
Binary_Output_Level[object_index][priority] = level;
|
||||||
/* Note: you could set the physical output here if we
|
/* Note: you could set the physical output here if we
|
||||||
are the highest priority.
|
are the highest priority.
|
||||||
However, if Out of Service is TRUE, then don't set the
|
However, if Out of Service is TRUE, then don't set the
|
||||||
physical output. This comment may apply to the
|
physical output. This comment may apply to the
|
||||||
main loop (i.e. check out of service before changing output) */
|
main loop (i.e. check out of service before changing output) */
|
||||||
status = true;
|
status = true;
|
||||||
} else if (priority == 6) {
|
} else if (priority == 6) {
|
||||||
@@ -331,8 +331,8 @@ bool Binary_Output_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
/* Note: you could set the physical output here to the next
|
/* Note: you could set the physical output here to the next
|
||||||
highest priority, or to the relinquish default if no
|
highest priority, or to the relinquish default if no
|
||||||
priorities are set.
|
priorities are set.
|
||||||
However, if Out of Service is TRUE, then don't set the
|
However, if Out of Service is TRUE, then don't set the
|
||||||
physical output. This comment may apply to the
|
physical output. This comment may apply to the
|
||||||
main loop (i.e. check out of service before changing output) */
|
main loop (i.e. check out of service before changing output) */
|
||||||
status = true;
|
status = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -295,7 +295,7 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
(priority != 6 /* reserved */ ) &&
|
(priority != 6 /* reserved */ ) &&
|
||||||
(value.type.Enumerated >= MIN_BINARY_PV) &&
|
(value.type.Enumerated >= MIN_BINARY_PV) &&
|
||||||
(value.type.Enumerated <= MAX_BINARY_PV)) {
|
(value.type.Enumerated <= MAX_BINARY_PV)) {
|
||||||
level = value.type.Enumerated;
|
level = (BACNET_BINARY_PV)value.type.Enumerated;
|
||||||
object_index =
|
object_index =
|
||||||
Binary_Value_Instance_To_Index(wp_data->
|
Binary_Value_Instance_To_Index(wp_data->
|
||||||
object_instance);
|
object_instance);
|
||||||
@@ -303,8 +303,8 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
Binary_Value_Level[object_index][priority] = level;
|
Binary_Value_Level[object_index][priority] = level;
|
||||||
/* Note: you could set the physical output here if we
|
/* Note: you could set the physical output here if we
|
||||||
are the highest priority.
|
are the highest priority.
|
||||||
However, if Out of Service is TRUE, then don't set the
|
However, if Out of Service is TRUE, then don't set the
|
||||||
physical output. This comment may apply to the
|
physical output. This comment may apply to the
|
||||||
main loop (i.e. check out of service before changing output) */
|
main loop (i.e. check out of service before changing output) */
|
||||||
status = true;
|
status = true;
|
||||||
} else if (priority == 6) {
|
} else if (priority == 6) {
|
||||||
@@ -328,8 +328,8 @@ bool Binary_Value_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
/* Note: you could set the physical output here to the next
|
/* Note: you could set the physical output here to the next
|
||||||
highest priority, or to the relinquish default if no
|
highest priority, or to the relinquish default if no
|
||||||
priorities are set.
|
priorities are set.
|
||||||
However, if Out of Service is TRUE, then don't set the
|
However, if Out of Service is TRUE, then don't set the
|
||||||
physical output. This comment may apply to the
|
physical output. This comment may apply to the
|
||||||
main loop (i.e. check out of service before changing output) */
|
main loop (i.e. check out of service before changing output) */
|
||||||
status = true;
|
status = true;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -47,8 +47,8 @@
|
|||||||
#include "bacfile.h" /* object list dependency */
|
#include "bacfile.h" /* object list dependency */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* note: you really only need to define variables for
|
/* note: you really only need to define variables for
|
||||||
properties that are writable or that may change.
|
properties that are writable or that may change.
|
||||||
The properties that are constant can be hard coded
|
The properties that are constant can be hard coded
|
||||||
into the read-property encoding. */
|
into the read-property encoding. */
|
||||||
static uint32_t Object_Instance_Number = 0;
|
static uint32_t Object_Instance_Number = 0;
|
||||||
@@ -131,7 +131,7 @@ bool Device_Set_Object_Name(const char *name, size_t length)
|
|||||||
bool status = false; /*return value */
|
bool status = false; /*return value */
|
||||||
|
|
||||||
/* FIXME: All the object names in a device must be unique.
|
/* FIXME: All the object names in a device must be unique.
|
||||||
Disallow setting the Device Object Name to any objects in
|
Disallow setting the Device Object Name to any objects in
|
||||||
the device. */
|
the device. */
|
||||||
if (length < sizeof(Object_Name)) {
|
if (length < sizeof(Object_Name)) {
|
||||||
memmove(Object_Name, name, length);
|
memmove(Object_Name, name, length);
|
||||||
@@ -570,7 +570,7 @@ char *Device_Valid_Object_Id(int object_type, uint32_t object_instance)
|
|||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* return the length of the apdu encoded or -1 for error or
|
/* return the length of the apdu encoded or -1 for error or
|
||||||
-2 for abort message */
|
-2 for abort message */
|
||||||
int Device_Encode_Property_APDU(uint8_t * apdu,
|
int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||||
BACNET_PROPERTY_ID property,
|
BACNET_PROPERTY_ID property,
|
||||||
@@ -670,7 +670,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
|||||||
for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) {
|
for (i = 0; i < MAX_BACNET_SERVICES_SUPPORTED; i++) {
|
||||||
/* automatic lookup based on handlers set */
|
/* automatic lookup based on handlers set */
|
||||||
bitstring_set_bit(&bit_string, (uint8_t) i,
|
bitstring_set_bit(&bit_string, (uint8_t) i,
|
||||||
apdu_service_supported(i));
|
apdu_service_supported((BACNET_SERVICES_SUPPORTED)i));
|
||||||
}
|
}
|
||||||
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
|
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
|
||||||
break;
|
break;
|
||||||
@@ -858,7 +858,8 @@ bool Device_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
|||||||
|
|
||||||
case PROP_SYSTEM_STATUS:
|
case PROP_SYSTEM_STATUS:
|
||||||
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
|
if (value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
|
||||||
Device_Set_System_Status(value.type.Enumerated);
|
/* FIXME: bounds check? */
|
||||||
|
Device_Set_System_Status((BACNET_DEVICE_STATUS)value.type.Enumerated);
|
||||||
status = true;
|
status = true;
|
||||||
} else {
|
} else {
|
||||||
*error_class = ERROR_CLASS_PROPERTY;
|
*error_class = ERROR_CLASS_PROPERTY;
|
||||||
|
|||||||
+7
-5
@@ -196,7 +196,7 @@ void npdu_encode_npdu_data(BACNET_NPDU_DATA * npdu_data,
|
|||||||
npdu_data->data_expecting_reply = data_expecting_reply;
|
npdu_data->data_expecting_reply = data_expecting_reply;
|
||||||
npdu_data->protocol_version = BACNET_PROTOCOL_VERSION;
|
npdu_data->protocol_version = BACNET_PROTOCOL_VERSION;
|
||||||
npdu_data->network_layer_message = false; /* false if APDU */
|
npdu_data->network_layer_message = false; /* false if APDU */
|
||||||
npdu_data->network_message_type = 0; /* optional */
|
npdu_data->network_message_type = NETWORK_MESSAGE_INVALID; /* optional */
|
||||||
npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */
|
npdu_data->vendor_id = 0; /* optional, if net message type is > 0x80 */
|
||||||
npdu_data->priority = priority;
|
npdu_data->priority = priority;
|
||||||
npdu_data->hop_count = 0;
|
npdu_data->hop_count = 0;
|
||||||
@@ -239,7 +239,7 @@ int npdu_decode(uint8_t * npdu,
|
|||||||
/* B'10' = Critical Equipment message */
|
/* B'10' = Critical Equipment message */
|
||||||
/* B'01' = Urgent message */
|
/* B'01' = Urgent message */
|
||||||
/* B'00' = Normal message */
|
/* B'00' = Normal message */
|
||||||
npdu_data->priority = npdu[1] & 0x03;
|
npdu_data->priority = (BACNET_MESSAGE_PRIORITY)(npdu[1] & 0x03);
|
||||||
/* set the offset to where the optional stuff starts */
|
/* set the offset to where the optional stuff starts */
|
||||||
len = 2;
|
len = 2;
|
||||||
/*Bit 5: Destination specifier where: */
|
/*Bit 5: Destination specifier where: */
|
||||||
@@ -310,14 +310,16 @@ int npdu_decode(uint8_t * npdu,
|
|||||||
/* Indicates that the NSDU conveys a network layer message. */
|
/* Indicates that the NSDU conveys a network layer message. */
|
||||||
/* Message Type field is present. */
|
/* Message Type field is present. */
|
||||||
if (npdu_data->network_layer_message) {
|
if (npdu_data->network_layer_message) {
|
||||||
npdu_data->network_message_type = npdu[len++];
|
npdu_data->network_message_type = (BACNET_NETWORK_MESSAGE_TYPE)npdu[len++];
|
||||||
/* Message Type field contains a value in the range 0x80 - 0xFF, */
|
/* Message Type field contains a value in the range 0x80 - 0xFF, */
|
||||||
/* then a Vendor ID field shall be present */
|
/* then a Vendor ID field shall be present */
|
||||||
if (npdu_data->network_message_type >= 0x80)
|
if (npdu_data->network_message_type >= 0x80)
|
||||||
len +=
|
len +=
|
||||||
decode_unsigned16(&npdu[len], &npdu_data->vendor_id);
|
decode_unsigned16(&npdu[len], &npdu_data->vendor_id);
|
||||||
} else
|
} else {
|
||||||
npdu_data->network_message_type = 0;
|
/* FIXME: another value for this? */
|
||||||
|
npdu_data->network_message_type = NETWORK_MESSAGE_INVALID;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
|
|||||||
+1
-1
@@ -84,7 +84,7 @@ int rd_decode_service_request(uint8_t * apdu,
|
|||||||
&tag_number, &len_value_type);
|
&tag_number, &len_value_type);
|
||||||
len += decode_enumerated(&apdu[len], len_value_type, &value);
|
len += decode_enumerated(&apdu[len], len_value_type, &value);
|
||||||
if (state)
|
if (state)
|
||||||
*state = value;
|
*state = (BACNET_REINITIALIZED_STATE)value;
|
||||||
/* Tag 1: password - optional */
|
/* Tag 1: password - optional */
|
||||||
if (len < apdu_len) {
|
if (len < apdu_len) {
|
||||||
if (!decode_is_context_tag(&apdu[len], 1))
|
if (!decode_is_context_tag(&apdu[len], 1))
|
||||||
|
|||||||
+4
-4
@@ -84,14 +84,14 @@ int rp_decode_service_request(uint8_t * apdu,
|
|||||||
if (!decode_is_context_tag(&apdu[len++], 0))
|
if (!decode_is_context_tag(&apdu[len++], 0))
|
||||||
return -1;
|
return -1;
|
||||||
len += decode_object_id(&apdu[len], &type, &data->object_instance);
|
len += decode_object_id(&apdu[len], &type, &data->object_instance);
|
||||||
data->object_type = type;
|
data->object_type = (BACNET_OBJECT_TYPE)type;
|
||||||
/* Tag 1: Property ID */
|
/* Tag 1: Property ID */
|
||||||
len += decode_tag_number_and_value(&apdu[len],
|
len += decode_tag_number_and_value(&apdu[len],
|
||||||
&tag_number, &len_value_type);
|
&tag_number, &len_value_type);
|
||||||
if (tag_number != 1)
|
if (tag_number != 1)
|
||||||
return -1;
|
return -1;
|
||||||
len += decode_enumerated(&apdu[len], len_value_type, &property);
|
len += decode_enumerated(&apdu[len], len_value_type, &property);
|
||||||
data->object_property = property;
|
data->object_property = (BACNET_PROPERTY_ID)property;
|
||||||
/* Tag 2: Optional Array Index */
|
/* Tag 2: Optional Array Index */
|
||||||
if (len < apdu_len) {
|
if (len < apdu_len) {
|
||||||
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
len += decode_tag_number_and_value(&apdu[len], &tag_number,
|
||||||
@@ -157,14 +157,14 @@ int rp_ack_decode_service_request(uint8_t * apdu, int apdu_len, /* total length
|
|||||||
return -1;
|
return -1;
|
||||||
len = 1;
|
len = 1;
|
||||||
len += decode_object_id(&apdu[len], &object, &data->object_instance);
|
len += decode_object_id(&apdu[len], &object, &data->object_instance);
|
||||||
data->object_type = object;
|
data->object_type = (BACNET_OBJECT_TYPE)object;
|
||||||
/* Tag 1: Property ID */
|
/* Tag 1: Property ID */
|
||||||
len += decode_tag_number_and_value(&apdu[len],
|
len += decode_tag_number_and_value(&apdu[len],
|
||||||
&tag_number, &len_value_type);
|
&tag_number, &len_value_type);
|
||||||
if (tag_number != 1)
|
if (tag_number != 1)
|
||||||
return -1;
|
return -1;
|
||||||
len += decode_enumerated(&apdu[len], len_value_type, &property);
|
len += decode_enumerated(&apdu[len], len_value_type, &property);
|
||||||
data->object_property = property;
|
data->object_property = (BACNET_PROPERTY_ID)property;
|
||||||
/* Tag 2: Optional Array Index */
|
/* Tag 2: Optional Array Index */
|
||||||
tag_len = decode_tag_number_and_value(&apdu[len],
|
tag_len = decode_tag_number_and_value(&apdu[len],
|
||||||
&tag_number, &len_value_type);
|
&tag_number, &len_value_type);
|
||||||
|
|||||||
+3
-3
@@ -105,14 +105,14 @@ int wp_decode_service_request(uint8_t * apdu,
|
|||||||
if (!decode_is_context_tag(&apdu[len++], 0))
|
if (!decode_is_context_tag(&apdu[len++], 0))
|
||||||
return -1;
|
return -1;
|
||||||
len += decode_object_id(&apdu[len], &type, &data->object_instance);
|
len += decode_object_id(&apdu[len], &type, &data->object_instance);
|
||||||
data->object_type = type;
|
data->object_type = (BACNET_OBJECT_TYPE)type;
|
||||||
/* Tag 1: Property ID */
|
/* Tag 1: Property ID */
|
||||||
len += decode_tag_number_and_value(&apdu[len],
|
len += decode_tag_number_and_value(&apdu[len],
|
||||||
&tag_number, &len_value_type);
|
&tag_number, &len_value_type);
|
||||||
if (tag_number != 1)
|
if (tag_number != 1)
|
||||||
return -1;
|
return -1;
|
||||||
len += decode_enumerated(&apdu[len], len_value_type, &property);
|
len += decode_enumerated(&apdu[len], len_value_type, &property);
|
||||||
data->object_property = property;
|
data->object_property = (BACNET_PROPERTY_ID)property;
|
||||||
/* Tag 2: Optional Array Index */
|
/* Tag 2: Optional Array Index */
|
||||||
/* note: decode without incrementing len so we can check for opening tag */
|
/* note: decode without incrementing len so we can check for opening tag */
|
||||||
tag_len = decode_tag_number_and_value(&apdu[len],
|
tag_len = decode_tag_number_and_value(&apdu[len],
|
||||||
@@ -129,7 +129,7 @@ int wp_decode_service_request(uint8_t * apdu,
|
|||||||
return -1;
|
return -1;
|
||||||
/* determine the length of the data blob */
|
/* determine the length of the data blob */
|
||||||
data->application_data_len = bacapp_data_len(&apdu[len],
|
data->application_data_len = bacapp_data_len(&apdu[len],
|
||||||
apdu_len - len, property);
|
apdu_len - len, (BACNET_PROPERTY_ID)property);
|
||||||
/* a tag number of 3 is not extended so only one octet */
|
/* a tag number of 3 is not extended so only one octet */
|
||||||
len++;
|
len++;
|
||||||
/* copy the data from the APDU */
|
/* copy the data from the APDU */
|
||||||
|
|||||||
Reference in New Issue
Block a user