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