Changed all the C++ comments to C comments using comment.sh script.
This commit is contained in:
@@ -58,7 +58,7 @@ extern "C" {
|
||||
BACNET_PROPERTY_ID object_property, int32_t array_index);
|
||||
|
||||
/* returns the invoke ID for confirmed request, or 0 if failed */
|
||||
uint8_t Send_Write_Property_Request(uint32_t device_id, // destination device
|
||||
uint8_t Send_Write_Property_Request(uint32_t device_id, /* destination device */
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
|
||||
@@ -59,12 +59,12 @@ void handler_atomic_read_file(uint8_t * service_request,
|
||||
len = arf_decode_service_request(service_request, service_len, &data);
|
||||
if (len < 0)
|
||||
fprintf(stderr, "Unable to decode Atomic-Read-File Request!\n");
|
||||
// prepare a reply
|
||||
/* prepare a reply */
|
||||
datalink_get_my_address(&my_address);
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
// bad decoding - send an abort
|
||||
/* bad decoding - send an abort */
|
||||
if (len < 0) {
|
||||
pdu_len += abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER);
|
||||
@@ -112,8 +112,8 @@ void handler_atomic_read_file(uint8_t * service_request,
|
||||
send = true;
|
||||
}
|
||||
if (send) {
|
||||
bytes_sent = datalink_send_pdu(src, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(src, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to send PDU (%s)!\n", strerror(errno));
|
||||
}
|
||||
|
||||
@@ -41,11 +41,11 @@
|
||||
#include "handlers.h"
|
||||
#include "txbuf.h"
|
||||
|
||||
// We performed an AtomicReadFile Request,
|
||||
// and here is the data from the server
|
||||
// Note: it does not have to be the same file=instance
|
||||
// that someone can read from us. It is common to
|
||||
// use the description as the file name.
|
||||
/* We performed an AtomicReadFile Request, */
|
||||
/* and here is the data from the server */
|
||||
/* Note: it does not have to be the same file=instance */
|
||||
/* that someone can read from us. It is common to */
|
||||
/* use the description as the file name. */
|
||||
#if BACFILE
|
||||
void handler_atomic_read_file_ack(uint8_t * service_request,
|
||||
uint16_t service_len,
|
||||
@@ -58,13 +58,13 @@ void handler_atomic_read_file_ack(uint8_t * service_request,
|
||||
uint32_t instance = 0;
|
||||
|
||||
(void) src;
|
||||
// get the file instance from the tsm data before freeing it
|
||||
/* get the file instance from the tsm data before freeing it */
|
||||
instance = bacfile_instance_from_tsm(service_data->invoke_id);
|
||||
len = arf_ack_decode_service_request(service_request,
|
||||
service_len, &data);
|
||||
fprintf(stderr, "Received Read-File Ack!\n");
|
||||
if ((len > 0) && (instance <= BACNET_MAX_INSTANCE)) {
|
||||
// write the data received to the file specified
|
||||
/* write the data received to the file specified */
|
||||
if (data.access == FILE_STREAM_ACCESS) {
|
||||
pFilename = bacfile_name(instance);
|
||||
if (pFilename) {
|
||||
@@ -81,7 +81,7 @@ void handler_atomic_read_file_ack(uint8_t * service_request,
|
||||
}
|
||||
}
|
||||
} else if (data.access == FILE_RECORD_ACCESS) {
|
||||
// FIXME: add handling for Record Access
|
||||
/* FIXME: add handling for Record Access */
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -52,7 +52,7 @@ void handler_device_communication_control(uint8_t * service_request,
|
||||
BACNET_ADDRESS my_address;
|
||||
int bytes_sent = 0;
|
||||
|
||||
// decode the service request only
|
||||
/* decode the service request only */
|
||||
len = dcc_decode_service_request(service_request,
|
||||
service_len, &timeDuration, &state, &password);
|
||||
fprintf(stderr, "DeviceCommunicationControl!\n");
|
||||
@@ -64,12 +64,12 @@ void handler_device_communication_control(uint8_t * service_request,
|
||||
else
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Unable to decode request!\n");
|
||||
// prepare a reply
|
||||
/* prepare a reply */
|
||||
datalink_get_my_address(&my_address);
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
// bad decoding or something we didn't understand - send an abort
|
||||
/* bad decoding or something we didn't understand - send an abort */
|
||||
if (len == -1) {
|
||||
pdu_len += abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER);
|
||||
@@ -105,8 +105,8 @@ void handler_device_communication_control(uint8_t * service_request,
|
||||
"Sending Error - password failure.\n");
|
||||
}
|
||||
}
|
||||
bytes_sent = datalink_send_pdu(src, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(src, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "DeviceCommunicationControl: "
|
||||
"Failed to send PDU (%s)!\n", strerror(errno));
|
||||
|
||||
@@ -66,7 +66,7 @@ void handler_i_am_bind(uint8_t * service_request,
|
||||
(void) service_len;
|
||||
len = iam_decode_service_request(service_request,
|
||||
&device_id, &max_apdu, &segmentation, &vendor_id);
|
||||
// only add address if requested to bind
|
||||
/* only add address if requested to bind */
|
||||
address_add_binding(device_id, max_apdu, src);
|
||||
|
||||
return;
|
||||
|
||||
@@ -51,7 +51,7 @@ void handler_reinitialize_device(uint8_t * service_request,
|
||||
BACNET_ADDRESS my_address;
|
||||
int bytes_sent = 0;
|
||||
|
||||
// decode the service request only
|
||||
/* decode the service request only */
|
||||
len = rd_decode_service_request(service_request,
|
||||
service_len, &state, &password);
|
||||
fprintf(stderr, "ReinitializeDevice!\n");
|
||||
@@ -60,12 +60,12 @@ void handler_reinitialize_device(uint8_t * service_request,
|
||||
(unsigned) state, characterstring_value(&password));
|
||||
else
|
||||
fprintf(stderr, "ReinitializeDevice: Unable to decode request!\n");
|
||||
// prepare a reply
|
||||
/* prepare a reply */
|
||||
datalink_get_my_address(&my_address);
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
// bad decoding or something we didn't understand - send an abort
|
||||
/* bad decoding or something we didn't understand - send an abort */
|
||||
if (len == -1) {
|
||||
pdu_len += abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER);
|
||||
@@ -103,8 +103,8 @@ void handler_reinitialize_device(uint8_t * service_request,
|
||||
"ReinitializeDevice: Sending Error - password failure.\n");
|
||||
}
|
||||
}
|
||||
bytes_sent = datalink_send_pdu(src, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(src, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "ReinitializeDevice: Failed to send PDU (%s)!\n",
|
||||
strerror(errno));
|
||||
|
||||
@@ -62,12 +62,12 @@ void handler_read_property(uint8_t * service_request,
|
||||
len = rp_decode_service_request(service_request, service_len, &data);
|
||||
if (len <= 0)
|
||||
fprintf(stderr, "Unable to decode Read-Property Request!\n");
|
||||
// prepare a reply
|
||||
/* prepare a reply */
|
||||
datalink_get_my_address(&my_address);
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
// bad decoding - send an abort
|
||||
/* bad decoding - send an abort */
|
||||
if (len == -1) {
|
||||
pdu_len += abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER);
|
||||
@@ -82,16 +82,16 @@ void handler_read_property(uint8_t * service_request,
|
||||
} else {
|
||||
switch (data.object_type) {
|
||||
case OBJECT_DEVICE:
|
||||
// FIXME: probably need a length limitation sent with encode
|
||||
/* FIXME: probably need a length limitation sent with encode */
|
||||
if (data.object_instance == Device_Object_Instance_Number()) {
|
||||
len = Device_Encode_Property_APDU(&Temp_Buf[0],
|
||||
data.object_property,
|
||||
data.array_index, &error_class, &error_code);
|
||||
if (len >= 0) {
|
||||
// encode the APDU portion of the packet
|
||||
/* encode the APDU portion of the packet */
|
||||
data.application_data = &Temp_Buf[0];
|
||||
data.application_data_len = len;
|
||||
// FIXME: probably need a length limitation sent with encode
|
||||
/* FIXME: probably need a length limitation sent with encode */
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
@@ -109,10 +109,10 @@ void handler_read_property(uint8_t * service_request,
|
||||
data.object_property,
|
||||
data.array_index, &error_class, &error_code);
|
||||
if (len >= 0) {
|
||||
// encode the APDU portion of the packet
|
||||
/* encode the APDU portion of the packet */
|
||||
data.application_data = &Temp_Buf[0];
|
||||
data.application_data_len = len;
|
||||
// FIXME: probably need a length limitation sent with encode
|
||||
/* FIXME: probably need a length limitation sent with encode */
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
@@ -130,10 +130,10 @@ void handler_read_property(uint8_t * service_request,
|
||||
data.object_property,
|
||||
data.array_index, &error_class, &error_code);
|
||||
if (len >= 0) {
|
||||
// encode the APDU portion of the packet
|
||||
/* encode the APDU portion of the packet */
|
||||
data.application_data = &Temp_Buf[0];
|
||||
data.application_data_len = len;
|
||||
// FIXME: probably need a length limitation sent with encode
|
||||
/* FIXME: probably need a length limitation sent with encode */
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
@@ -152,10 +152,10 @@ void handler_read_property(uint8_t * service_request,
|
||||
data.object_property,
|
||||
data.array_index, &error_class, &error_code);
|
||||
if (len >= 0) {
|
||||
// encode the APDU portion of the packet
|
||||
/* encode the APDU portion of the packet */
|
||||
data.application_data = &Temp_Buf[0];
|
||||
data.application_data_len = len;
|
||||
// FIXME: probably need a length limitation sent with encode
|
||||
/* FIXME: probably need a length limitation sent with encode */
|
||||
pdu_len +=
|
||||
rp_ack_encode_apdu(&Handler_Transmit_Buffer
|
||||
[pdu_len], service_data->invoke_id, &data);
|
||||
@@ -180,8 +180,8 @@ void handler_read_property(uint8_t * service_request,
|
||||
send = true;
|
||||
}
|
||||
if (send) {
|
||||
bytes_sent = datalink_send_pdu(src, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(src, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to send PDU (%s)!\n", strerror(errno));
|
||||
}
|
||||
|
||||
@@ -55,7 +55,7 @@ void handler_write_property(uint8_t * service_request,
|
||||
BACNET_ERROR_CODE error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||
int bytes_sent = 0;
|
||||
|
||||
// decode the service request only
|
||||
/* decode the service request only */
|
||||
len = wp_decode_service_request(service_request,
|
||||
service_len, &wp_data);
|
||||
fprintf(stderr, "Received Write-Property Request!\n");
|
||||
@@ -66,12 +66,12 @@ void handler_write_property(uint8_t * service_request,
|
||||
wp_data.object_property, wp_data.array_index);
|
||||
else
|
||||
fprintf(stderr, "Unable to decode Write-Property Request!\n");
|
||||
// prepare a reply
|
||||
/* prepare a reply */
|
||||
datalink_get_my_address(&my_address);
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], src, &my_address, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
// bad decoding or something we didn't understand - send an abort
|
||||
/* bad decoding or something we didn't understand - send an abort */
|
||||
if (len == -1) {
|
||||
pdu_len += abort_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, ABORT_REASON_OTHER);
|
||||
@@ -134,8 +134,8 @@ void handler_write_property(uint8_t * service_request,
|
||||
break;
|
||||
}
|
||||
}
|
||||
bytes_sent = datalink_send_pdu(src, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(src, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to send PDU (%s)!\n", strerror(errno));
|
||||
|
||||
|
||||
@@ -46,16 +46,16 @@ void handler_unrecognized_service(uint8_t * service_request,
|
||||
(void) service_len;
|
||||
datalink_get_my_address(&src);
|
||||
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], dest, &src, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], dest, &src, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
// encode the APDU portion of the packet
|
||||
/* encode the APDU portion of the packet */
|
||||
pdu_len += reject_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
service_data->invoke_id, REJECT_REASON_UNRECOGNIZED_SERVICE);
|
||||
|
||||
bytes_sent = datalink_send_pdu(dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent > 0)
|
||||
fprintf(stderr, "Sent Reject!\n");
|
||||
else
|
||||
|
||||
@@ -63,11 +63,11 @@ uint8_t Send_Device_Communication_Control_Request(uint32_t device_id, uint16_t t
|
||||
status = tsm_transaction_available();
|
||||
if (status) {
|
||||
datalink_get_my_address(&my_address);
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, // true for confirmed messages
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
// load the data for the encoding
|
||||
/* load the data for the encoding */
|
||||
characterstring_init_ansi(&password_string, password);
|
||||
pdu_len += dcc_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
invoke_id,
|
||||
@@ -80,8 +80,8 @@ uint8_t Send_Device_Communication_Control_Request(uint32_t device_id, uint16_t t
|
||||
if ((unsigned) pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id,
|
||||
&dest, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr,
|
||||
"Failed to Send DeviceCommunicationControl Request (%s)!\n",
|
||||
|
||||
@@ -68,8 +68,8 @@ void Send_I_Have(uint32_t device_id,
|
||||
characterstring_init_ansi(&data.object_name, object_name);
|
||||
pdu_len += ihave_encode_apdu(&Handler_Transmit_Buffer[pdu_len], &data);
|
||||
/* send the data */
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to Send I-Have Reply (%s)!\n",
|
||||
strerror(errno));
|
||||
|
||||
@@ -64,11 +64,11 @@ uint8_t Send_Reinitialize_Device_Request(uint32_t device_id,
|
||||
status = tsm_transaction_available();
|
||||
if (status) {
|
||||
datalink_get_my_address(&my_address);
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, // true for confirmed messages
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
// load the data for the encoding
|
||||
/* load the data for the encoding */
|
||||
characterstring_init_ansi(&password_string, password);
|
||||
pdu_len += rd_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
invoke_id, state, password ? &password_string : NULL);
|
||||
@@ -80,8 +80,8 @@ uint8_t Send_Reinitialize_Device_Request(uint32_t device_id,
|
||||
if ((unsigned) pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id,
|
||||
&dest, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr,
|
||||
"Failed to Send ReinitializeDevice Request (%s)!\n",
|
||||
|
||||
@@ -67,11 +67,11 @@ uint8_t Send_Read_Property_Request(uint32_t device_id, /* destination device */
|
||||
status = tsm_transaction_available();
|
||||
if (status) {
|
||||
datalink_get_my_address(&my_address);
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, // true for confirmed messages
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
// load the data for the encoding
|
||||
/* load the data for the encoding */
|
||||
data.object_type = object_type;
|
||||
data.object_instance = object_instance;
|
||||
data.object_property = object_property;
|
||||
@@ -86,8 +86,8 @@ uint8_t Send_Read_Property_Request(uint32_t device_id, /* destination device */
|
||||
if ((unsigned) pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id,
|
||||
&dest, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr,
|
||||
"Failed to Send ReadProperty Request (%s)!\n",
|
||||
|
||||
@@ -67,8 +67,8 @@ void Send_WhoHas_Name(int32_t low_limit,
|
||||
pdu_len += whohas_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
&data);
|
||||
/* send the data */
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to Send Who-Has Request (%s)!\n",
|
||||
strerror(errno));
|
||||
@@ -101,8 +101,8 @@ void Send_WhoHas_Object(int32_t low_limit,
|
||||
pdu_len += whohas_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
&data);
|
||||
/* send the data */
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to Send Who-Has Request (%s)!\n",
|
||||
strerror(errno));
|
||||
|
||||
@@ -52,19 +52,19 @@ void Send_WhoIs(int32_t low_limit, int32_t high_limit)
|
||||
if (!dcc_communication_enabled())
|
||||
return;
|
||||
|
||||
// Who-Is is a global broadcast
|
||||
/* Who-Is is a global broadcast */
|
||||
datalink_get_broadcast_address(&dest);
|
||||
|
||||
// encode the NPDU portion of the packet
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, NULL, false, // true for confirmed messages
|
||||
/* encode the NPDU portion of the packet */
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, NULL, false, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
// encode the APDU portion of the packet
|
||||
/* encode the APDU portion of the packet */
|
||||
pdu_len += whois_encode_apdu(&Handler_Transmit_Buffer[pdu_len],
|
||||
low_limit, high_limit);
|
||||
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr, "Failed to Send Who-Is Request (%s)!\n",
|
||||
strerror(errno));
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
#include "txbuf.h"
|
||||
|
||||
/* returns the invoke ID for confirmed request, or zero on failure */
|
||||
uint8_t Send_Write_Property_Request(uint32_t device_id, // destination device
|
||||
uint8_t Send_Write_Property_Request(uint32_t device_id, /* destination device */
|
||||
BACNET_OBJECT_TYPE object_type,
|
||||
uint32_t object_instance,
|
||||
BACNET_PROPERTY_ID object_property,
|
||||
@@ -69,11 +69,11 @@ uint8_t Send_Write_Property_Request(uint32_t device_id, // destination device
|
||||
status = tsm_transaction_available();
|
||||
if (status) {
|
||||
datalink_get_my_address(&my_address);
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, // true for confirmed messages
|
||||
pdu_len = npdu_encode_apdu(&Handler_Transmit_Buffer[0], &dest, &my_address, true, /* true for confirmed messages */
|
||||
MESSAGE_PRIORITY_NORMAL);
|
||||
|
||||
invoke_id = tsm_next_free_invokeID();
|
||||
// load the data for the encoding
|
||||
/* load the data for the encoding */
|
||||
data.object_type = object_type;
|
||||
data.object_instance = object_instance;
|
||||
data.object_property = object_property;
|
||||
@@ -90,8 +90,8 @@ uint8_t Send_Write_Property_Request(uint32_t device_id, // destination device
|
||||
if ((unsigned) pdu_len < max_apdu) {
|
||||
tsm_set_confirmed_unsegmented_transaction(invoke_id,
|
||||
&dest, &Handler_Transmit_Buffer[0], pdu_len);
|
||||
bytes_sent = datalink_send_pdu(&dest, // destination address
|
||||
&Handler_Transmit_Buffer[0], pdu_len); // number of bytes of data
|
||||
bytes_sent = datalink_send_pdu(&dest, /* destination address */
|
||||
&Handler_Transmit_Buffer[0], pdu_len); /* number of bytes of data */
|
||||
if (bytes_sent <= 0)
|
||||
fprintf(stderr,
|
||||
"Failed to Send WriteProperty Request (%s)!\n",
|
||||
|
||||
Reference in New Issue
Block a user