indented per coding standard using indent.sh
This commit is contained in:
@@ -121,7 +121,7 @@ int Analog_Input_Encode_Property_APDU(uint8_t * apdu,
|
||||
case PROP_UNITS:
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], UNITS_PERCENT);
|
||||
break;
|
||||
/* test case for signed encoding and decoding negative value correctly */
|
||||
/* test case for signed encoding and decoding negative value correctly */
|
||||
case 9999:
|
||||
apdu_len = encode_tagged_signed(&apdu[0], -200);
|
||||
break;
|
||||
|
||||
@@ -104,7 +104,8 @@ unsigned Binary_Output_Instance_To_Index(uint32_t object_instance)
|
||||
return index;
|
||||
}
|
||||
|
||||
static BACNET_BINARY_PV Binary_Output_Present_Value(uint32_t object_instance)
|
||||
static BACNET_BINARY_PV Binary_Output_Present_Value(uint32_t
|
||||
object_instance)
|
||||
{
|
||||
BACNET_BINARY_PV value = RELINQUISH_DEFAULT;
|
||||
unsigned index = 0;
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "bi.h" /* object list dependency */
|
||||
#include "bo.h" /* object list dependency */
|
||||
#include "ao.h" /* object list dependency */
|
||||
#include "lsp.h" /* object list dependency */
|
||||
#include "lsp.h" /* object list dependency */
|
||||
#include "wp.h" /* write property handling */
|
||||
#include "device.h" /* me */
|
||||
#if BACFILE
|
||||
@@ -67,11 +67,11 @@ static char Description[16] = "server";
|
||||
/* static uint8_t Max_Segments_Accepted = 0; */
|
||||
/* VT_Classes_Supported */
|
||||
/* Active_VT_Sessions */
|
||||
BACNET_TIME Local_Time; /* rely on OS, if there is one */
|
||||
BACNET_DATE Local_Date; /* rely on OS, if there is one */
|
||||
BACNET_TIME Local_Time; /* rely on OS, if there is one */
|
||||
BACNET_DATE Local_Date; /* rely on OS, if there is one */
|
||||
/* BACnet UTC is inverse of standard offset - i.e. relative to local */
|
||||
static int UTC_Offset = 5;
|
||||
static bool Daylight_Savings_Status = false; /* rely on OS */
|
||||
static int UTC_Offset = 5;
|
||||
static bool Daylight_Savings_Status = false; /* rely on OS */
|
||||
/* APDU_Segment_Timeout */
|
||||
static uint16_t APDU_Timeout = 3000;
|
||||
static uint8_t Number_Of_APDU_Retries = 3;
|
||||
@@ -405,7 +405,7 @@ bool Device_Object_List_Identifier(unsigned array_index,
|
||||
}
|
||||
/* file objects */
|
||||
#if BACFILE
|
||||
if (!status) {
|
||||
if (!status) {
|
||||
/* normalize the index since
|
||||
we know it is not the previous objects */
|
||||
object_index -= Life_Safety_Point_Count();
|
||||
@@ -541,32 +541,32 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
Application_Software_Version);
|
||||
apdu_len = encode_tagged_character_string(&apdu[0], &char_string);
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
/* FIXME: if you support time */
|
||||
case PROP_LOCAL_TIME:
|
||||
/* FIXME: get the actual value */
|
||||
Local_Time.hour = 7;
|
||||
Local_Time.min = 0;
|
||||
Local_Time.sec = 3;
|
||||
Local_Time.hundredths = 1;
|
||||
apdu_len =
|
||||
encode_tagged_time(&apdu[0], &Local_Time);
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
apdu_len = encode_tagged_time(&apdu[0], &Local_Time);
|
||||
break;
|
||||
/* FIXME: if you support time */
|
||||
case PROP_UTC_OFFSET:
|
||||
/* NOTE: if your UTC offset is -5, then BACnet UTC offset is 5 */
|
||||
apdu_len = encode_tagged_signed(&apdu[0], UTC_Offset);
|
||||
break;
|
||||
/* FIXME: if you support date */
|
||||
/* FIXME: if you support date */
|
||||
case PROP_LOCAL_DATE:
|
||||
/* FIXME: get the actual value instead of April Fool's Day */
|
||||
Local_Date.year = 2006; /* AD */
|
||||
Local_Date.month = 4; /* 1=Jan */
|
||||
Local_Date.day = 1; /* 1..31 */
|
||||
Local_Date.wday = 6; /* 1=Monday */
|
||||
apdu_len = encode_tagged_date(&apdu[0],&Local_Date);
|
||||
Local_Date.year = 2006; /* AD */
|
||||
Local_Date.month = 4; /* 1=Jan */
|
||||
Local_Date.day = 1; /* 1..31 */
|
||||
Local_Date.wday = 6; /* 1=Monday */
|
||||
apdu_len = encode_tagged_date(&apdu[0], &Local_Date);
|
||||
break;
|
||||
case PROP_DAYLIGHT_SAVINGS_STATUS:
|
||||
apdu_len = encode_tagged_boolean(&apdu[0], Daylight_Savings_Status);
|
||||
apdu_len =
|
||||
encode_tagged_boolean(&apdu[0], Daylight_Savings_Status);
|
||||
break;
|
||||
case PROP_PROTOCOL_VERSION:
|
||||
apdu_len =
|
||||
@@ -601,18 +601,18 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
/* FIXME: indicate the objects that YOU support */
|
||||
bitstring_set_bit(&bit_string, OBJECT_DEVICE, true);
|
||||
if (Analog_Input_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_ANALOG_INPUT, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_ANALOG_INPUT, true);
|
||||
if (Analog_Output_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_ANALOG_OUTPUT, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_ANALOG_OUTPUT, true);
|
||||
if (Binary_Input_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_BINARY_INPUT, true);
|
||||
if (Binary_Output_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_BINARY_OUTPUT, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_BINARY_OUTPUT, true);
|
||||
if (Life_Safety_Point_Count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_LIFE_SAFETY_POINT, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_LIFE_SAFETY_POINT, true);
|
||||
#if BACFILE
|
||||
if (bacfile_count())
|
||||
bitstring_set_bit(&bit_string, OBJECT_FILE, true);
|
||||
bitstring_set_bit(&bit_string, OBJECT_FILE, true);
|
||||
#endif
|
||||
apdu_len = encode_tagged_bitstring(&apdu[0], &bit_string);
|
||||
break;
|
||||
@@ -681,8 +681,7 @@ int Device_Encode_Property_APDU(uint8_t * apdu,
|
||||
/* FIXME: encode the list here, if it exists */
|
||||
break;
|
||||
case PROP_DATABASE_REVISION:
|
||||
apdu_len =
|
||||
encode_tagged_unsigned(&apdu[0], Database_Revision);
|
||||
apdu_len = encode_tagged_unsigned(&apdu[0], Database_Revision);
|
||||
break;
|
||||
default:
|
||||
*error_class = ERROR_CLASS_PROPERTY;
|
||||
|
||||
@@ -61,7 +61,8 @@ void Life_Safety_Point_Init(void)
|
||||
for (i = 0; i < MAX_LIFE_SAFETY_POINTS; i++) {
|
||||
Life_Safety_Point_Mode[i] = LIFE_SAFETY_MODE_DEFAULT;
|
||||
Life_Safety_Point_State[i] = LIFE_SAFETY_STATE_QUIET;
|
||||
Life_Safety_Point_Silenced_State[i] = SILENCED_STATE_UNSILENCED;
|
||||
Life_Safety_Point_Silenced_State[i] =
|
||||
SILENCED_STATE_UNSILENCED;
|
||||
Life_Safety_Point_Operation[i] = LIFE_SAFETY_OPERATION_NONE;
|
||||
}
|
||||
}
|
||||
@@ -112,7 +113,8 @@ unsigned Life_Safety_Point_Instance_To_Index(uint32_t object_instance)
|
||||
return index;
|
||||
}
|
||||
|
||||
static BACNET_LIFE_SAFETY_STATE Life_Safety_Point_Present_Value(uint32_t object_instance)
|
||||
static BACNET_LIFE_SAFETY_STATE Life_Safety_Point_Present_Value(uint32_t
|
||||
object_instance)
|
||||
{
|
||||
BACNET_LIFE_SAFETY_STATE present_value = LIFE_SAFETY_STATE_QUIET;
|
||||
unsigned index = 0;
|
||||
@@ -156,12 +158,12 @@ int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
|
||||
unsigned object_index = 0;
|
||||
bool state = false;
|
||||
BACNET_RELIABILITY reliability = RELIABILITY_NO_FAULT_DETECTED;
|
||||
|
||||
(void)array_index; /* currently not used */
|
||||
|
||||
(void) array_index; /* currently not used */
|
||||
Life_Safety_Point_Init();
|
||||
switch (property) {
|
||||
apdu_len = encode_tagged_object_id(&apdu[0], OBJECT_LIFE_SAFETY_POINT,
|
||||
case PROP_OBJECT_IDENTIFIER:
|
||||
apdu_len =
|
||||
encode_tagged_object_id(&apdu[0], OBJECT_LIFE_SAFETY_POINT,
|
||||
object_instance);
|
||||
break;
|
||||
@@ -190,7 +192,8 @@ int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
|
||||
case PROP_EVENT_STATE:
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], EVENT_STATE_NORMAL);
|
||||
break;
|
||||
object_index = Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
case PROP_OUT_OF_SERVICE:
|
||||
object_index =
|
||||
Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
state = Life_Safety_Point_Out_Of_Service[object_index];
|
||||
apdu_len = encode_tagged_boolean(&apdu[0], state);
|
||||
@@ -200,24 +203,27 @@ int Life_Safety_Point_Encode_Property_APDU(uint8_t * apdu,
|
||||
reliability = RELIABILITY_NO_FAULT_DETECTED;
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], reliability);
|
||||
break;
|
||||
object_index = Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
case PROP_MODE:
|
||||
object_index =
|
||||
Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
mode = Life_Safety_Point_Mode[object_index];
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], mode);
|
||||
break;
|
||||
for (mode = MIN_LIFE_SAFETY_MODE; mode < MAX_LIFE_SAFETY_MODE; mode++)
|
||||
{
|
||||
len = encode_tagged_enumerated(&apdu[apdu_len], mode);
|
||||
apdu_len += len;
|
||||
case PROP_ACCEPTED_MODES:
|
||||
for (mode = MIN_LIFE_SAFETY_MODE; mode < MAX_LIFE_SAFETY_MODE;
|
||||
mode++) {
|
||||
len = encode_tagged_enumerated(&apdu[apdu_len], mode);
|
||||
apdu_len += len;
|
||||
}
|
||||
break;
|
||||
object_index = Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
case PROP_SILENCED:
|
||||
object_index =
|
||||
Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
silenced_state = Life_Safety_Point_Silenced_State[object_index];
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], silenced_state);
|
||||
break;
|
||||
object_index = Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
case PROP_OPERATION_EXPECTED:
|
||||
object_index =
|
||||
Life_Safety_Point_Instance_To_Index(object_instance);
|
||||
operation = Life_Safety_Point_Operation[object_index];
|
||||
apdu_len = encode_tagged_enumerated(&apdu[0], operation);
|
||||
@@ -248,10 +254,13 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
/* decode the some of the request */
|
||||
switch (wp_data->object_property) {
|
||||
case PROP_MODE:
|
||||
if ((wp_data->value.type.Enumerated >= MIN_LIFE_SAFETY_MODE) &&
|
||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_ENUMERATED) {
|
||||
if ((wp_data->value.type.Enumerated >= MIN_LIFE_SAFETY_MODE) &&
|
||||
object_index = Life_Safety_Point_Instance_To_Index(wp_data->object_instance);
|
||||
Life_Safety_Point_Mode[object_index] = wp_data->value.type.Enumerated;
|
||||
(wp_data->value.type.Enumerated <= MIN_LIFE_SAFETY_MODE)) {
|
||||
object_index =
|
||||
Life_Safety_Point_Instance_To_Index(wp_data->
|
||||
object_instance);
|
||||
Life_Safety_Point_Mode[object_index] =
|
||||
wp_data->value.type.Enumerated;
|
||||
status = true;
|
||||
} else {
|
||||
@@ -265,7 +274,8 @@ bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
break;
|
||||
case PROP_OUT_OF_SERVICE:
|
||||
if (wp_data->value.tag == BACNET_APPLICATION_TAG_BOOLEAN) {
|
||||
Life_Safety_Point_Instance_To_Index(wp_data->object_instance);
|
||||
object_index =
|
||||
Life_Safety_Point_Instance_To_Index(wp_data->
|
||||
object_instance);
|
||||
Life_Safety_Point_Out_Of_Service[object_index] =
|
||||
wp_data->value.type.Boolean;
|
||||
|
||||
@@ -46,8 +46,9 @@ extern "C" {
|
||||
int32_t array_index,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
|
||||
bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA * wp_data,
|
||||
BACNET_ERROR_CLASS * error_class, BACNET_ERROR_CODE * error_code);
|
||||
bool Life_Safety_Point_Write_Property(BACNET_WRITE_PROPERTY_DATA *
|
||||
wp_data, BACNET_ERROR_CLASS * error_class,
|
||||
BACNET_ERROR_CODE * error_code);
|
||||
|
||||
#ifdef TEST
|
||||
#include "ctest.h"
|
||||
|
||||
Reference in New Issue
Block a user