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
+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,