Fixed indent script, and indented files.

This commit is contained in:
skarg
2010-07-19 23:19:54 +00:00
parent c0d63a1ed0
commit 6c9ef7211d
69 changed files with 681 additions and 627 deletions
+40 -38
View File
@@ -113,8 +113,7 @@ static int32_t Property_List[MAX_PROPS + 2];
/* This normally points to Property_List. */ /* This normally points to Property_List. */
static const int *pPropList = NULL; static const int *pPropList = NULL;
#define MINIMAL_PROPLIST_SIZE 4 #define MINIMAL_PROPLIST_SIZE 4
static int32_t MinimalPropList[MINIMAL_PROPLIST_SIZE] = static int32_t MinimalPropList[MINIMAL_PROPLIST_SIZE] = {
{
PROP_OBJECT_IDENTIFIER, PROP_OBJECT_IDENTIFIER,
PROP_OBJECT_NAME, PROP_OBJECT_NAME,
PROP_OBJECT_TYPE, PROP_OBJECT_TYPE,
@@ -177,7 +176,8 @@ void MyAbortHandler(
Error_Detected = true; Error_Detected = true;
Last_Error_Class = ERROR_CLASS_SERVICES; Last_Error_Class = ERROR_CLASS_SERVICES;
if (abort_reason < MAX_BACNET_ABORT_REASON) if (abort_reason < MAX_BACNET_ABORT_REASON)
Last_Error_Code = (ERROR_CODE_ABORT_BUFFER_OVERFLOW -1) + abort_reason; Last_Error_Code =
(ERROR_CODE_ABORT_BUFFER_OVERFLOW - 1) + abort_reason;
else else
Last_Error_Code = ERROR_CODE_ABORT_OTHER; Last_Error_Code = ERROR_CODE_ABORT_OTHER;
} }
@@ -192,12 +192,14 @@ void MyRejectHandler(
(void) invoke_id; (void) invoke_id;
#if PRINT_ERRORS #if PRINT_ERRORS
if (ShowValues) if (ShowValues)
fprintf(stderr, "BACnet Reject: %s\r\n", bactext_reject_reason_name(reject_reason)); fprintf(stderr, "BACnet Reject: %s\r\n",
bactext_reject_reason_name(reject_reason));
#endif #endif
Error_Detected = true; Error_Detected = true;
Last_Error_Class = ERROR_CLASS_SERVICES; Last_Error_Class = ERROR_CLASS_SERVICES;
if (reject_reason < MAX_BACNET_REJECT_REASON) if (reject_reason < MAX_BACNET_REJECT_REASON)
Last_Error_Code = (ERROR_CODE_REJECT_BUFFER_OVERFLOW -1) + reject_reason; Last_Error_Code =
(ERROR_CODE_REJECT_BUFFER_OVERFLOW - 1) + reject_reason;
else else
Last_Error_Code = ERROR_CODE_REJECT_OTHER; Last_Error_Code = ERROR_CODE_REJECT_OTHER;
} }
@@ -554,7 +556,8 @@ void PrintReadPropertyData(
* handling the proprietary property numbers. * handling the proprietary property numbers.
* @param propertyIdentifier [in] The property identifier number. * @param propertyIdentifier [in] The property identifier number.
*/ */
void Print_Property_Identifier(unsigned propertyIdentifier) void Print_Property_Identifier(
unsigned propertyIdentifier)
{ {
if (propertyIdentifier < 512) { if (propertyIdentifier < 512) {
fprintf(stdout, "%s", bactext_property_name(propertyIdentifier)); fprintf(stdout, "%s", bactext_property_name(propertyIdentifier));
@@ -582,8 +585,7 @@ static uint8_t Read_Properties(
int i; int i;
if ((!Has_RPM && (Property_List_Index == 0)) || if ((!Has_RPM && (Property_List_Index == 0)) ||
( Property_List_Length == 0) ) (Property_List_Length == 0)) {
{
/* If we failed to get the Properties with RPM, just settle for what we /* If we failed to get the Properties with RPM, just settle for what we
* know is the fixed list of Required (only) properties. * know is the fixed list of Required (only) properties.
* In practice, this should only happen for simple devices that don't * In practice, this should only happen for simple devices that don't
@@ -736,10 +738,13 @@ void PrintUsage(
printf("Usage: \r\n"); printf("Usage: \r\n");
printf(" bacepics [-v] [-p sport] [-t target_mac] device-instance \r\n"); printf(" bacepics [-v] [-p sport] [-t target_mac] device-instance \r\n");
printf(" -v: show values instead of '?' \r\n"); printf(" -v: show values instead of '?' \r\n");
printf(" -p: Use sport for \"my\" port, instead of 0xBAC0 (BACnet/IP only) \r\n"); printf
(" -p: Use sport for \"my\" port, instead of 0xBAC0 (BACnet/IP only) \r\n");
printf(" Allows you to communicate with a localhost target. \r\n"); printf(" Allows you to communicate with a localhost target. \r\n");
printf(" -t: declare target's MAC instead of using Who-Is to bind to \r\n"); printf
printf(" device-instance. Format is \"C0:A8:00:18:BA:C0\" (as usual) \r\n"); (" -t: declare target's MAC instead of using Who-Is to bind to \r\n");
printf
(" device-instance. Format is \"C0:A8:00:18:BA:C0\" (as usual) \r\n");
printf("\r\n"); printf("\r\n");
printf("Insert the output in your EPICS file as the last section: \r\n"); printf("Insert the output in your EPICS file as the last section: \r\n");
printf("\"List of Objects in test device:\" \r\n"); printf("\"List of Objects in test device:\" \r\n");
@@ -766,8 +771,7 @@ int CheckCommandLineArgs(
for (i = 1; i < argc; i++) { for (i = 1; i < argc; i++) {
char *anArg = argv[i]; char *anArg = argv[i];
if (anArg[0] == '-') { if (anArg[0] == '-') {
switch ( anArg[1] ) switch (anArg[1]) {
{
case 'v': case 'v':
ShowValues = true; ShowValues = true;
break; break;
@@ -777,22 +781,21 @@ int CheckCommandLineArgs(
/* Used strtol so sport can be either 0xBAC0 or 47808 */ /* Used strtol so sport can be either 0xBAC0 or 47808 */
break; break;
case 't': case 't':
if ( ++i < argc ) if (++i < argc) {
{
uint8_t *mac = Target_Address.mac; uint8_t *mac = Target_Address.mac;
/* The %hhx specifies unsigned char */ /* The %hhx specifies unsigned char */
Target_Address.mac_len = sscanf( argv[i], Target_Address.mac_len =
"%hhx:%hhx:%hhx:%hhx:%hhx:%hhx", &mac[0], sscanf(argv[i], "%hhx:%hhx:%hhx:%hhx:%hhx:%hhx",
&mac[1], &mac[2], &mac[3], &mac[4], &mac[5]); &mac[0], &mac[1], &mac[2], &mac[3], &mac[4],
if ( Target_Address.mac_len == 6 ) /* success */ &mac[5]);
{ if (Target_Address.mac_len == 6) { /* success */
Target_Address.net = 0; Target_Address.net = 0;
Target_Address.len = 0; /* No src address */ Target_Address.len = 0; /* No src address */
Provided_Targ_MAC = true; Provided_Targ_MAC = true;
break; break;
} } else
else printf("ERROR: invalid Target MAC %s \r\n",
printf( "ERROR: invalid Target MAC %s \r\n", argv[i] ); argv[i]);
/* And fall through to PrintUsage */ /* And fall through to PrintUsage */
} }
/* Either break or fall through, as above */ /* Either break or fall through, as above */
@@ -822,7 +825,9 @@ int CheckCommandLineArgs(
} }
/* Initialize fields for a new Object */ /* Initialize fields for a new Object */
void StartNextObject( BACNET_READ_ACCESS_DATA *rpm_object, BACNET_OBJECT_ID *pNewObject ) void StartNextObject(
BACNET_READ_ACCESS_DATA * rpm_object,
BACNET_OBJECT_ID * pNewObject)
{ {
BACNET_PROPERTY_REFERENCE *rpm_property; BACNET_PROPERTY_REFERENCE *rpm_property;
Error_Detected = false; Error_Detected = false;
@@ -947,8 +952,7 @@ int main(
} }
/* else, loop back and try again */ /* else, loop back and try again */
continue; continue;
} else } else {
{
myState = GET_ALL_REQUEST; myState = GET_ALL_REQUEST;
rpm_object = calloc(1, sizeof(BACNET_READ_ACCESS_DATA)); rpm_object = calloc(1, sizeof(BACNET_READ_ACCESS_DATA));
assert(rpm_object); assert(rpm_object);
@@ -999,8 +1003,8 @@ int main(
invoke_id = 0; invoke_id = 0;
if (Error_Detected) { /* The normal case for Device Object */ if (Error_Detected) { /* The normal case for Device Object */
/* Was it because the Device can't do RPM? */ /* Was it because the Device can't do RPM? */
if ( Last_Error_Code == ERROR_CODE_REJECT_UNRECOGNIZED_SERVICE ) if (Last_Error_Code ==
{ ERROR_CODE_REJECT_UNRECOGNIZED_SERVICE) {
Has_RPM = false; Has_RPM = false;
myState = GET_PROPERTY_REQUEST; myState = GET_PROPERTY_REQUEST;
} }
@@ -1008,13 +1012,11 @@ int main(
else if (myState == GET_ALL_RESPONSE) else if (myState == GET_ALL_RESPONSE)
myState = GET_LIST_OF_ALL_REQUEST; myState = GET_LIST_OF_ALL_REQUEST;
/* Else drop back to RP. */ /* Else drop back to RP. */
else else {
{
myState = GET_PROPERTY_REQUEST; myState = GET_PROPERTY_REQUEST;
StartNextObject(rpm_object, &myObject); StartNextObject(rpm_object, &myObject);
} }
} } else if (Has_RPM)
else if ( Has_RPM )
myState = GET_ALL_REQUEST; /* Let's try again */ myState = GET_ALL_REQUEST; /* Let's try again */
else else
myState = GET_PROPERTY_REQUEST; myState = GET_PROPERTY_REQUEST;
@@ -1060,8 +1062,9 @@ int main(
(invoke_id == (invoke_id ==
Read_Property_Multiple_Data.service_data.invoke_id)) { Read_Property_Multiple_Data.service_data.invoke_id)) {
Read_Property_Multiple_Data.new_data = false; Read_Property_Multiple_Data.new_data = false;
PrintReadPropertyData(Read_Property_Multiple_Data. PrintReadPropertyData
rpm_data->listOfProperties); (Read_Property_Multiple_Data.rpm_data->
listOfProperties);
if (tsm_invoke_id_free(invoke_id)) { if (tsm_invoke_id_free(invoke_id)) {
invoke_id = 0; invoke_id = 0;
} else { } else {
@@ -1100,8 +1103,8 @@ int main(
} else { } else {
/* OK, skip this one and try the next property. */ /* OK, skip this one and try the next property. */
fprintf(stdout, " -- Failed to get "); fprintf(stdout, " -- Failed to get ");
Print_Property_Identifier( Print_Property_Identifier(pPropList
pPropList[Property_List_Index]); [Property_List_Index]);
fprintf(stdout, " \r\n"); fprintf(stdout, " \r\n");
Error_Count++; Error_Count++;
if (++Property_List_Index >= Property_List_Length) if (++Property_List_Index >= Property_List_Length)
@@ -1150,8 +1153,7 @@ int main(
} }
if (Has_RPM) if (Has_RPM)
myState = GET_ALL_REQUEST; myState = GET_ALL_REQUEST;
else else {
{
myState = GET_PROPERTY_REQUEST; myState = GET_PROPERTY_REQUEST;
StartNextObject(rpm_object, &myObject); StartNextObject(rpm_object, &myObject);
} }
+4 -2
View File
@@ -48,7 +48,8 @@ static uint16_t BBMD_Timer_Seconds;
* - BACNET_BBMD_TIMETOLIVE - 0..65535 seconds, defaults to 60000 * - BACNET_BBMD_TIMETOLIVE - 0..65535 seconds, defaults to 60000
* - BACNET_BBMD_ADDRESS - dotted IPv4 address * - BACNET_BBMD_ADDRESS - dotted IPv4 address
*/ */
void dlenv_register_as_foreign_device(void) void dlenv_register_as_foreign_device(
void)
{ {
#if defined(BACDL_BIP) && BBMD_ENABLED #if defined(BACDL_BIP) && BBMD_ENABLED
char *pEnv = NULL; char *pEnv = NULL;
@@ -92,7 +93,8 @@ void dlenv_register_as_foreign_device(void)
* *
* Call this function to renew Foreign Device Registration * Call this function to renew Foreign Device Registration
*/ */
void dlenv_maintenance_timer(uint16_t elapsed_seconds) void dlenv_maintenance_timer(
uint16_t elapsed_seconds)
{ {
if (BBMD_Timer_Seconds) { if (BBMD_Timer_Seconds) {
if (BBMD_Timer_Seconds <= elapsed_seconds) { if (BBMD_Timer_Seconds <= elapsed_seconds) {
+5 -4
View File
@@ -344,8 +344,9 @@ static bool cov_send_request(
value_list[1].next = NULL; value_list[1].next = NULL;
switch (cov_subscription->monitoredObjectIdentifier.type) { switch (cov_subscription->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT: case OBJECT_BINARY_INPUT:
Binary_Input_Encode_Value_List(cov_subscription-> Binary_Input_Encode_Value_List
monitoredObjectIdentifier.instance, &value_list[0]); (cov_subscription->monitoredObjectIdentifier.instance,
&value_list[0]);
break; break;
default: default:
goto COV_FAILED; goto COV_FAILED;
@@ -462,8 +463,8 @@ static bool cov_subscribe(
switch (cov_data->monitoredObjectIdentifier.type) { switch (cov_data->monitoredObjectIdentifier.type) {
case OBJECT_BINARY_INPUT: case OBJECT_BINARY_INPUT:
if (Binary_Input_Valid_Instance(cov_data-> if (Binary_Input_Valid_Instance
monitoredObjectIdentifier.instance)) { (cov_data->monitoredObjectIdentifier.instance)) {
status = status =
cov_list_subscribe(src, cov_data, error_class, error_code); cov_list_subscribe(src, cov_data, error_class, error_code);
} else { } else {
+4 -2
View File
@@ -162,8 +162,10 @@ void handler_read_property(
fprintf(stderr, "RP: Sending Error!\n"); fprintf(stderr, "RP: Sending Error!\n");
#endif #endif
} else if (len == BACNET_STATUS_REJECT) { } else if (len == BACNET_STATUS_REJECT) {
apdu_len = reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len], apdu_len =
service_data->invoke_id, reject_convert_error_code(rpdata.error_code)); reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
reject_convert_error_code(rpdata.error_code));
#if PRINT_ENABLED #if PRINT_ENABLED
fprintf(stderr, "RP: Sending Reject!\n"); fprintf(stderr, "RP: Sending Reject!\n");
#endif #endif
+29 -21
View File
@@ -114,8 +114,8 @@ static int RPM_Encode_Property(
BACNET_READ_PROPERTY_DATA rpdata; BACNET_READ_PROPERTY_DATA rpdata;
len = len =
rpm_ack_encode_apdu_object_property(&Temp_Buf[0], rpmdata->object_property, rpm_ack_encode_apdu_object_property(&Temp_Buf[0],
rpmdata->array_index); rpmdata->object_property, rpmdata->array_index);
copy_len = memcopy(&apdu[0], &Temp_Buf[0], offset, len, max_apdu); copy_len = memcopy(&apdu[0], &Temp_Buf[0], offset, len, max_apdu);
if (copy_len == 0) { if (copy_len == 0) {
rpmdata->error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; rpmdata->error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
@@ -281,11 +281,12 @@ void handler_read_property_multiple(
rpm_ack_encode_apdu_object_property(&Temp_Buf[0], rpm_ack_encode_apdu_object_property(&Temp_Buf[0],
rpmdata.object_property, rpmdata.array_index); rpmdata.object_property, rpmdata.array_index);
copy_len = copy_len =
memcopy(&Handler_Transmit_Buffer[0], memcopy(&Handler_Transmit_Buffer[0], &Temp_Buf[0],
&Temp_Buf[0], npdu_len + apdu_len, npdu_len + apdu_len, len,
len, sizeof(Handler_Transmit_Buffer)); sizeof(Handler_Transmit_Buffer));
if (copy_len == 0) { if (copy_len == 0) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT; error = BACNET_STATUS_ABORT;
goto RPM_FAILURE; goto RPM_FAILURE;
} }
@@ -295,18 +296,20 @@ void handler_read_property_multiple(
ERROR_CLASS_PROPERTY, ERROR_CLASS_PROPERTY,
ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY); ERROR_CODE_PROPERTY_IS_NOT_AN_ARRAY);
copy_len = copy_len =
memcopy(&Handler_Transmit_Buffer[0], memcopy(&Handler_Transmit_Buffer[0], &Temp_Buf[0],
&Temp_Buf[0], npdu_len + apdu_len, npdu_len + apdu_len, len,
len, sizeof(Handler_Transmit_Buffer)); sizeof(Handler_Transmit_Buffer));
if (copy_len == 0) { if (copy_len == 0) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT; error = BACNET_STATUS_ABORT;
goto RPM_FAILURE; goto RPM_FAILURE;
} }
apdu_len += len; apdu_len += len;
} else { } else {
special_object_property = rpmdata.object_property; special_object_property = rpmdata.object_property;
Device_Objects_Property_List(rpmdata.object_type, &property_list); Device_Objects_Property_List(rpmdata.object_type,
&property_list);
property_count = property_count =
RPM_Object_Property_Count(&property_list, RPM_Object_Property_Count(&property_list,
special_object_property); special_object_property);
@@ -314,7 +317,8 @@ void handler_read_property_multiple(
/* handle the error code - but use the special property */ /* handle the error code - but use the special property */
len = len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0], RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata); (uint16_t) (npdu_len + apdu_len), MAX_APDU,
&rpmdata);
if (len > 0) { if (len > 0) {
apdu_len += len; apdu_len += len;
} else { } else {
@@ -327,8 +331,9 @@ void handler_read_property_multiple(
RPM_Object_Property(&property_list, RPM_Object_Property(&property_list,
special_object_property, index); special_object_property, index);
len = len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0], RPM_Encode_Property(&Handler_Transmit_Buffer
(uint16_t)(npdu_len + apdu_len), MAX_APDU, &rpmdata); [0], (uint16_t) (npdu_len + apdu_len),
MAX_APDU, &rpmdata);
if (len > 0) { if (len > 0) {
apdu_len += len; apdu_len += len;
} else { } else {
@@ -342,7 +347,8 @@ void handler_read_property_multiple(
/* handle an individual property */ /* handle an individual property */
len = len =
RPM_Encode_Property(&Handler_Transmit_Buffer[0], RPM_Encode_Property(&Handler_Transmit_Buffer[0],
(uint16_t)(npdu_len + apdu_len), sizeof(Handler_Transmit_Buffer), &rpmdata); (uint16_t) (npdu_len + apdu_len),
sizeof(Handler_Transmit_Buffer), &rpmdata);
if (len > 0) { if (len > 0) {
apdu_len += len; apdu_len += len;
} else { } else {
@@ -356,11 +362,11 @@ void handler_read_property_multiple(
decode_len++; decode_len++;
len = rpm_ack_encode_apdu_object_end(&Temp_Buf[0]); len = rpm_ack_encode_apdu_object_end(&Temp_Buf[0]);
copy_len = copy_len =
memcopy(&Handler_Transmit_Buffer[npdu_len], memcopy(&Handler_Transmit_Buffer[npdu_len], &Temp_Buf[0],
&Temp_Buf[0], apdu_len, len, apdu_len, len, sizeof(Handler_Transmit_Buffer));
sizeof(Handler_Transmit_Buffer));
if (!copy_len) { if (!copy_len) {
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; rpmdata.error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
error = BACNET_STATUS_ABORT; error = BACNET_STATUS_ABORT;
goto RPM_FAILURE; goto RPM_FAILURE;
} else { } else {
@@ -411,8 +417,10 @@ void handler_read_property_multiple(
fprintf(stderr, "RP: Sending Error!\n"); fprintf(stderr, "RP: Sending Error!\n");
#endif #endif
} else if (error == BACNET_STATUS_REJECT) { } else if (error == BACNET_STATUS_REJECT) {
apdu_len = reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len], apdu_len =
service_data->invoke_id, reject_convert_error_code(rpmdata.error_code)); reject_encode_apdu(&Handler_Transmit_Buffer[npdu_len],
service_data->invoke_id,
reject_convert_error_code(rpmdata.error_code));
#if PRINT_ENABLED #if PRINT_ENABLED
fprintf(stderr, "RP: Sending Reject!\n"); fprintf(stderr, "RP: Sending Reject!\n");
#endif #endif
+6 -6
View File
@@ -219,8 +219,8 @@ void rpm_ack_print_data(
#if PRINT_ENABLED #if PRINT_ENABLED
if (listOfProperties->propertyIdentifier < 512) { if (listOfProperties->propertyIdentifier < 512) {
fprintf(stdout, " %s: ", fprintf(stdout, " %s: ",
bactext_property_name bactext_property_name(listOfProperties->
(listOfProperties->propertyIdentifier)); propertyIdentifier));
} else { } else {
fprintf(stdout, " proprietary %u: ", fprintf(stdout, " proprietary %u: ",
(unsigned) listOfProperties->propertyIdentifier); (unsigned) listOfProperties->propertyIdentifier);
@@ -261,10 +261,10 @@ void rpm_ack_print_data(
#if PRINT_ENABLED #if PRINT_ENABLED
/* AccessError */ /* AccessError */
fprintf(stdout, "BACnet Error: %s: %s\r\n", fprintf(stdout, "BACnet Error: %s: %s\r\n",
bactext_error_class_name((int) listOfProperties->error. bactext_error_class_name((int) listOfProperties->
error_class), error.error_class),
bactext_error_code_name((int) listOfProperties->error. bactext_error_code_name((int) listOfProperties->
error_code)); error.error_code));
#endif #endif
} }
listOfProperties = listOfProperties->next; listOfProperties = listOfProperties->next;
+2 -2
View File
@@ -103,8 +103,8 @@ void handler_ucov_notification(
fprintf(stderr, "UCOV: "); fprintf(stderr, "UCOV: ");
if (pProperty_value->propertyIdentifier < 512) { if (pProperty_value->propertyIdentifier < 512) {
fprintf(stderr, "%s ", fprintf(stderr, "%s ",
bactext_property_name(pProperty_value-> bactext_property_name
propertyIdentifier)); (pProperty_value->propertyIdentifier));
} else { } else {
fprintf(stderr, "proprietary %u ", fprintf(stderr, "proprietary %u ",
pProperty_value->propertyIdentifier); pProperty_value->propertyIdentifier);
+2 -2
View File
@@ -173,8 +173,8 @@ bool WPValidateString(
(characterstring_length(&pValue->type.Character_String) == (characterstring_length(&pValue->type.Character_String) ==
0)) { 0)) {
*pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE; *pErrorCode = ERROR_CODE_VALUE_OUT_OF_RANGE;
} else if (characterstring_length(&pValue->type. } else if (characterstring_length(&pValue->
Character_String) >= iMaxLen) { type.Character_String) >= iMaxLen) {
*pErrorClass = ERROR_CLASS_RESOURCES; *pErrorClass = ERROR_CLASS_RESOURCES;
*pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY; *pErrorCode = ERROR_CODE_NO_SPACE_TO_WRITE_PROPERTY;
} else } else
+2 -1
View File
@@ -97,7 +97,8 @@ uint8_t Send_Atomic_Write_File_Stream(
max_apdu in the address binding table. */ max_apdu in the address binding table. */
if ((unsigned) pdu_len <= max_apdu) { if ((unsigned) pdu_len <= max_apdu) {
tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest, tsm_set_confirmed_unsegmented_transaction(invoke_id, &dest,
&npdu_data, &Handler_Transmit_Buffer[0], (uint16_t)pdu_len); &npdu_data, &Handler_Transmit_Buffer[0],
(uint16_t) pdu_len);
bytes_sent = bytes_sent =
datalink_send_pdu(&dest, &npdu_data, datalink_send_pdu(&dest, &npdu_data,
&Handler_Transmit_Buffer[0], pdu_len); &Handler_Transmit_Buffer[0], pdu_len);
+3 -1
View File
@@ -78,7 +78,9 @@ void Send_Who_Is_Router_To_Network(
npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data); npdu_encode_pdu(&Handler_Transmit_Buffer[0], NULL, NULL, &npdu_data);
/* encode the optional DNET portion of the packet */ /* encode the optional DNET portion of the packet */
if (dnet >= 0) { if (dnet >= 0) {
len = encode_unsigned16(&Handler_Transmit_Buffer[pdu_len], (uint16_t)dnet); len =
encode_unsigned16(&Handler_Transmit_Buffer[pdu_len],
(uint16_t) dnet);
pdu_len += len; pdu_len += len;
#if PRINT_ENABLED #if PRINT_ENABLED
fprintf(stderr, "Send Who-Is-Router-To-Network message to %u\n", dnet); fprintf(stderr, "Send Who-Is-Router-To-Network message to %u\n", dnet);
+3 -2
View File
@@ -155,8 +155,9 @@ uint8_t Send_Write_Property_Request(
#if PRINT_ENABLED_DEBUG #if PRINT_ENABLED_DEBUG
fprintf(stderr, "WriteProperty service: " "%s tag=%d\n", fprintf(stderr, "WriteProperty service: " "%s tag=%d\n",
(object_value->context_specific ? "context" : "application"), (object_value->context_specific ? "context" : "application"),
(int) (object_value->context_specific ? object_value-> (int) (object_value->
context_tag : object_value->tag)); context_specific ? object_value->context_tag : object_value->
tag));
#endif #endif
len = bacapp_encode_data(&application_data[apdu_len], object_value); len = bacapp_encode_data(&application_data[apdu_len], object_value);
if ((len + apdu_len) < MAX_APDU) { if ((len + apdu_len) < MAX_APDU) {
+6 -6
View File
@@ -367,8 +367,8 @@ int Analog_Output_Read_Property(
apdu_len = encode_application_null(&apdu[0]); apdu_len = encode_application_null(&apdu[0]);
else { else {
real_value = real_value =
Analog_Output_Level[object_index][rpdata-> Analog_Output_Level[object_index]
array_index - 1]; [rpdata->array_index - 1];
apdu_len = apdu_len =
encode_application_real(&apdu[0], real_value); encode_application_real(&apdu[0], real_value);
} }
@@ -442,11 +442,11 @@ bool Analog_Output_Write_Property(
if (status) { if (status) {
level = AO_LEVEL_NULL; level = AO_LEVEL_NULL;
object_index = object_index =
Analog_Output_Instance_To_Index(wp_data-> Analog_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
status = status =
Analog_Output_Present_Value_Relinquish(wp_data-> Analog_Output_Present_Value_Relinquish
object_instance, wp_data->priority); (wp_data->object_instance, wp_data->priority);
if (!status) { if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY; wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
+4 -4
View File
@@ -316,8 +316,8 @@ int Analog_Value_Read_Property(
apdu_len = encode_application_null(&apdu[0]); apdu_len = encode_application_null(&apdu[0]);
else { else {
real_value = real_value =
Analog_Value_Level[object_index][rpdata-> Analog_Value_Level[object_index]
array_index - 1]; [rpdata->array_index - 1];
apdu_len = apdu_len =
encode_application_real(&apdu[0], real_value); encode_application_real(&apdu[0], real_value);
} }
@@ -392,8 +392,8 @@ bool Analog_Value_Write_Property(
if (status) { if (status) {
level = ANALOG_LEVEL_NULL; level = ANALOG_LEVEL_NULL;
object_index = object_index =
Analog_Value_Instance_To_Index(wp_data-> Analog_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
+6 -6
View File
@@ -297,8 +297,8 @@ int Binary_Output_Read_Property(
apdu_len = encode_application_null(&apdu[apdu_len]); apdu_len = encode_application_null(&apdu[apdu_len]);
else { else {
present_value = present_value =
Binary_Output_Level[object_index][rpdata-> Binary_Output_Level[object_index]
array_index - 1]; [rpdata->array_index - 1];
apdu_len = apdu_len =
encode_application_enumerated(&apdu[apdu_len], encode_application_enumerated(&apdu[apdu_len],
present_value); present_value);
@@ -371,8 +371,8 @@ bool Binary_Output_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) 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
object_instance); (wp_data->object_instance);
priority--; priority--;
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
@@ -398,8 +398,8 @@ bool Binary_Output_Write_Property(
if (status) { if (status) {
level = BINARY_NULL; level = BINARY_NULL;
object_index = object_index =
Binary_Output_Instance_To_Index(wp_data-> Binary_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
+8 -8
View File
@@ -285,13 +285,13 @@ int Binary_Value_Read_Property(
object_index = object_index =
Binary_Value_Instance_To_Index(rpdata->object_instance); Binary_Value_Instance_To_Index(rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) { if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Binary_Value_Level[object_index][rpdata-> if (Binary_Value_Level[object_index][rpdata->array_index]
array_index] == BINARY_NULL) == BINARY_NULL)
apdu_len = encode_application_null(&apdu[apdu_len]); apdu_len = encode_application_null(&apdu[apdu_len]);
else { else {
present_value = present_value =
Binary_Value_Level[object_index][rpdata-> Binary_Value_Level[object_index]
array_index]; [rpdata->array_index];
apdu_len = apdu_len =
encode_application_enumerated(&apdu[apdu_len], encode_application_enumerated(&apdu[apdu_len],
present_value); present_value);
@@ -354,8 +354,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) 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
object_instance); (wp_data->object_instance);
priority--; priority--;
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
@@ -381,8 +381,8 @@ bool Binary_Value_Write_Property(
if (status) { if (status) {
level = BINARY_NULL; level = BINARY_NULL;
object_index = object_index =
Binary_Value_Instance_To_Index(wp_data-> Binary_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
+16 -15
View File
@@ -1101,7 +1101,8 @@ static int Device_Read_Property_Local(
/* can we all fit into the APDU? */ /* can we all fit into the APDU? */
if ((apdu_len + len) >= MAX_APDU) { if ((apdu_len + len) >= MAX_APDU) {
/* Abort response */ /* Abort response */
rpdata->error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED; rpdata->error_code =
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
apdu_len = BACNET_STATUS_ABORT; apdu_len = BACNET_STATUS_ABORT;
break; break;
} }
@@ -1240,8 +1241,8 @@ static bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.Object_Id. (Device_Set_Object_Instance_Number(value.type.
instance))) { Object_Id.instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */ /* FIXME: we could send an I-Am broadcast to let the world know */
} else { } else {
status = false; status = false;
@@ -1274,8 +1275,8 @@ static bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
/* FIXME: bounds check? */ /* FIXME: bounds check? */
Device_Set_Vendor_Identifier((uint16_t) value.type. Device_Set_Vendor_Identifier((uint16_t) value.
Unsigned_Int); type.Unsigned_Int);
} }
break; break;
case PROP_SYSTEM_STATUS: case PROP_SYSTEM_STATUS:
@@ -1302,8 +1303,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false, WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Object_Name(characterstring_value(&value.type. Device_Set_Object_Name(characterstring_value(&value.
Character_String), type.Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1312,8 +1313,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_LOC_LEN, true, WPValidateString(&value, MAX_DEV_LOC_LEN, true,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Location(characterstring_value(&value.type. Device_Set_Location(characterstring_value(&value.
Character_String), type.Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1323,8 +1324,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_DESC_LEN, true, WPValidateString(&value, MAX_DEV_DESC_LEN, true,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Description(characterstring_value(&value.type. Device_Set_Description(characterstring_value(&value.
Character_String), type.Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1333,8 +1334,8 @@ static bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_MOD_LEN, true, WPValidateString(&value, MAX_DEV_MOD_LEN, true,
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
Device_Set_Model_Name(characterstring_value(&value.type. Device_Set_Model_Name(characterstring_value(&value.
Character_String), type.Character_String),
characterstring_length(&value.type.Character_String)); characterstring_length(&value.type.Character_String));
} }
break; break;
@@ -1346,8 +1347,8 @@ static bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
if (value.type.Unsigned_Int <= 255) { if (value.type.Unsigned_Int <= 255) {
dlmstp_set_max_info_frames((uint8_t) value.type. dlmstp_set_max_info_frames((uint8_t) value.
Unsigned_Int); type.Unsigned_Int);
} else { } else {
status = false; status = false;
wp_data->error_class = ERROR_CLASS_PROPERTY; wp_data->error_class = ERROR_CLASS_PROPERTY;
+10 -10
View File
@@ -469,13 +469,13 @@ int Lighting_Output_Read_Property(
object_index = object_index =
Lighting_Output_Instance_To_Index(rpdata->object_instance); Lighting_Output_Instance_To_Index(rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) { if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Lighting_Output_Level[object_index][rpdata-> if (Lighting_Output_Level[object_index][rpdata->array_index
array_index - 1] == LIGHTING_LEVEL_NULL) - 1] == LIGHTING_LEVEL_NULL)
apdu_len = encode_application_null(&apdu[0]); apdu_len = encode_application_null(&apdu[0]);
else { else {
real_value = real_value =
Lighting_Output_Level[object_index][rpdata-> Lighting_Output_Level[object_index]
array_index - 1]; [rpdata->array_index - 1];
apdu_len = apdu_len =
encode_application_real(&apdu[0], real_value); encode_application_real(&apdu[0], real_value);
} }
@@ -550,11 +550,11 @@ bool Lighting_Output_Write_Property(
if (status) { if (status) {
level = LIGHTING_LEVEL_NULL; level = LIGHTING_LEVEL_NULL;
object_index = object_index =
Lighting_Output_Instance_To_Index(wp_data-> Lighting_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
status = status =
Lighting_Output_Present_Value_Relinquish(wp_data-> Lighting_Output_Present_Value_Relinquish
object_instance, wp_data->priority); (wp_data->object_instance, wp_data->priority);
if (wp_data->priority == 6) { if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off /* Command priority 6 is reserved for use by Minimum On/Off
algorithm and may not be used for other purposes in any algorithm and may not be used for other purposes in any
@@ -581,8 +581,8 @@ bool Lighting_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Lighting_Output_Instance_To_Index(wp_data-> Lighting_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
Lighting_Output_Out_Of_Service[object_index] = Lighting_Output_Out_Of_Service[object_index] =
value.type.Boolean; value.type.Boolean;
} }
+4 -4
View File
@@ -318,8 +318,8 @@ bool Life_Safety_Point_Write_Property(
if (status) { if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) { if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
object_index = object_index =
Life_Safety_Point_Instance_To_Index(wp_data-> Life_Safety_Point_Instance_To_Index
object_instance); (wp_data->object_instance);
Life_Safety_Point_Mode[object_index] = Life_Safety_Point_Mode[object_index] =
value.type.Enumerated; value.type.Enumerated;
} else { } else {
@@ -335,8 +335,8 @@ bool Life_Safety_Point_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Life_Safety_Point_Instance_To_Index(wp_data-> Life_Safety_Point_Instance_To_Index
object_instance); (wp_data->object_instance);
Life_Safety_Point_Out_Of_Service[object_index] = Life_Safety_Point_Out_Of_Service[object_index] =
value.type.Boolean; value.type.Boolean;
} }
+8 -8
View File
@@ -400,8 +400,8 @@ int Multistate_Input_Read_Property(
/* if no index was specified, then try to encode the entire list */ /* if no index was specified, then try to encode the entire list */
/* into one packet. */ /* into one packet. */
object_index = object_index =
Multistate_Input_Instance_To_Index(rpdata-> Multistate_Input_Instance_To_Index
object_instance); (rpdata->object_instance);
for (i = 0; i < MULTISTATE_NUMBER_OF_STATES; i++) { for (i = 0; i < MULTISTATE_NUMBER_OF_STATES; i++) {
characterstring_init_ansi(&char_string, characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance, Multistate_Input_State_Text(rpdata->object_instance,
@@ -422,8 +422,8 @@ int Multistate_Input_Read_Property(
} }
} else { } else {
object_index = object_index =
Multistate_Input_Instance_To_Index(rpdata-> Multistate_Input_Instance_To_Index
object_instance); (rpdata->object_instance);
if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) { if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) {
characterstring_init_ansi(&char_string, characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance, Multistate_Input_State_Text(rpdata->object_instance,
@@ -478,8 +478,8 @@ bool Multistate_Input_Write_Property(
if (status) { if (status) {
if (Out_Of_Service[object_index]) { if (Out_Of_Service[object_index]) {
status = status =
Multistate_Input_Present_Value_Set(wp_data-> Multistate_Input_Present_Value_Set
object_instance, value.type.Unsigned_Int); (wp_data->object_instance, value.type.Unsigned_Int);
if (!status) { if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY; wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE; wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -497,8 +497,8 @@ bool Multistate_Input_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Multistate_Input_Instance_To_Index(wp_data-> Multistate_Input_Instance_To_Index
object_instance); (wp_data->object_instance);
Out_Of_Service[object_index] = value.type.Boolean; Out_Of_Service[object_index] = value.type.Boolean;
} }
break; break;
+14 -14
View File
@@ -266,8 +266,8 @@ int Multistate_Output_Read_Property(
/* into one packet. */ /* into one packet. */
else if (rpdata->array_index == BACNET_ARRAY_ALL) { else if (rpdata->array_index == BACNET_ARRAY_ALL) {
object_index = object_index =
Multistate_Output_Instance_To_Index(rpdata-> Multistate_Output_Instance_To_Index
object_instance); (rpdata->object_instance);
for (i = 0; i < BACNET_MAX_PRIORITY; i++) { for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */ /* FIXME: check if we have room before adding it to APDU */
if (Multistate_Output_Level[object_index][i] == if (Multistate_Output_Level[object_index][i] ==
@@ -292,16 +292,16 @@ int Multistate_Output_Read_Property(
} }
} else { } else {
object_index = object_index =
Multistate_Output_Instance_To_Index(rpdata-> Multistate_Output_Instance_To_Index
object_instance); (rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) { if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Multistate_Output_Level[object_index][rpdata-> if (Multistate_Output_Level[object_index]
array_index - 1] == MULTISTATE_NULL) [rpdata->array_index - 1] == MULTISTATE_NULL)
apdu_len = encode_application_null(&apdu[0]); apdu_len = encode_application_null(&apdu[0]);
else { else {
present_value = present_value =
Multistate_Output_Level[object_index][rpdata-> Multistate_Output_Level[object_index]
array_index - 1]; [rpdata->array_index - 1];
apdu_len = apdu_len =
encode_application_unsigned(&apdu[0], encode_application_unsigned(&apdu[0],
present_value); present_value);
@@ -370,8 +370,8 @@ bool Multistate_Output_Write_Property(
(value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) { (value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) {
level = value.type.Unsigned_Int; level = value.type.Unsigned_Int;
object_index = object_index =
Multistate_Output_Instance_To_Index(wp_data-> Multistate_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
priority--; priority--;
Multistate_Output_Level[object_index][priority] = Multistate_Output_Level[object_index][priority] =
(uint8_t) level; (uint8_t) level;
@@ -398,8 +398,8 @@ bool Multistate_Output_Write_Property(
if (status) { if (status) {
level = MULTISTATE_NULL; level = MULTISTATE_NULL;
object_index = object_index =
Multistate_Output_Instance_To_Index(wp_data-> Multistate_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
@@ -425,8 +425,8 @@ bool Multistate_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code); &wp_data->error_class, &wp_data->error_code);
if (status) { if (status) {
object_index = object_index =
Multistate_Output_Instance_To_Index(wp_data-> Multistate_Output_Instance_To_Index
object_instance); (wp_data->object_instance);
Multistate_Output_Out_Of_Service[object_index] = Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean; value.type.Boolean;
} }
+23 -14
View File
@@ -731,9 +731,9 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) { if (wp_data->application_data_len != 0) {
iOffset += len; iOffset += len;
len = len =
bacapp_decode_context_data(&wp_data-> bacapp_decode_context_data(&wp_data->application_data
application_data[iOffset], wp_data->application_data_len, [iOffset], wp_data->application_data_len, &value,
&value, PROP_LOG_DEVICE_OBJECT_PROPERTY); PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || ((value.context_tag != 2) && if ((len == 0) || ((value.context_tag != 2) &&
(value.context_tag != 3))) { (value.context_tag != 3))) {
/* Bad decode or wrong tag */ /* Bad decode or wrong tag */
@@ -750,8 +750,8 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) { if (wp_data->application_data_len != 0) {
iOffset += len; iOffset += len;
len = len =
bacapp_decode_context_data(&wp_data-> bacapp_decode_context_data
application_data[iOffset], (&wp_data->application_data[iOffset],
wp_data->application_data_len, &value, wp_data->application_data_len, &value,
PROP_LOG_DEVICE_OBJECT_PROPERTY); PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || (value.context_tag != 3)) { if ((len == 0) || (value.context_tag != 3)) {
@@ -1093,8 +1093,8 @@ int rr_trend_log_encode(
pRequest->ItemCount = 0; /* Start out with nothing */ pRequest->ItemCount = 0; /* Start out with nothing */
/* Bail out now if nowt - should never happen for a Trend Log but ... */ /* Bail out now if nowt - should never happen for a Trend Log but ... */
if (LogInfo[Trend_Log_Instance_To_Index(pRequest->object_instance)]. if (LogInfo[Trend_Log_Instance_To_Index(pRequest->
ulRecordCount == 0) object_instance)].ulRecordCount == 0)
return (0); return (0);
if ((pRequest->RequestType == RR_BY_POSITION) || if ((pRequest->RequestType == RR_BY_POSITION) ||
@@ -1555,11 +1555,17 @@ int TL_encode_entry(
* have limited to 32 bits maximum as allowed by the standard * have limited to 32 bits maximum as allowed by the standard
*/ */
bitstring_init(&TempBits); bitstring_init(&TempBits);
bitstring_set_bits_used(&TempBits, (pSource->Datum.Bits.ucLen >> 4) & 0x0F, pSource->Datum.Bits.ucLen & 0x0F); bitstring_set_bits_used(&TempBits,
for(ucCount = pSource->Datum.Bits.ucLen >> 4; ucCount > 0; ucCount--) (pSource->Datum.Bits.ucLen >> 4) & 0x0F,
bitstring_set_octet(&TempBits, ucCount - 1, pSource->Datum.Bits.ucStore[ucCount-1]); pSource->Datum.Bits.ucLen & 0x0F);
for (ucCount = pSource->Datum.Bits.ucLen >> 4; ucCount > 0;
ucCount--)
bitstring_set_octet(&TempBits, ucCount - 1,
pSource->Datum.Bits.ucStore[ucCount - 1]);
iLen += encode_context_bitstring(&apdu[iLen], pSource->ucRecType, &TempBits); iLen +=
encode_context_bitstring(&apdu[iLen], pSource->ucRecType,
&TempBits);
break; break;
case TL_TYPE_NULL: case TL_TYPE_NULL:
@@ -1722,13 +1728,16 @@ void TL_fetch_property(
TempRec.Datum.Bits.ucLen |= TempRec.Datum.Bits.ucLen |=
(8 - (bitstring_bits_used(&TempBits) % 8)) & 7; (8 - (bitstring_bits_used(&TempBits) % 8)) & 7;
/* Fetch the octets with the bits directly */ /* Fetch the octets with the bits directly */
for(ucCount = 0; ucCount < bitstring_bytes_used(&TempBits); ucCount++) for (ucCount = 0;
TempRec.Datum.Bits.ucStore[ucCount] = bitstring_octet(&TempBits, ucCount); ucCount < bitstring_bytes_used(&TempBits); ucCount++)
TempRec.Datum.Bits.ucStore[ucCount] =
bitstring_octet(&TempBits, ucCount);
} else { } else {
/* We will only use the first 4 octets to save space */ /* We will only use the first 4 octets to save space */
TempRec.Datum.Bits.ucLen = 4 << 4; TempRec.Datum.Bits.ucLen = 4 << 4;
for (ucCount = 0; ucCount < 4; ucCount++) for (ucCount = 0; ucCount < 4; ucCount++)
TempRec.Datum.Bits.ucStore[ucCount] = bitstring_octet(&TempBits, ucCount); TempRec.Datum.Bits.ucStore[ucCount] =
bitstring_octet(&TempBits, ucCount);
} }
break; break;
+2 -2
View File
@@ -132,8 +132,8 @@ void My_Read_Property_Ack_Handler(
if (address_match(&Target_Address, src) && if (address_match(&Target_Address, src) &&
(service_data->invoke_id == Request_Invoke_ID)) { (service_data->invoke_id == Request_Invoke_ID)) {
len = rp_ack_decode_service_request( len =
service_request, service_len, &data); rp_ack_decode_service_request(service_request, service_len, &data);
if (len > 0) { if (len > 0) {
rp_ack_print_data(&data); rp_ack_print_data(&data);
} }
-1
View File
@@ -379,7 +379,6 @@ typedef enum {
PROP_BIT_MASK = 342, PROP_BIT_MASK = 342,
PROP_BIT_TEXT = 343, PROP_BIT_TEXT = 343,
PROP_IS_UTC = 344 PROP_IS_UTC = 344
/* The special property identifiers all, optional, and required */ /* The special property identifiers all, optional, and required */
/* are reserved for use in the ReadPropertyConditional and */ /* are reserved for use in the ReadPropertyConditional and */
/* ReadPropertyMultiple services or services not defined in this standard. */ /* ReadPropertyMultiple services or services not defined in this standard. */
+4 -2
View File
@@ -31,8 +31,10 @@ extern "C" {
void dlenv_init( void dlenv_init(
void); void);
void dlenv_register_as_foreign_device(void); void dlenv_register_as_foreign_device(
void dlenv_maintenance_timer(uint16_t elapsed_seconds); void);
void dlenv_maintenance_timer(
uint16_t elapsed_seconds);
#ifdef __cplusplus #ifdef __cplusplus
} }
+13 -7
View File
@@ -1,9 +1,15 @@
#!/bin/sh #!/bin/sh
# indent uses a local indent.pro file if it exists # indent uses a local indent.pro file if it exists
# File must be in consistent unix format before indenting # File must be in consistent unix format before indenting
#DOS2UNIX=/usr/bin/dos2unix
DOS2UNIX=/usr/bin/fromdos
INDENT=/usr/bin/indent
REMOVE=/bin/rm
# exit silently if utility is not installed # exit silently if utility is not installed
[ -x /usr/bin/indent ] || exit 0 [ -x ${INDENT} ] || exit 0
[ -x /usr/bin/dos2unix ] || exit 0 [ -x ${DOS2UNIX} ] || exit 0
INDENTRC=".indent.pro" INDENTRC=".indent.pro"
if [ ! -e ${INDENTRC} ] if [ ! -e ${INDENTRC} ]
@@ -16,22 +22,22 @@ directory=${1-`pwd`}
for filename in $( find $directory -name '*.c' ) for filename in $( find $directory -name '*.c' )
do do
echo Fixing DOS/Unix $filename echo Fixing DOS/Unix $filename
/usr/bin/dos2unix $filename ${DOS2UNIX} $filename
echo Indenting $filename echo Indenting $filename
/usr/bin/indent $filename ${INDENT} $filename
done done
for filename in $( find $directory -name '*.h' ) for filename in $( find $directory -name '*.h' )
do do
echo Fixing DOS/Unix $filename echo Fixing DOS/Unix $filename
/usr/bin/dos2unix $filename ${DOS2UNIX} $filename
echo Indenting $filename echo Indenting $filename
/usr/bin/indent $filename ${INDENT} $filename
done done
for filename in $( find $directory -name '*~' ) for filename in $( find $directory -name '*~' )
do do
echo Removing backup $filename echo Removing backup $filename
rm $filename ${REMOVE} $filename
done done
+2 -2
View File
@@ -355,8 +355,8 @@ bool Analog_Value_Write_Property(
(value.type.Real >= 0.0) && (value.type.Real <= 100.0)) { (value.type.Real >= 0.0) && (value.type.Real <= 100.0)) {
level = (uint8_t) value.type.Real; level = (uint8_t) value.type.Real;
object_index = object_index =
Analog_Value_Instance_To_Index(wp_data-> Analog_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
priority--; priority--;
Present_Value[object_index] = level; Present_Value[object_index] = level;
/* Note: you could set the physical output here if we /* Note: you could set the physical output here if we
+2 -2
View File
@@ -265,8 +265,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated; level = value.type.Enumerated;
object_index = object_index =
Binary_Value_Instance_To_Index(wp_data-> Binary_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
priority--; priority--;
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = level; Present_Value[object_index] = level;
+2 -2
View File
@@ -824,8 +824,8 @@ bool Device_Write_Property_Local(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.Object_Id. (Device_Set_Object_Instance_Number(value.type.
instance))) { Object_Id.instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
+2 -2
View File
@@ -206,8 +206,8 @@ bool Binary_Value_Write_Property(
if ((value.type.Enumerated == BINARY_ACTIVE) || if ((value.type.Enumerated == BINARY_ACTIVE) ||
(value.type.Enumerated == BINARY_INACTIVE)) { (value.type.Enumerated == BINARY_INACTIVE)) {
object_index = object_index =
Binary_Value_Instance_To_Index(wp_data-> Binary_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = Present_Value[object_index] =
(BACNET_BINARY_PV) value.type.Enumerated; (BACNET_BINARY_PV) value.type.Enumerated;
+6 -5
View File
@@ -224,11 +224,12 @@ int Device_Encode_Property_APDU(
encode_application_character_string(&apdu[0], &char_string); encode_application_character_string(&apdu[0], &char_string);
break; break;
case PROP_PROTOCOL_VERSION: case PROP_PROTOCOL_VERSION:
apdu_len = encode_application_unsigned(&apdu[0], apdu_len =
BACNET_PROTOCOL_VERSION); encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_VERSION);
break; break;
case PROP_PROTOCOL_REVISION: case PROP_PROTOCOL_REVISION:
apdu_len = encode_application_unsigned(&apdu[0], apdu_len =
encode_application_unsigned(&apdu[0],
BACNET_PROTOCOL_REVISION); BACNET_PROTOCOL_REVISION);
break; break;
case PROP_PROTOCOL_SERVICES_SUPPORTED: case PROP_PROTOCOL_SERVICES_SUPPORTED:
@@ -373,8 +374,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.Object_Id. (Device_Set_Object_Instance_Number(value.type.
instance))) { Object_Id.instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
+2 -2
View File
@@ -206,8 +206,8 @@ bool Binary_Value_Write_Property(
if ((value.type.Enumerated == BINARY_ACTIVE) || if ((value.type.Enumerated == BINARY_ACTIVE) ||
(value.type.Enumerated == BINARY_INACTIVE)) { (value.type.Enumerated == BINARY_INACTIVE)) {
object_index = object_index =
Binary_Value_Instance_To_Index(wp_data-> Binary_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = Present_Value[object_index] =
(BACNET_BINARY_PV) value.type.Enumerated; (BACNET_BINARY_PV) value.type.Enumerated;
+4 -3
View File
@@ -230,11 +230,12 @@ int Device_Encode_Property_APDU(
encode_application_character_string(&apdu[0], &char_string); encode_application_character_string(&apdu[0], &char_string);
break; break;
case PROP_PROTOCOL_VERSION: case PROP_PROTOCOL_VERSION:
apdu_len = encode_application_unsigned(&apdu[0], apdu_len =
BACNET_PROTOCOL_VERSION); encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_VERSION);
break; break;
case PROP_PROTOCOL_REVISION: case PROP_PROTOCOL_REVISION:
apdu_len = encode_application_unsigned(&apdu[0], apdu_len =
encode_application_unsigned(&apdu[0],
BACNET_PROTOCOL_REVISION); BACNET_PROTOCOL_REVISION);
break; break;
case PROP_PROTOCOL_SERVICES_SUPPORTED: case PROP_PROTOCOL_SERVICES_SUPPORTED:
+2 -2
View File
@@ -445,8 +445,8 @@ bool Binary_Output_Write_Property(
priority = wp_data->priority; priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) { if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--; priority--;
Binary_Output_Present_Value_Set(wp_data-> Binary_Output_Present_Value_Set
object_instance, level, priority); (wp_data->object_instance, level, priority);
} else if (priority == 6) { } else if (priority == 6) {
status = false; status = false;
/* Command priority 6 is reserved for use by Minimum On/Off /* Command priority 6 is reserved for use by Minimum On/Off
+8 -7
View File
@@ -642,11 +642,12 @@ int Device_Read_Property_Local(
encode_application_character_string(&apdu[0], &char_string); encode_application_character_string(&apdu[0], &char_string);
break; break;
case PROP_PROTOCOL_VERSION: case PROP_PROTOCOL_VERSION:
apdu_len = encode_application_unsigned(&apdu[0], apdu_len =
BACNET_PROTOCOL_VERSION); encode_application_unsigned(&apdu[0], BACNET_PROTOCOL_VERSION);
break; break;
case PROP_PROTOCOL_REVISION: case PROP_PROTOCOL_REVISION:
apdu_len = encode_application_unsigned(&apdu[0], apdu_len =
encode_application_unsigned(&apdu[0],
BACNET_PROTOCOL_REVISION); BACNET_PROTOCOL_REVISION);
break; break;
case PROP_PROTOCOL_SERVICES_SUPPORTED: case PROP_PROTOCOL_SERVICES_SUPPORTED:
@@ -801,8 +802,8 @@ bool Device_Write_Property_Local(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.Object_Id. (Device_Set_Object_Instance_Number(value.type.
instance))) { Object_Id.instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
@@ -862,8 +863,8 @@ bool Device_Write_Property_Local(
eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_LENGTH, eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_LENGTH,
&small_length, 1); &small_length, 1);
pCharString = pCharString =
characterstring_value(&value.type. characterstring_value(&value.
Character_String); type.Character_String);
eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_0, eeprom_bytes_write(NV_EEPROM_DEVICE_NAME_0,
(uint8_t *) pCharString, length); (uint8_t *) pCharString, length);
status = true; status = true;
+2 -2
View File
@@ -320,8 +320,8 @@ bool Analog_Value_Write_Property(
(value.type.Real >= 0.0) && (value.type.Real <= 100.0)) { (value.type.Real >= 0.0) && (value.type.Real <= 100.0)) {
level = (uint8_t) value.type.Real; level = (uint8_t) value.type.Real;
object_index = object_index =
Analog_Value_Instance_To_Index(wp_data-> Analog_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
priority--; priority--;
Present_Value[object_index] = level; Present_Value[object_index] = level;
/* Note: you could set the physical output here if we /* Note: you could set the physical output here if we
+2 -2
View File
@@ -232,8 +232,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) { (value.type.Enumerated <= MAX_BINARY_PV)) {
level = value.type.Enumerated; level = value.type.Enumerated;
object_index = object_index =
Binary_Value_Instance_To_Index(wp_data-> Binary_Value_Instance_To_Index
object_instance); (wp_data->object_instance);
priority--; priority--;
/* NOTE: this Binary value has no priority array */ /* NOTE: this Binary value has no priority array */
Present_Value[object_index] = level; Present_Value[object_index] = level;
+2 -2
View File
@@ -505,8 +505,8 @@ bool Device_Write_Property(
case PROP_OBJECT_IDENTIFIER: case PROP_OBJECT_IDENTIFIER:
if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) { if (value.tag == BACNET_APPLICATION_TAG_OBJECT_ID) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) && if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.Object_Id. (Device_Set_Object_Instance_Number(value.type.
instance))) { Object_Id.instance))) {
/* we could send an I-Am broadcast to let the world know */ /* we could send an I-Am broadcast to let the world know */
status = true; status = true;
} else { } else {
+2 -1
View File
@@ -367,7 +367,8 @@ bool dlmstp_compare_data_expecting_reply(
/* decode the reply data */ /* decode the reply data */
bacnet_address_copy(&reply.address, dest_address); bacnet_address_copy(&reply.address, dest_address);
offset = offset =
(uint16_t)npdu_decode(&reply_pdu[0], &reply.address, NULL, &reply.npdu_data); (uint16_t) npdu_decode(&reply_pdu[0], &reply.address, NULL,
&reply.npdu_data);
if (reply.npdu_data.network_layer_message) { if (reply.npdu_data.network_layer_message) {
return false; return false;
} }
+1
View File
@@ -97,6 +97,7 @@ void strupper(
*p = (char) toupper(*p); *p = (char) toupper(*p);
} }
} }
#pragma #pragma
/**************************************************************************** /****************************************************************************
+4 -2
View File
@@ -149,7 +149,8 @@ struct Address_Cache_Entry *address_remove_oldest(
pMatch = Address_Cache; pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) { while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ | if ((pMatch->
Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
BAC_ADDR_STATIC)) == BAC_ADDR_IN_USE) { BAC_ADDR_STATIC)) == BAC_ADDR_IN_USE) {
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */ if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
ulTime = pMatch->TimeToLive; ulTime = pMatch->TimeToLive;
@@ -168,7 +169,8 @@ struct Address_Cache_Entry *address_remove_oldest(
/* Second pass - try in use and un bound as last resort */ /* Second pass - try in use and un bound as last resort */
pMatch = Address_Cache; pMatch = Address_Cache;
while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) { while (pMatch <= &Address_Cache[MAX_ADDRESS_CACHE - 1]) {
if ((pMatch->Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ | if ((pMatch->
Flags & (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ |
BAC_ADDR_STATIC)) == BAC_ADDR_STATIC)) ==
((uint8_t) (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ))) { ((uint8_t) (BAC_ADDR_IN_USE | BAC_ADDR_BIND_REQ))) {
if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */ if (pMatch->TimeToLive <= ulTime) { /* Shorter lived entry found */
+4 -2
View File
@@ -211,7 +211,8 @@ bool apdu_service_supported_to_index(
} }
/* Confirmed ACK Function Handlers */ /* Confirmed ACK Function Handlers */
static confirmed_ack_function Confirmed_ACK_Function[MAX_BACNET_CONFIRMED_SERVICE]; static confirmed_ack_function
Confirmed_ACK_Function[MAX_BACNET_CONFIRMED_SERVICE];
void apdu_set_confirmed_simple_ack_handler( void apdu_set_confirmed_simple_ack_handler(
BACNET_CONFIRMED_SERVICE service_choice, BACNET_CONFIRMED_SERVICE service_choice,
@@ -238,7 +239,8 @@ void apdu_set_confirmed_simple_ack_handler(
case SERVICE_CONFIRMED_VT_CLOSE: case SERVICE_CONFIRMED_VT_CLOSE:
/* Security Services */ /* Security Services */
case SERVICE_CONFIRMED_REQUEST_KEY: case SERVICE_CONFIRMED_REQUEST_KEY:
Confirmed_ACK_Function[service_choice] = (confirmed_ack_function)pFunction; Confirmed_ACK_Function[service_choice] =
(confirmed_ack_function) pFunction;
break; break;
default: default:
break; break;
+12 -12
View File
@@ -891,8 +891,8 @@ bool bacapp_print_value(
case PROP_OBJECT_TYPE: case PROP_OBJECT_TYPE:
if (value->type.Enumerated < MAX_ASHRAE_OBJECT_TYPE) { if (value->type.Enumerated < MAX_ASHRAE_OBJECT_TYPE) {
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_object_type_name(value-> bactext_object_type_name(value->type.
type.Enumerated)); Enumerated));
} else if (value->type.Enumerated < 128) { } else if (value->type.Enumerated < 128) {
fprintf(stream, "reserved %lu", fprintf(stream, "reserved %lu",
(unsigned long) value->type.Enumerated); (unsigned long) value->type.Enumerated);
@@ -908,8 +908,8 @@ bool bacapp_print_value(
case PROP_UNITS: case PROP_UNITS:
if (value->type.Enumerated < 256) { if (value->type.Enumerated < 256) {
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_engineering_unit_name(value->type. bactext_engineering_unit_name(value->
Enumerated)); type.Enumerated));
} else { } else {
fprintf(stream, "proprietary %lu", fprintf(stream, "proprietary %lu",
(unsigned long) value->type.Enumerated); (unsigned long) value->type.Enumerated);
@@ -917,13 +917,13 @@ bool bacapp_print_value(
break; break;
case PROP_POLARITY: case PROP_POLARITY:
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_binary_polarity_name(value->type. bactext_binary_polarity_name(value->
Enumerated)); type.Enumerated));
break; break;
case PROP_PRESENT_VALUE: case PROP_PRESENT_VALUE:
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_binary_present_value_name(value->type. bactext_binary_present_value_name(value->
Enumerated)); type.Enumerated));
break; break;
case PROP_RELIABILITY: case PROP_RELIABILITY:
fprintf(stream, "%s", fprintf(stream, "%s",
@@ -931,8 +931,8 @@ bool bacapp_print_value(
break; break;
case PROP_SYSTEM_STATUS: case PROP_SYSTEM_STATUS:
fprintf(stream, "%s", fprintf(stream, "%s",
bactext_device_status_name(value->type. bactext_device_status_name(value->
Enumerated)); type.Enumerated));
break; break;
case PROP_SEGMENTATION_SUPPORTED: case PROP_SEGMENTATION_SUPPORTED:
fprintf(stream, "%s", fprintf(stream, "%s",
@@ -1303,8 +1303,8 @@ void testBACnetApplicationData_Safe(
break; break;
case BACNET_APPLICATION_TAG_CHARACTER_STRING: case BACNET_APPLICATION_TAG_CHARACTER_STRING:
characterstring_init_ansi(&input_value[i]. characterstring_init_ansi(&input_value[i].type.
type.Character_String, "Hello There!"); Character_String, "Hello There!");
break; break;
case BACNET_APPLICATION_TAG_BIT_STRING: case BACNET_APPLICATION_TAG_BIT_STRING:
+10 -6
View File
@@ -668,7 +668,8 @@ static void bvlc_bdt_forward_npdu(
unsigned i = 0; /* loop counter */ unsigned i = 0; /* loop counter */
struct sockaddr_in bip_dest = { 0 }; struct sockaddr_in bip_dest = { 0 };
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length); mtu_len =
(uint16_t) bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length);
/* loop through the BDT and send one to each entry, except us */ /* loop through the BDT and send one to each entry, except us */
for (i = 0; i < MAX_BBMD_ENTRIES; i++) { for (i = 0; i < MAX_BBMD_ENTRIES; i++) {
if (BBMD_Table[i].valid) { if (BBMD_Table[i].valid) {
@@ -677,8 +678,8 @@ static void bvlc_bdt_forward_npdu(
mask in the BDT entry and logically ORing it with the mask in the BDT entry and logically ORing it with the
BBMD address of the same entry. */ BBMD address of the same entry. */
bip_dest.sin_addr.s_addr = bip_dest.sin_addr.s_addr =
htonl(((~BBMD_Table[i].broadcast_mask.s_addr) | BBMD_Table[i]. htonl(((~BBMD_Table[i].broadcast_mask.
dest_address.s_addr)); s_addr) | BBMD_Table[i].dest_address.s_addr));
bip_dest.sin_port = htons(BBMD_Table[i].dest_port); bip_dest.sin_port = htons(BBMD_Table[i].dest_port);
/* don't send to my broadcast address and same port */ /* don't send to my broadcast address and same port */
if ((bip_dest.sin_addr.s_addr == htonl(bip_get_broadcast_addr())) if ((bip_dest.sin_addr.s_addr == htonl(bip_get_broadcast_addr()))
@@ -710,7 +711,8 @@ static void bvlc_forward_npdu(
uint16_t mtu_len = 0; uint16_t mtu_len = 0;
struct sockaddr_in bip_dest = { 0 }; struct sockaddr_in bip_dest = { 0 };
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length); mtu_len =
(uint16_t) bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, npdu_length);
bip_dest.sin_addr.s_addr = htonl(bip_get_broadcast_addr()); bip_dest.sin_addr.s_addr = htonl(bip_get_broadcast_addr());
bip_dest.sin_port = htons(bip_get_port()); bip_dest.sin_port = htons(bip_get_port());
bvlc_send_mpdu(&bip_dest, mtu, mtu_len); bvlc_send_mpdu(&bip_dest, mtu, mtu_len);
@@ -727,7 +729,8 @@ static void bvlc_fdt_forward_npdu(
unsigned i = 0; /* loop counter */ unsigned i = 0; /* loop counter */
struct sockaddr_in bip_dest = { 0 }; struct sockaddr_in bip_dest = { 0 };
mtu_len = (uint16_t)bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, max_npdu); mtu_len =
(uint16_t) bvlc_encode_forwarded_npdu(&mtu[0], sin, npdu, max_npdu);
/* loop through the FDT and send one to each entry */ /* loop through the FDT and send one to each entry */
for (i = 0; i < MAX_FD_ENTRIES; i++) { for (i = 0; i < MAX_FD_ENTRIES; i++) {
if (FD_Table[i].valid && FD_Table[i].seconds_remaining) { if (FD_Table[i].valid && FD_Table[i].seconds_remaining) {
@@ -769,7 +772,8 @@ void bvlc_register_with_bbmd(
Write Broadcast Distribution Table, or Write Broadcast Distribution Table, or
register with the BBMD as a Foreign Device */ register with the BBMD as a Foreign Device */
mtu_len = mtu_len =
(uint16_t)bvlc_encode_register_foreign_device(&mtu[0], time_to_live_seconds); (uint16_t) bvlc_encode_register_foreign_device(&mtu[0],
time_to_live_seconds);
bvlc_send_mpdu(&Remote_BBMD, &mtu[0], mtu_len); bvlc_send_mpdu(&Remote_BBMD, &mtu[0], mtu_len);
} }
+139 -134
View File
@@ -192,14 +192,14 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], 0, encode_context_bitstring(&apdu[apdu_len], 0,
&data->notificationParams.changeOfBitstring. &data->notificationParams.
referencedBitString); changeOfBitstring.referencedBitString);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.changeOfBitstring. &data->notificationParams.
statusFlags); changeOfBitstring.statusFlags);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 0); len = encode_closing_tag(&apdu[apdu_len], 0);
@@ -223,8 +223,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.changeOfState. &data->notificationParams.
statusFlags); changeOfState.statusFlags);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 1); len = encode_closing_tag(&apdu[apdu_len], 1);
@@ -242,8 +242,8 @@ int event_notify_encode_service_request(
case CHANGE_OF_VALUE_REAL: case CHANGE_OF_VALUE_REAL:
len = len =
encode_context_real(&apdu[apdu_len], 1, encode_context_real(&apdu[apdu_len], 1,
data->notificationParams.changeOfValue. data->notificationParams.
newValue.changeValue); changeOfValue.newValue.changeValue);
apdu_len += len; apdu_len += len;
break; break;
@@ -251,8 +251,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], encode_context_bitstring(&apdu[apdu_len],
0, 0,
&data->notificationParams.changeOfValue. &data->notificationParams.
newValue.changedBits); changeOfValue.newValue.changedBits);
apdu_len += len; apdu_len += len;
break; break;
@@ -265,8 +265,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.changeOfValue. &data->notificationParams.
statusFlags); changeOfValue.statusFlags);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 2); len = encode_closing_tag(&apdu[apdu_len], 2);
@@ -280,20 +280,20 @@ int event_notify_encode_service_request(
len = len =
encode_context_real(&apdu[apdu_len], 0, encode_context_real(&apdu[apdu_len], 0,
data->notificationParams.floatingLimit. data->notificationParams.
referenceValue); floatingLimit.referenceValue);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.floatingLimit. &data->notificationParams.
statusFlags); floatingLimit.statusFlags);
apdu_len += len; apdu_len += len;
len = len =
encode_context_real(&apdu[apdu_len], 2, encode_context_real(&apdu[apdu_len], 2,
data->notificationParams.floatingLimit. data->notificationParams.
setPointValue); floatingLimit.setPointValue);
apdu_len += len; apdu_len += len;
len = len =
@@ -312,8 +312,8 @@ int event_notify_encode_service_request(
len = len =
encode_context_real(&apdu[apdu_len], 0, encode_context_real(&apdu[apdu_len], 0,
data->notificationParams.outOfRange. data->notificationParams.
exceedingValue); outOfRange.exceedingValue);
apdu_len += len; apdu_len += len;
len = len =
@@ -341,26 +341,26 @@ int event_notify_encode_service_request(
len = len =
encode_context_enumerated(&apdu[apdu_len], 0, encode_context_enumerated(&apdu[apdu_len], 0,
data->notificationParams.changeOfLifeSafety. data->notificationParams.
newState); changeOfLifeSafety.newState);
apdu_len += len; apdu_len += len;
len = len =
encode_context_enumerated(&apdu[apdu_len], 1, encode_context_enumerated(&apdu[apdu_len], 1,
data->notificationParams.changeOfLifeSafety. data->notificationParams.
newMode); changeOfLifeSafety.newMode);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 2, encode_context_bitstring(&apdu[apdu_len], 2,
&data->notificationParams.changeOfLifeSafety. &data->notificationParams.
statusFlags); changeOfLifeSafety.statusFlags);
apdu_len += len; apdu_len += len;
len = len =
encode_context_enumerated(&apdu[apdu_len], 3, encode_context_enumerated(&apdu[apdu_len], 3,
data->notificationParams.changeOfLifeSafety. data->notificationParams.
operationExpected); changeOfLifeSafety.operationExpected);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 8); len = encode_closing_tag(&apdu[apdu_len], 8);
@@ -374,20 +374,20 @@ int event_notify_encode_service_request(
len = len =
bacapp_encode_context_device_obj_property_ref(&apdu bacapp_encode_context_device_obj_property_ref(&apdu
[apdu_len], 0, [apdu_len], 0,
&data->notificationParams.bufferReady. &data->notificationParams.
bufferProperty); bufferReady.bufferProperty);
apdu_len += len; apdu_len += len;
len = len =
encode_context_unsigned(&apdu[apdu_len], 1, encode_context_unsigned(&apdu[apdu_len], 1,
data->notificationParams.bufferReady. data->notificationParams.
previousNotification); bufferReady.previousNotification);
apdu_len += len; apdu_len += len;
len = len =
encode_context_unsigned(&apdu[apdu_len], 2, encode_context_unsigned(&apdu[apdu_len], 2,
data->notificationParams.bufferReady. data->notificationParams.
currentNotification); bufferReady.currentNotification);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 10); len = encode_closing_tag(&apdu[apdu_len], 10);
@@ -399,20 +399,20 @@ int event_notify_encode_service_request(
len = len =
encode_context_unsigned(&apdu[apdu_len], 0, encode_context_unsigned(&apdu[apdu_len], 0,
data->notificationParams.unsignedRange. data->notificationParams.
exceedingValue); unsignedRange.exceedingValue);
apdu_len += len; apdu_len += len;
len = len =
encode_context_bitstring(&apdu[apdu_len], 1, encode_context_bitstring(&apdu[apdu_len], 1,
&data->notificationParams.unsignedRange. &data->notificationParams.
statusFlags); unsignedRange.statusFlags);
apdu_len += len; apdu_len += len;
len = len =
encode_context_unsigned(&apdu[apdu_len], 2, encode_context_unsigned(&apdu[apdu_len], 2,
data->notificationParams.unsignedRange. data->notificationParams.
exceededLimit); unsignedRange.exceededLimit);
apdu_len += len; apdu_len += len;
len = encode_closing_tag(&apdu[apdu_len], 11); len = encode_closing_tag(&apdu[apdu_len], 11);
@@ -595,16 +595,18 @@ int event_notify_decode_service_request(
case EVENT_CHANGE_OF_BITSTRING: case EVENT_CHANGE_OF_BITSTRING:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 0, decode_context_bitstring(&apdu[len], 0,
&data->notificationParams. &data->
changeOfBitstring.referencedBitString))) { notificationParams.changeOfBitstring.
referencedBitString))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams. &data->
changeOfBitstring.statusFlags))) { notificationParams.changeOfBitstring.
statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -615,16 +617,16 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
bacapp_decode_context_property_state(&apdu bacapp_decode_context_property_state(&apdu
[len], 0, [len], 0,
&data->notificationParams.changeOfState. &data->notificationParams.
newState))) { changeOfState.newState))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.changeOfState. &data->notificationParams.
statusFlags))) { changeOfState.statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -642,8 +644,9 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 0, decode_context_bitstring(&apdu[len], 0,
&data->notificationParams. &data->
changeOfValue.newValue.changedBits))) { notificationParams.changeOfValue.
newValue.changedBits))) {
return -1; return -1;
} }
@@ -654,8 +657,9 @@ int event_notify_decode_service_request(
CHANGE_OF_VALUE_REAL)) { CHANGE_OF_VALUE_REAL)) {
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 1, decode_context_real(&apdu[len], 1,
&data->notificationParams. &data->
changeOfValue.newValue.changeValue))) { notificationParams.changeOfValue.
newValue.changeValue))) {
return -1; return -1;
} }
@@ -673,8 +677,8 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.changeOfValue. &data->notificationParams.
statusFlags))) { changeOfValue.statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -683,31 +687,31 @@ int event_notify_decode_service_request(
case EVENT_FLOATING_LIMIT: case EVENT_FLOATING_LIMIT:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 0, decode_context_real(&apdu[len], 0,
&data->notificationParams.floatingLimit. &data->notificationParams.
referenceValue))) { floatingLimit.referenceValue))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.floatingLimit. &data->notificationParams.
statusFlags))) { floatingLimit.statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 2, decode_context_real(&apdu[len], 2,
&data->notificationParams.floatingLimit. &data->notificationParams.
setPointValue))) { floatingLimit.setPointValue))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 3, decode_context_real(&apdu[len], 3,
&data->notificationParams.floatingLimit. &data->notificationParams.
errorLimit))) { floatingLimit.errorLimit))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -716,31 +720,31 @@ int event_notify_decode_service_request(
case EVENT_OUT_OF_RANGE: case EVENT_OUT_OF_RANGE:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 0, decode_context_real(&apdu[len], 0,
&data->notificationParams.outOfRange. &data->notificationParams.
exceedingValue))) { outOfRange.exceedingValue))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.outOfRange. &data->notificationParams.
statusFlags))) { outOfRange.statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 2, decode_context_real(&apdu[len], 2,
&data->notificationParams.outOfRange. &data->notificationParams.
deadband))) { outOfRange.deadband))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_real(&apdu[len], 3, decode_context_real(&apdu[len], 3,
&data->notificationParams.outOfRange. &data->notificationParams.
exceededLimit))) { outOfRange.exceededLimit))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -768,8 +772,9 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 2, decode_context_bitstring(&apdu[len], 2,
&data->notificationParams. &data->
changeOfLifeSafety.statusFlags))) { notificationParams.changeOfLifeSafety.
statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -779,8 +784,8 @@ int event_notify_decode_service_request(
&value))) { &value))) {
return -1; return -1;
} }
data->notificationParams.changeOfLifeSafety. data->notificationParams.
operationExpected = changeOfLifeSafety.operationExpected =
(BACNET_LIFE_SAFETY_OPERATION) value; (BACNET_LIFE_SAFETY_OPERATION) value;
len += section_length; len += section_length;
break; break;
@@ -789,24 +794,24 @@ int event_notify_decode_service_request(
if (-1 == (section_length = if (-1 == (section_length =
bacapp_decode_context_device_obj_property_ref bacapp_decode_context_device_obj_property_ref
(&apdu[len], 0, (&apdu[len], 0,
&data->notificationParams.bufferReady. &data->notificationParams.
bufferProperty))) { bufferReady.bufferProperty))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 1, decode_context_unsigned(&apdu[len], 1,
&data->notificationParams.bufferReady. &data->notificationParams.
previousNotification))) { bufferReady.previousNotification))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 2, decode_context_unsigned(&apdu[len], 2,
&data->notificationParams.bufferReady. &data->notificationParams.
currentNotification))) { bufferReady.currentNotification))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -815,24 +820,24 @@ int event_notify_decode_service_request(
case EVENT_UNSIGNED_RANGE: case EVENT_UNSIGNED_RANGE:
if (-1 == (section_length = if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 0, decode_context_unsigned(&apdu[len], 0,
&data->notificationParams.unsignedRange. &data->notificationParams.
exceedingValue))) { unsignedRange.exceedingValue))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_bitstring(&apdu[len], 1, decode_context_bitstring(&apdu[len], 1,
&data->notificationParams.unsignedRange. &data->notificationParams.
statusFlags))) { unsignedRange.statusFlags))) {
return -1; return -1;
} }
len += section_length; len += section_length;
if (-1 == (section_length = if (-1 == (section_length =
decode_context_unsigned(&apdu[len], 2, decode_context_unsigned(&apdu[len], 2,
&data->notificationParams.unsignedRange. &data->notificationParams.
exceededLimit))) { unsignedRange.exceededLimit))) {
return -1; return -1;
} }
len += section_length; len += section_length;
@@ -1091,16 +1096,16 @@ void testEventEventState(
data.eventType = EVENT_CHANGE_OF_BITSTRING; data.eventType = EVENT_CHANGE_OF_BITSTRING;
bitstring_init(&data.notificationParams.changeOfBitstring. bitstring_init(&data.notificationParams.
referencedBitString); changeOfBitstring.referencedBitString);
bitstring_set_bit(&data.notificationParams.changeOfBitstring. bitstring_set_bit(&data.notificationParams.
referencedBitString, 0, true); changeOfBitstring.referencedBitString, 0, true);
bitstring_set_bit(&data.notificationParams.changeOfBitstring. bitstring_set_bit(&data.notificationParams.
referencedBitString, 1, false); changeOfBitstring.referencedBitString, 1, false);
bitstring_set_bit(&data.notificationParams.changeOfBitstring. bitstring_set_bit(&data.notificationParams.
referencedBitString, 2, true); changeOfBitstring.referencedBitString, 2, true);
bitstring_set_bit(&data.notificationParams.changeOfBitstring. bitstring_set_bit(&data.notificationParams.
referencedBitString, 2, false); changeOfBitstring.referencedBitString, 2, false);
bitstring_init(&data.notificationParams.changeOfBitstring.statusFlags); bitstring_init(&data.notificationParams.changeOfBitstring.statusFlags);
@@ -1186,16 +1191,16 @@ void testEventEventState(
data.notificationParams.changeOfValue.tag = CHANGE_OF_VALUE_BITS; data.notificationParams.changeOfValue.tag = CHANGE_OF_VALUE_BITS;
bitstring_init(&data.notificationParams.changeOfValue.newValue. bitstring_init(&data.notificationParams.changeOfValue.
changedBits); newValue.changedBits);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue. bitstring_set_bit(&data.notificationParams.changeOfValue.
changedBits, 0, true); newValue.changedBits, 0, true);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue. bitstring_set_bit(&data.notificationParams.changeOfValue.
changedBits, 1, false); newValue.changedBits, 1, false);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue. bitstring_set_bit(&data.notificationParams.changeOfValue.
changedBits, 2, false); newValue.changedBits, 2, false);
bitstring_set_bit(&data.notificationParams.changeOfValue.newValue. bitstring_set_bit(&data.notificationParams.changeOfValue.
changedBits, 3, false); newValue.changedBits, 3, false);
memset(buffer, 0, MAX_APDU); memset(buffer, 0, MAX_APDU);
inLen = event_notify_encode_service_request(&buffer[0], &data); inLen = event_notify_encode_service_request(&buffer[0], &data);
@@ -1435,12 +1440,12 @@ void testEventEventState(
data.notificationParams.bufferReady.currentNotification = 2345; data.notificationParams.bufferReady.currentNotification = 2345;
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.type = data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.type =
OBJECT_DEVICE; OBJECT_DEVICE;
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier. data.notificationParams.bufferReady.bufferProperty.
instance = 500; deviceIndentifier.instance = 500;
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.type = data.notificationParams.bufferReady.bufferProperty.objectIdentifier.type =
OBJECT_ANALOG_INPUT; OBJECT_ANALOG_INPUT;
data.notificationParams.bufferReady.bufferProperty.objectIdentifier. data.notificationParams.bufferReady.bufferProperty.
instance = 100; objectIdentifier.instance = 100;
data.notificationParams.bufferReady.bufferProperty.propertyIdentifier = data.notificationParams.bufferReady.bufferProperty.propertyIdentifier =
PROP_PRESENT_VALUE; PROP_PRESENT_VALUE;
data.notificationParams.bufferReady.bufferProperty.arrayIndex = 0; data.notificationParams.bufferReady.bufferProperty.arrayIndex = 0;
@@ -1465,34 +1470,34 @@ void testEventEventState(
ct_test(pTest, ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier. data.notificationParams.bufferReady.bufferProperty.
type == deviceIndentifier.type ==
data2.notificationParams.bufferReady.bufferProperty.deviceIndentifier. data2.notificationParams.bufferReady.bufferProperty.
type); deviceIndentifier.type);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
instance ==
data2.notificationParams.bufferReady.bufferProperty.deviceIndentifier.
instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.
instance ==
data2.notificationParams.bufferReady.bufferProperty.objectIdentifier.
instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.objectIdentifier.
type ==
data2.notificationParams.bufferReady.bufferProperty.objectIdentifier.
type);
ct_test(pTest, ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty. data.notificationParams.bufferReady.bufferProperty.
propertyIdentifier == deviceIndentifier.instance ==
data2.notificationParams.bufferReady.bufferProperty. data2.notificationParams.bufferReady.bufferProperty.
propertyIdentifier); deviceIndentifier.instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.
objectIdentifier.instance ==
data2.notificationParams.bufferReady.bufferProperty.
objectIdentifier.instance);
ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.
objectIdentifier.type ==
data2.notificationParams.bufferReady.bufferProperty.
objectIdentifier.type);
ct_test(pTest,
data.notificationParams.bufferReady.
bufferProperty.propertyIdentifier ==
data2.notificationParams.bufferReady.
bufferProperty.propertyIdentifier);
ct_test(pTest, ct_test(pTest,
data.notificationParams.bufferReady.bufferProperty.arrayIndex == data.notificationParams.bufferReady.bufferProperty.arrayIndex ==
+6 -4
View File
@@ -449,8 +449,8 @@ void MSTP_Receive_Frame_FSM(
/* NoData */ /* NoData */
else if (mstp_port->DataLength == 0) { else if (mstp_port->DataLength == 0) {
printf_receive_data("%s", printf_receive_data("%s",
mstptext_frame_type((unsigned) mstp_port-> mstptext_frame_type((unsigned)
FrameType)); mstp_port->FrameType));
if ((mstp_port->DestinationAddress == if ((mstp_port->DestinationAddress ==
mstp_port->This_Station) mstp_port->This_Station)
|| (mstp_port->DestinationAddress == || (mstp_port->DestinationAddress ==
@@ -714,7 +714,8 @@ bool MSTP_Master_Node_FSM(
uint8_t frame_type = mstp_port->OutputBuffer[2]; uint8_t frame_type = mstp_port->OutputBuffer[2];
uint8_t destination = mstp_port->OutputBuffer[3]; uint8_t destination = mstp_port->OutputBuffer[3];
RS485_Send_Frame(mstp_port, RS485_Send_Frame(mstp_port,
(uint8_t *) & mstp_port->OutputBuffer[0], (uint16_t)length); (uint8_t *) & mstp_port->OutputBuffer[0],
(uint16_t) length);
mstp_port->FrameCount++; mstp_port->FrameCount++;
switch (frame_type) { switch (frame_type) {
case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY: case FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY:
@@ -1049,7 +1050,8 @@ bool MSTP_Master_Node_FSM(
/* then call MSTP_Create_And_Send_Frame to transmit the reply frame */ /* then call MSTP_Create_And_Send_Frame to transmit the reply frame */
/* and enter the IDLE state to wait for the next frame. */ /* and enter the IDLE state to wait for the next frame. */
RS485_Send_Frame(mstp_port, RS485_Send_Frame(mstp_port,
(uint8_t *) & mstp_port->OutputBuffer[0], (uint16_t)length); (uint8_t *) & mstp_port->OutputBuffer[0],
(uint16_t) length);
mstp_port->master_state = MSTP_MASTER_STATE_IDLE; mstp_port->master_state = MSTP_MASTER_STATE_IDLE;
} else { } else {
/* DeferredReply */ /* DeferredReply */
+5 -7
View File
@@ -293,7 +293,8 @@ int rpm_decode_object_property(
len += option_len; len += option_len;
/* Should be at least the unsigned array index + 1 tag left */ /* Should be at least the unsigned array index + 1 tag left */
if ((len + len_value_type) >= apdu_len) { if ((len + len_value_type) >= apdu_len) {
rpmdata->error_code = ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER; rpmdata->error_code =
ERROR_CODE_REJECT_MISSING_REQUIRED_PARAMETER;
return BACNET_STATUS_REJECT; return BACNET_STATUS_REJECT;
} }
len += len +=
@@ -620,8 +621,7 @@ void testReadPropertyMultiple(
ct_test(pTest, service_request_len > 0); ct_test(pTest, service_request_len > 0);
test_len = test_len =
rpm_decode_object_id(service_request, service_request_len, rpm_decode_object_id(service_request, service_request_len, &rpmdata);
&rpmdata);
ct_test(pTest, test_len > 0); ct_test(pTest, test_len > 0);
ct_test(pTest, rpmdata.object_type == OBJECT_DEVICE); ct_test(pTest, rpmdata.object_type == OBJECT_DEVICE);
ct_test(pTest, rpmdata.object_instance == 123); ct_test(pTest, rpmdata.object_instance == 123);
@@ -725,8 +725,7 @@ void testReadPropertyMultipleAck(
/* object beginning */ /* object beginning */
rpmdata.object_type = OBJECT_DEVICE; rpmdata.object_type = OBJECT_DEVICE;
rpmdata.object_instance = 123; rpmdata.object_instance = 123;
apdu_len += apdu_len += rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
/* reply property */ /* reply property */
apdu_len += apdu_len +=
rpm_ack_encode_apdu_object_property(&apdu[apdu_len], rpm_ack_encode_apdu_object_property(&apdu[apdu_len],
@@ -760,8 +759,7 @@ void testReadPropertyMultipleAck(
/* object beginning */ /* object beginning */
rpmdata.object_type = OBJECT_ANALOG_INPUT; rpmdata.object_type = OBJECT_ANALOG_INPUT;
rpmdata.object_instance = 33; rpmdata.object_instance = 33;
apdu_len += apdu_len += rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
rpm_ack_encode_apdu_object_begin(&apdu[apdu_len], &rpmdata);
/* reply property */ /* reply property */
apdu_len += apdu_len +=
rpm_ack_encode_apdu_object_property(&apdu[apdu_len], rpm_ack_encode_apdu_object_property(&apdu[apdu_len],