Fixed EOL and performed standard indentation.
This commit is contained in:
@@ -406,8 +406,7 @@ void PrintReadPropertyData(
|
|||||||
if ((value != NULL) && (value->next != NULL)) {
|
if ((value != NULL) && (value->next != NULL)) {
|
||||||
/* Then this is an array of values.
|
/* Then this is an array of values.
|
||||||
* But are we showing Values? We (VTS3) want ? instead of {?,?} to show up. */
|
* But are we showing Values? We (VTS3) want ? instead of {?,?} to show up. */
|
||||||
switch( rpm_property->propertyIdentifier )
|
switch (rpm_property->propertyIdentifier) {
|
||||||
{
|
|
||||||
/* Screen the Properties that can be arrays or Sequences */
|
/* Screen the Properties that can be arrays or Sequences */
|
||||||
case PROP_PRESENT_VALUE:
|
case PROP_PRESENT_VALUE:
|
||||||
case PROP_PRIORITY_ARRAY:
|
case PROP_PRIORITY_ARRAY:
|
||||||
@@ -417,7 +416,8 @@ void PrintReadPropertyData(
|
|||||||
* print anything for them. To achieve this, swap
|
* print anything for them. To achieve this, swap
|
||||||
* out the Property for a non-existent Property
|
* out the Property for a non-existent Property
|
||||||
* and catch that below. */
|
* and catch that below. */
|
||||||
rpm_property->propertyIdentifier = PROP_PROTOCOL_CONFORMANCE_CLASS;
|
rpm_property->propertyIdentifier =
|
||||||
|
PROP_PROTOCOL_CONFORMANCE_CLASS;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
/* Else, fall through to normal processing. */
|
/* Else, fall through to normal processing. */
|
||||||
@@ -730,10 +730,8 @@ EPICS_STATES ProcessRPMData(
|
|||||||
fprintf(stdout, " ");
|
fprintf(stdout, " ");
|
||||||
Print_Property_Identifier(rpm_property->propertyIdentifier);
|
Print_Property_Identifier(rpm_property->propertyIdentifier);
|
||||||
fprintf(stdout, ": ");
|
fprintf(stdout, ": ");
|
||||||
PrintReadPropertyData(
|
PrintReadPropertyData(rpm_data->object_type,
|
||||||
rpm_data->object_type,
|
rpm_data->object_instance, rpm_property);
|
||||||
rpm_data->object_instance,
|
|
||||||
rpm_property);
|
|
||||||
}
|
}
|
||||||
old_rpm_property = rpm_property;
|
old_rpm_property = rpm_property;
|
||||||
rpm_property = rpm_property->next;
|
rpm_property = rpm_property->next;
|
||||||
@@ -1108,10 +1106,11 @@ 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(
|
PrintReadPropertyData(Read_Property_Multiple_Data.
|
||||||
Read_Property_Multiple_Data.rpm_data->object_type,
|
rpm_data->object_type,
|
||||||
Read_Property_Multiple_Data.rpm_data->object_instance,
|
Read_Property_Multiple_Data.rpm_data->object_instance,
|
||||||
Read_Property_Multiple_Data.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 {
|
||||||
|
|||||||
@@ -346,8 +346,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;
|
||||||
@@ -464,8 +465,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 {
|
||||||
@@ -546,8 +547,9 @@ void handler_cov_subscribe(
|
|||||||
}
|
}
|
||||||
cov_data.error_class = ERROR_CLASS_OBJECT;
|
cov_data.error_class = ERROR_CLASS_OBJECT;
|
||||||
cov_data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
cov_data.error_code = ERROR_CODE_UNKNOWN_OBJECT;
|
||||||
success = cov_subscribe(src, &cov_data,
|
success =
|
||||||
&cov_data.error_class, &cov_data.error_code);
|
cov_subscribe(src, &cov_data, &cov_data.error_class,
|
||||||
|
&cov_data.error_code);
|
||||||
if (success) {
|
if (success) {
|
||||||
apdu_len =
|
apdu_len =
|
||||||
encode_simple_ack(&Handler_Transmit_Buffer[npdu_len],
|
encode_simple_ack(&Handler_Transmit_Buffer[npdu_len],
|
||||||
|
|||||||
@@ -386,8 +386,7 @@ void handler_read_property_multiple(
|
|||||||
|
|
||||||
if (apdu_len > service_data->max_resp) {
|
if (apdu_len > service_data->max_resp) {
|
||||||
/* too big for the sender - send an abort */
|
/* too big for the sender - send an abort */
|
||||||
rpmdata.error_code =
|
rpmdata.error_code = ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
||||||
ERROR_CODE_ABORT_SEGMENTATION_NOT_SUPPORTED;
|
|
||||||
error = BACNET_STATUS_ABORT;
|
error = BACNET_STATUS_ABORT;
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
fprintf(stderr, "RPM: Message too large. Sending Abort!\n");
|
fprintf(stderr, "RPM: Message too large. Sending Abort!\n");
|
||||||
|
|||||||
@@ -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);
|
||||||
@@ -241,17 +241,14 @@ void rpm_ack_print_data(
|
|||||||
array_value = false;
|
array_value = false;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
object_value.object_type =
|
object_value.object_type = rpm_data->object_type;
|
||||||
rpm_data->object_type;
|
object_value.object_instance = rpm_data->object_instance;
|
||||||
object_value.object_instance =
|
|
||||||
rpm_data->object_instance;
|
|
||||||
while (value) {
|
while (value) {
|
||||||
object_value.object_property =
|
object_value.object_property =
|
||||||
listOfProperties->propertyIdentifier;
|
listOfProperties->propertyIdentifier;
|
||||||
object_value.array_index =
|
object_value.array_index =
|
||||||
listOfProperties->propertyArrayIndex;
|
listOfProperties->propertyArrayIndex;
|
||||||
object_value.value =
|
object_value.value = listOfProperties->value;
|
||||||
listOfProperties->value;
|
|
||||||
bacapp_print_value(stdout, &object_value);
|
bacapp_print_value(stdout, &object_value);
|
||||||
#if PRINT_ENABLED
|
#if PRINT_ENABLED
|
||||||
if (value->next) {
|
if (value->next) {
|
||||||
@@ -270,10 +267,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;
|
||||||
|
|||||||
@@ -104,8 +104,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);
|
||||||
|
|||||||
@@ -177,8 +177,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
|
||||||
|
|||||||
@@ -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) {
|
||||||
|
|||||||
@@ -634,8 +634,8 @@ int main(
|
|||||||
packet_count++;
|
packet_count++;
|
||||||
}
|
}
|
||||||
if (!(packet_count % 100)) {
|
if (!(packet_count % 100)) {
|
||||||
fprintf(stdout, "\r%hu packets, %hu invalid frames",
|
fprintf(stdout, "\r%hu packets, %hu invalid frames", packet_count,
|
||||||
packet_count, Invalid_Frame_Count);
|
Invalid_Frame_Count);
|
||||||
}
|
}
|
||||||
if (packet_count >= 65535) {
|
if (packet_count >= 65535) {
|
||||||
packet_statistics_save();
|
packet_statistics_save();
|
||||||
@@ -645,4 +645,3 @@ int main(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -441,11 +441,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;
|
||||||
|
|||||||
@@ -391,8 +391,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--;
|
||||||
|
|||||||
@@ -370,8 +370,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
|
||||||
@@ -397,8 +397,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--;
|
||||||
|
|||||||
@@ -353,8 +353,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
|
||||||
@@ -380,8 +380,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--;
|
||||||
|
|||||||
@@ -1241,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;
|
||||||
@@ -1275,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:
|
||||||
@@ -1303,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;
|
||||||
@@ -1313,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;
|
||||||
@@ -1324,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;
|
||||||
@@ -1334,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;
|
||||||
@@ -1347,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;
|
||||||
|
|||||||
@@ -469,8 +469,8 @@ 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 = Lighting_Output_Level[object_index]
|
real_value = Lighting_Output_Level[object_index]
|
||||||
@@ -549,11 +549,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
|
||||||
@@ -580,8 +580,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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,8 +292,8 @@ 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]
|
if (Multistate_Output_Level[object_index]
|
||||||
[rpdata->array_index - 1] == MULTISTATE_NULL)
|
[rpdata->array_index - 1] == MULTISTATE_NULL)
|
||||||
@@ -369,8 +369,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;
|
||||||
@@ -397,8 +397,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--;
|
||||||
@@ -424,8 +424,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;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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) ||
|
||||||
|
|||||||
@@ -139,9 +139,7 @@ extern "C" {
|
|||||||
* chosen at runtime from among these choices.
|
* chosen at runtime from among these choices.
|
||||||
* - Clause 10 POINT-TO-POINT (PTP) and Clause 11 EIA/CEA-709.1 ("LonTalk") LAN
|
* - Clause 10 POINT-TO-POINT (PTP) and Clause 11 EIA/CEA-709.1 ("LonTalk") LAN
|
||||||
* are not currently supported by this project.
|
* are not currently supported by this project.
|
||||||
*/
|
*//** @defgroup DLTemplates DataLink Template Functions
|
||||||
|
|
||||||
/** @defgroup DLTemplates DataLink Template Functions
|
|
||||||
* @ingroup DataLink
|
* @ingroup DataLink
|
||||||
* Most of the functions in this group are function templates which are assigned
|
* Most of the functions in this group are function templates which are assigned
|
||||||
* to a specific DataLink network layer implementation either at compile time or
|
* to a specific DataLink network layer implementation either at compile time or
|
||||||
|
|||||||
@@ -101,9 +101,7 @@ extern "C" {
|
|||||||
* These device management BIBBs prescribe the BACnet capabilities required
|
* These device management BIBBs prescribe the BACnet capabilities required
|
||||||
* to interoperably perform the device management functions enumerated in
|
* to interoperably perform the device management functions enumerated in
|
||||||
* 22.2.1.5 for the BACnet devices defined therein.
|
* 22.2.1.5 for the BACnet devices defined therein.
|
||||||
*/
|
*//** @defgroup DMDCC Device Management-Device Communication Control (DM-DCC)
|
||||||
|
|
||||||
/** @defgroup DMDCC Device Management-Device Communication Control (DM-DCC)
|
|
||||||
* @ingroup RDMS
|
* @ingroup RDMS
|
||||||
* 16.1 DeviceCommunicationControl Service <br>
|
* 16.1 DeviceCommunicationControl Service <br>
|
||||||
* The DeviceCommunicationControl service is used by a client BACnet-user to
|
* The DeviceCommunicationControl service is used by a client BACnet-user to
|
||||||
|
|||||||
@@ -237,15 +237,11 @@ extern "C" {
|
|||||||
* - The interface between the implemented Objects and the BAC-stack services,
|
* - The interface between the implemented Objects and the BAC-stack services,
|
||||||
* specifically the handlers, which are mediated through function calls to
|
* specifically the handlers, which are mediated through function calls to
|
||||||
* the Device object.
|
* the Device object.
|
||||||
*/
|
*//** @defgroup ObjHelpers Object Helper Functions
|
||||||
|
|
||||||
/** @defgroup ObjHelpers Object Helper Functions
|
|
||||||
* @ingroup ObjFrmwk
|
* @ingroup ObjFrmwk
|
||||||
* This section describes the function templates for the helper functions that
|
* This section describes the function templates for the helper functions that
|
||||||
* provide common object support.
|
* provide common object support.
|
||||||
*/
|
*//** @defgroup ObjIntf Handler-to-Object Interface Functions
|
||||||
|
|
||||||
/** @defgroup ObjIntf Handler-to-Object Interface Functions
|
|
||||||
* @ingroup ObjFrmwk
|
* @ingroup ObjFrmwk
|
||||||
* This section describes the fairly limited set of functions that link the
|
* This section describes the fairly limited set of functions that link the
|
||||||
* BAC-stack handlers to the BACnet Object instances. All of these calls are
|
* BAC-stack handlers to the BACnet Object instances. All of these calls are
|
||||||
|
|||||||
@@ -122,7 +122,8 @@ extern "C" {
|
|||||||
BACNET_ADDRESS * src,
|
BACNET_ADDRESS * src,
|
||||||
uint8_t mstp_address);
|
uint8_t mstp_address);
|
||||||
|
|
||||||
bool dlmstp_sole_master(void);
|
bool dlmstp_sole_master(
|
||||||
|
void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -213,9 +213,7 @@ extern "C" {
|
|||||||
* These BIBBs prescribe the BACnet capabilities required to interoperably
|
* These BIBBs prescribe the BACnet capabilities required to interoperably
|
||||||
* perform the alarm and event management functions enumerated in 22.2.1.2
|
* perform the alarm and event management functions enumerated in 22.2.1.2
|
||||||
* for the BACnet devices defined therein.
|
* for the BACnet devices defined therein.
|
||||||
*/
|
*//** @defgroup EVNOTFCN Alarm and Event-Notification (AE-N)
|
||||||
|
|
||||||
/** @defgroup EVNOTFCN Alarm and Event-Notification (AE-N)
|
|
||||||
* @ingroup ALMEVNT
|
* @ingroup ALMEVNT
|
||||||
* 13.6 ConfirmedCOVNotification Service <br>
|
* 13.6 ConfirmedCOVNotification Service <br>
|
||||||
* The ConfirmedCOVNotification service is used to notify subscribers about
|
* The ConfirmedCOVNotification service is used to notify subscribers about
|
||||||
@@ -232,9 +230,7 @@ extern "C" {
|
|||||||
* For unsubscribed notifications, the algorithm for determining when to issue
|
* For unsubscribed notifications, the algorithm for determining when to issue
|
||||||
* this service is a local matter and may be based on a change of value,
|
* this service is a local matter and may be based on a change of value,
|
||||||
* periodic updating, or some other criteria.
|
* periodic updating, or some other criteria.
|
||||||
*/
|
*//** @defgroup ALMACK Alarm and Event-ACK (AE-ACK)
|
||||||
|
|
||||||
/** @defgroup ALMACK Alarm and Event-ACK (AE-ACK)
|
|
||||||
* @ingroup ALMEVNT
|
* @ingroup ALMEVNT
|
||||||
* 13.5 AcknowledgeAlarm Service <br>
|
* 13.5 AcknowledgeAlarm Service <br>
|
||||||
* In some systems a device may need to know that an operator has seen the alarm
|
* In some systems a device may need to know that an operator has seen the alarm
|
||||||
|
|||||||
@@ -135,9 +135,7 @@ extern "C" {
|
|||||||
* These BIBBs prescribe the BACnet capabilities required to interoperably
|
* These BIBBs prescribe the BACnet capabilities required to interoperably
|
||||||
* perform the data sharing functions enumerated in 22.2.1.1 for the BACnet
|
* perform the data sharing functions enumerated in 22.2.1.1 for the BACnet
|
||||||
* devices defined therein.
|
* devices defined therein.
|
||||||
*/
|
*//** @defgroup DSRP Data Sharing -Read Property Service (DS-RP)
|
||||||
|
|
||||||
/** @defgroup DSRP Data Sharing -Read Property Service (DS-RP)
|
|
||||||
* @ingroup DataShare
|
* @ingroup DataShare
|
||||||
* 15.5 ReadProperty Service <br>
|
* 15.5 ReadProperty Service <br>
|
||||||
* The ReadProperty service is used by a client BACnet-user to request the
|
* The ReadProperty service is used by a client BACnet-user to request the
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -200,11 +200,8 @@ bool dlmstp_init(
|
|||||||
(void) ifname;
|
(void) ifname;
|
||||||
/* initialize hardware */
|
/* initialize hardware */
|
||||||
RS485_Initialize();
|
RS485_Initialize();
|
||||||
Ringbuf_Init(
|
Ringbuf_Init(&PDU_Queue, (uint8_t *) & PDU_Buffer,
|
||||||
&PDU_Queue,
|
sizeof(struct mstp_pdu_packet), MSTP_PDU_PACKET_COUNT);
|
||||||
(uint8_t *)&PDU_Buffer,
|
|
||||||
sizeof(struct mstp_pdu_packet),
|
|
||||||
MSTP_PDU_PACKET_COUNT);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -547,13 +544,15 @@ static void MSTP_Receive_Frame_FSM(
|
|||||||
} else {
|
} else {
|
||||||
/* receive the data portion of the frame. */
|
/* receive the data portion of the frame. */
|
||||||
if ((DestinationAddress == This_Station) ||
|
if ((DestinationAddress == This_Station) ||
|
||||||
(DestinationAddress == MSTP_BROADCAST_ADDRESS)) {
|
(DestinationAddress ==
|
||||||
|
MSTP_BROADCAST_ADDRESS)) {
|
||||||
if (DataLength <= InputBufferSize) {
|
if (DataLength <= InputBufferSize) {
|
||||||
/* Data */
|
/* Data */
|
||||||
Receive_State = MSTP_RECEIVE_STATE_DATA;
|
Receive_State = MSTP_RECEIVE_STATE_DATA;
|
||||||
} else {
|
} else {
|
||||||
/* FrameTooLong */
|
/* FrameTooLong */
|
||||||
Receive_State = MSTP_RECEIVE_STATE_SKIP_DATA;
|
Receive_State =
|
||||||
|
MSTP_RECEIVE_STATE_SKIP_DATA;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* NotForUs */
|
/* NotForUs */
|
||||||
@@ -767,8 +766,7 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
transition_now = true;
|
transition_now = true;
|
||||||
} else {
|
} else {
|
||||||
uint8_t frame_type;
|
uint8_t frame_type;
|
||||||
pkt = (struct mstp_pdu_packet *)Ringbuf_Pop_Front(
|
pkt = (struct mstp_pdu_packet *) Ringbuf_Pop_Front(&PDU_Queue);
|
||||||
&PDU_Queue);
|
|
||||||
if (pkt->data_expecting_reply) {
|
if (pkt->data_expecting_reply) {
|
||||||
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
||||||
} else {
|
} else {
|
||||||
@@ -1089,12 +1087,11 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* Note: we could wait for up to Treply_delay */
|
/* Note: we could wait for up to Treply_delay */
|
||||||
matched = false;
|
matched = false;
|
||||||
if (!Ringbuf_Empty(&PDU_Queue)) {
|
if (!Ringbuf_Empty(&PDU_Queue)) {
|
||||||
pkt = (struct mstp_pdu_packet *)Ringbuf_Get_Front(
|
pkt = (struct mstp_pdu_packet *) Ringbuf_Get_Front(&PDU_Queue);
|
||||||
&PDU_Queue);
|
|
||||||
matched =
|
matched =
|
||||||
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
||||||
DataLength, SourceAddress, &pkt->buffer[0],
|
DataLength, SourceAddress, &pkt->buffer[0], pkt->length,
|
||||||
pkt->length, pkt->destination_mac);
|
pkt->destination_mac);
|
||||||
}
|
}
|
||||||
if (matched) {
|
if (matched) {
|
||||||
/* Reply */
|
/* Reply */
|
||||||
@@ -1105,8 +1102,7 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* then call MSTP_Send_Frame to transmit the reply frame */
|
/* then call MSTP_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. */
|
||||||
uint8_t frame_type;
|
uint8_t frame_type;
|
||||||
pkt = (struct mstp_pdu_packet *)Ringbuf_Pop_Front(
|
pkt = (struct mstp_pdu_packet *) Ringbuf_Pop_Front(&PDU_Queue);
|
||||||
&PDU_Queue);
|
|
||||||
if (pkt->data_expecting_reply) {
|
if (pkt->data_expecting_reply) {
|
||||||
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -375,8 +375,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 {
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -446,8 +446,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
|
||||||
|
|||||||
@@ -808,8 +808,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 {
|
||||||
@@ -869,8 +869,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;
|
||||||
|
|||||||
@@ -204,11 +204,8 @@ bool dlmstp_init(
|
|||||||
if (Nmax_master > 127) {
|
if (Nmax_master > 127) {
|
||||||
Nmax_master = 127;
|
Nmax_master = 127;
|
||||||
}
|
}
|
||||||
Ringbuf_Init(
|
Ringbuf_Init(&PDU_Queue, (uint8_t *) & PDU_Buffer,
|
||||||
&PDU_Queue,
|
sizeof(struct mstp_pdu_packet), MSTP_PDU_PACKET_COUNT);
|
||||||
(uint8_t *)&PDU_Buffer,
|
|
||||||
sizeof(struct mstp_pdu_packet),
|
|
||||||
MSTP_PDU_PACKET_COUNT);
|
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -551,13 +548,15 @@ static void MSTP_Receive_Frame_FSM(
|
|||||||
} else {
|
} else {
|
||||||
/* receive the data portion of the frame. */
|
/* receive the data portion of the frame. */
|
||||||
if ((DestinationAddress == This_Station) ||
|
if ((DestinationAddress == This_Station) ||
|
||||||
(DestinationAddress == MSTP_BROADCAST_ADDRESS)) {
|
(DestinationAddress ==
|
||||||
|
MSTP_BROADCAST_ADDRESS)) {
|
||||||
if (DataLength <= InputBufferSize) {
|
if (DataLength <= InputBufferSize) {
|
||||||
/* Data */
|
/* Data */
|
||||||
Receive_State = MSTP_RECEIVE_STATE_DATA;
|
Receive_State = MSTP_RECEIVE_STATE_DATA;
|
||||||
} else {
|
} else {
|
||||||
/* FrameTooLong */
|
/* FrameTooLong */
|
||||||
Receive_State = MSTP_RECEIVE_STATE_SKIP_DATA;
|
Receive_State =
|
||||||
|
MSTP_RECEIVE_STATE_SKIP_DATA;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
/* NotForUs */
|
/* NotForUs */
|
||||||
@@ -789,8 +788,7 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
transition_now = true;
|
transition_now = true;
|
||||||
} else {
|
} else {
|
||||||
uint8_t frame_type;
|
uint8_t frame_type;
|
||||||
pkt = (struct mstp_pdu_packet *)Ringbuf_Pop_Front(
|
pkt = (struct mstp_pdu_packet *) Ringbuf_Pop_Front(&PDU_Queue);
|
||||||
&PDU_Queue);
|
|
||||||
if (pkt->data_expecting_reply) {
|
if (pkt->data_expecting_reply) {
|
||||||
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
||||||
} else {
|
} else {
|
||||||
@@ -1115,12 +1113,11 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* Note: we could wait for up to Treply_delay */
|
/* Note: we could wait for up to Treply_delay */
|
||||||
matched = false;
|
matched = false;
|
||||||
if (!Ringbuf_Empty(&PDU_Queue)) {
|
if (!Ringbuf_Empty(&PDU_Queue)) {
|
||||||
pkt = (struct mstp_pdu_packet *)Ringbuf_Get_Front(
|
pkt = (struct mstp_pdu_packet *) Ringbuf_Get_Front(&PDU_Queue);
|
||||||
&PDU_Queue);
|
|
||||||
matched =
|
matched =
|
||||||
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
dlmstp_compare_data_expecting_reply(&InputBuffer[0],
|
||||||
DataLength, SourceAddress, &pkt->buffer[0],
|
DataLength, SourceAddress, &pkt->buffer[0], pkt->length,
|
||||||
pkt->length, pkt->destination_mac);
|
pkt->destination_mac);
|
||||||
}
|
}
|
||||||
if (matched) {
|
if (matched) {
|
||||||
/* Reply */
|
/* Reply */
|
||||||
@@ -1131,8 +1128,7 @@ static bool MSTP_Master_Node_FSM(
|
|||||||
/* then call MSTP_Send_Frame to transmit the reply frame */
|
/* then call MSTP_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. */
|
||||||
uint8_t frame_type;
|
uint8_t frame_type;
|
||||||
pkt = (struct mstp_pdu_packet *)Ringbuf_Pop_Front(
|
pkt = (struct mstp_pdu_packet *) Ringbuf_Pop_Front(&PDU_Queue);
|
||||||
&PDU_Queue);
|
|
||||||
if (pkt->data_expecting_reply) {
|
if (pkt->data_expecting_reply) {
|
||||||
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
frame_type = FRAME_TYPE_BACNET_DATA_EXPECTING_REPLY;
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@@ -52,4 +52,7 @@
|
|||||||
#define SEEPROM_PAGE_SIZE 16
|
#define SEEPROM_PAGE_SIZE 16
|
||||||
#define SEEPROM_WORD_ADDRESS_16BIT 0
|
#define SEEPROM_WORD_ADDRESS_16BIT 0
|
||||||
|
|
||||||
|
#define SEEPROM_I2C_ADDRESS 0xA0
|
||||||
|
#define SEEPROM_I2C_CLOCK 400000L
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ void stack_init(
|
|||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned stack_size(
|
unsigned stack_size(
|
||||||
void)
|
void)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -26,7 +26,8 @@
|
|||||||
|
|
||||||
#if defined(__ICCAVR__)
|
#if defined(__ICCAVR__)
|
||||||
#include <intrinsics.h>
|
#include <intrinsics.h>
|
||||||
static inline void wdt_enable(int value)
|
static inline void wdt_enable(
|
||||||
|
int value)
|
||||||
{
|
{
|
||||||
__disable_interrupt();
|
__disable_interrupt();
|
||||||
__watchdog_reset();
|
__watchdog_reset();
|
||||||
@@ -38,7 +39,8 @@ static inline void wdt_enable(int value)
|
|||||||
__enable_interrupt(); */
|
__enable_interrupt(); */
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline void wdt_disable(void)
|
static inline void wdt_disable(
|
||||||
|
void)
|
||||||
{
|
{
|
||||||
__disable_interrupt();
|
__disable_interrupt();
|
||||||
__watchdog_reset();
|
__watchdog_reset();
|
||||||
@@ -52,7 +54,8 @@ static inline void wdt_disable(void)
|
|||||||
__enable_interrupt();
|
__enable_interrupt();
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline wdt_reset(void)
|
static inline wdt_reset(
|
||||||
|
void)
|
||||||
{
|
{
|
||||||
__watchdog_reset();
|
__watchdog_reset();
|
||||||
}
|
}
|
||||||
@@ -63,7 +66,8 @@ static inline wdt_reset(void)
|
|||||||
* Returns: none
|
* Returns: none
|
||||||
* Notes: none
|
* Notes: none
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
void watchdog_reset(void)
|
void watchdog_reset(
|
||||||
|
void)
|
||||||
{
|
{
|
||||||
wdt_reset();
|
wdt_reset();
|
||||||
}
|
}
|
||||||
@@ -73,7 +77,8 @@ void watchdog_reset(void)
|
|||||||
* Returns: none
|
* Returns: none
|
||||||
* Notes: none
|
* Notes: none
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
void watchdog_init(unsigned milliseconds)
|
void watchdog_init(
|
||||||
|
unsigned milliseconds)
|
||||||
{
|
{
|
||||||
unsigned value = WDTO_15MS;
|
unsigned value = WDTO_15MS;
|
||||||
if (milliseconds) {
|
if (milliseconds) {
|
||||||
|
|||||||
@@ -28,11 +28,12 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
void watchdog_reset(void);
|
void watchdog_reset(
|
||||||
void watchdog_init(unsigned milliseconds);
|
void);
|
||||||
|
void watchdog_init(
|
||||||
|
unsigned milliseconds);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -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
|
||||||
|
|||||||
@@ -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;
|
||||||
|
|||||||
@@ -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 {
|
||||||
|
|||||||
@@ -149,7 +149,8 @@ static 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 @@ static 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 */
|
||||||
|
|||||||
+12
-12
@@ -896,8 +896,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);
|
||||||
@@ -913,8 +913,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);
|
||||||
@@ -922,14 +922,14 @@ 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:
|
||||||
if (object_type < PROPRIETARY_BACNET_OBJECT_TYPE) {
|
if (object_type < PROPRIETARY_BACNET_OBJECT_TYPE) {
|
||||||
fprintf(stream, "%s",
|
fprintf(stream, "%s",
|
||||||
bactext_binary_present_value_name(
|
bactext_binary_present_value_name(value->type.
|
||||||
value->type.Enumerated));
|
Enumerated));
|
||||||
} else {
|
} else {
|
||||||
fprintf(stream, "%lu",
|
fprintf(stream, "%lu",
|
||||||
(unsigned long) value->type.Enumerated);
|
(unsigned long) value->type.Enumerated);
|
||||||
@@ -941,8 +941,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",
|
||||||
@@ -1313,8 +1313,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:
|
||||||
|
|||||||
@@ -678,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()))
|
||||||
|
|||||||
+139
-134
@@ -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 ==
|
||||||
|
|||||||
Reference in New Issue
Block a user