Performed standard indent script indent.sh on project files.

This commit is contained in:
skarg
2010-12-15 19:02:40 +00:00
parent f820697464
commit 2a0bf4926a
107 changed files with 974 additions and 1033 deletions
+1 -1
View File
@@ -182,7 +182,7 @@ int Analog_Input_Read_Property(
return 0;
}
apdu = rpdata->application_data;
switch ((int)rpdata->object_property) {
switch ((int) rpdata->object_property) {
case PROP_OBJECT_IDENTIFIER:
apdu_len =
encode_application_object_id(&apdu[0], OBJECT_ANALOG_INPUT,
+4 -4
View File
@@ -446,11 +446,11 @@ bool Analog_Output_Write_Property(
if (status) {
level = AO_LEVEL_NULL;
object_index =
Analog_Output_Instance_To_Index
(wp_data->object_instance);
Analog_Output_Instance_To_Index(wp_data->
object_instance);
status =
Analog_Output_Present_Value_Relinquish
(wp_data->object_instance, wp_data->priority);
Analog_Output_Present_Value_Relinquish(wp_data->
object_instance, wp_data->priority);
if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
+2 -2
View File
@@ -396,8 +396,8 @@ bool Analog_Value_Write_Property(
if (status) {
level = ANALOG_LEVEL_NULL;
object_index =
Analog_Value_Instance_To_Index
(wp_data->object_instance);
Analog_Value_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
+4 -4
View File
@@ -375,8 +375,8 @@ bool Binary_Output_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index =
Binary_Output_Instance_To_Index
(wp_data->object_instance);
Binary_Output_Instance_To_Index(wp_data->
object_instance);
priority--;
Binary_Output_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we
@@ -402,8 +402,8 @@ bool Binary_Output_Write_Property(
if (status) {
level = BINARY_NULL;
object_index =
Binary_Output_Instance_To_Index
(wp_data->object_instance);
Binary_Output_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
+4 -4
View File
@@ -358,8 +358,8 @@ bool Binary_Value_Write_Property(
(value.type.Enumerated <= MAX_BINARY_PV)) {
level = (BACNET_BINARY_PV) value.type.Enumerated;
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
priority--;
Binary_Value_Level[object_index][priority] = level;
/* Note: you could set the physical output here if we
@@ -385,8 +385,8 @@ bool Binary_Value_Write_Property(
if (status) {
level = BINARY_NULL;
object_index =
Binary_Value_Instance_To_Index
(wp_data->object_instance);
Binary_Value_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
+21 -20
View File
@@ -354,7 +354,7 @@ uint32_t Device_Object_Instance_Number(
void)
{
#ifdef BAC_ROUTING
return Routed_Device_Object_Instance_Number();
return Routed_Device_Object_Instance_Number();
#else
return Object_Instance_Number;
#endif
@@ -1141,8 +1141,8 @@ bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Device_Set_Object_Instance_Number(value.type.Object_Id.
instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */
} else {
status = false;
@@ -1175,8 +1175,8 @@ bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
/* FIXME: bounds check? */
Device_Set_Vendor_Identifier((uint16_t) value.
type.Unsigned_Int);
Device_Set_Vendor_Identifier((uint16_t) value.type.
Unsigned_Int);
}
break;
case PROP_SYSTEM_STATUS:
@@ -1203,8 +1203,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Object_Name(characterstring_value(&value.
type.Character_String),
Device_Set_Object_Name(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1213,8 +1213,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_LOC_LEN, true,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Location(characterstring_value(&value.
type.Character_String),
Device_Set_Location(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1224,8 +1224,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_DESC_LEN, true,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Description(characterstring_value(&value.
type.Character_String),
Device_Set_Description(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1234,8 +1234,8 @@ bool Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_MOD_LEN, true,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Device_Set_Model_Name(characterstring_value(&value.
type.Character_String),
Device_Set_Model_Name(characterstring_value(&value.type.
Character_String),
characterstring_length(&value.type.Character_String));
}
break;
@@ -1247,8 +1247,8 @@ bool Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
if (value.type.Unsigned_Int <= 255) {
dlmstp_set_max_info_frames((uint8_t) value.
type.Unsigned_Int);
dlmstp_set_max_info_frames((uint8_t) value.type.
Unsigned_Int);
} else {
status = false;
wp_data->error_class = ERROR_CLASS_PROPERTY;
@@ -1328,7 +1328,7 @@ bool Device_Write_Property(
* functions in order to properly support the default handlers.
*/
void Device_Initialize_Object_Functions(
object_functions_t *object_table)
object_functions_t * object_table)
{
Object_Table = object_table;
}
@@ -1407,25 +1407,26 @@ bool DeviceGetRRInfo(
instance number.
*/
void Routing_Device_Init(
uint32_t first_object_instance )
uint32_t first_object_instance)
{
struct object_functions *pDevObject = NULL;
/* First, do the usual Device_Init() functions: */
Device_Init();
/* Initialize with our preset strings */
Add_Routed_Device( first_object_instance, My_Object_Name, Description );
Add_Routed_Device(first_object_instance, My_Object_Name, Description);
/* Now substitute our routed versions of the main object functions. */
pDevObject = &Object_Table[0];
pDevObject->Object_Index_To_Instance = Routed_Device_Index_To_Instance;
pDevObject->Object_Valid_Instance = Routed_Device_Valid_Object_Instance_Number;
pDevObject->Object_Valid_Instance =
Routed_Device_Valid_Object_Instance_Number;
pDevObject->Object_Name = Routed_Device_Name;
pDevObject->Object_Read_Property = Routed_Device_Read_Property_Local;
pDevObject->Object_Write_Property = Routed_Device_Write_Property_Local;
}
#endif /* BAC_ROUTING */
#endif /* BAC_ROUTING */
#ifdef TEST
+130 -139
View File
@@ -114,32 +114,30 @@ uint16_t iCurrent_Device_Idx = 0;
* @return The index of this instance in the Devices[] array,
* or -1 if there isn't enough room to add this Device.
*/
uint16_t Add_Routed_Device(
uint32_t Object_Instance,
const char * sObject_Name,
const char * sDescription )
uint16_t Add_Routed_Device(
uint32_t Object_Instance,
const char *sObject_Name,
const char *sDescription)
{
int i = Num_Managed_Devices;
if ( i < MAX_NUM_DEVICES )
{
DEVICE_OBJECT_DATA *pDev = &Devices[i];
Num_Managed_Devices++;
iCurrent_Device_Idx = i;
pDev->bacObj.mObject_Type = OBJECT_DEVICE;
pDev->bacObj.Object_Instance_Number = Object_Instance;
if ( sObject_Name != NULL )
Routed_Device_Set_Object_Name( sObject_Name, strlen( sObject_Name ));
else
Routed_Device_Set_Object_Name( "No Name", strlen( "No Name" ));
if ( sDescription != NULL )
Routed_Device_Set_Description( sDescription, strlen( sDescription ));
else
Routed_Device_Set_Description( "No Descr", strlen( "No Descr" ));
pDev->Database_Revision = 0; /* Reset/Initialize now */
return i;
}
else
return -1;
int i = Num_Managed_Devices;
if (i < MAX_NUM_DEVICES) {
DEVICE_OBJECT_DATA *pDev = &Devices[i];
Num_Managed_Devices++;
iCurrent_Device_Idx = i;
pDev->bacObj.mObject_Type = OBJECT_DEVICE;
pDev->bacObj.Object_Instance_Number = Object_Instance;
if (sObject_Name != NULL)
Routed_Device_Set_Object_Name(sObject_Name, strlen(sObject_Name));
else
Routed_Device_Set_Object_Name("No Name", strlen("No Name"));
if (sDescription != NULL)
Routed_Device_Set_Description(sDescription, strlen(sDescription));
else
Routed_Device_Set_Description("No Descr", strlen("No Descr"));
pDev->Database_Revision = 0; /* Reset/Initialize now */
return i;
} else
return -1;
}
@@ -152,17 +150,16 @@ uint16_t Add_Routed_Device(
* @return Pointer to the requested Device Object data, or NULL if the idx
* is for an invalid row entry (eg, after the last good Device).
*/
DEVICE_OBJECT_DATA * Get_Routed_Device_Object(
int idx )
DEVICE_OBJECT_DATA *Get_Routed_Device_Object(
int idx)
{
if ( idx == -1 )
return &Devices[iCurrent_Device_Idx];
else if ( (idx >= 0) && (idx < MAX_NUM_DEVICES) ) {
iCurrent_Device_Idx = idx;
return &Devices[idx];
}
else
return NULL;
if (idx == -1)
return &Devices[iCurrent_Device_Idx];
else if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
iCurrent_Device_Idx = idx;
return &Devices[idx];
} else
return NULL;
}
/** Return the BACnet address for the indicated entry.
@@ -174,17 +171,16 @@ DEVICE_OBJECT_DATA * Get_Routed_Device_Object(
* @return Pointer to the requested Device Object BACnet address, or NULL if the idx
* is for an invalid row entry (eg, after the last good Device).
*/
BACNET_ADDRESS * Get_Routed_Device_Address(
int idx )
BACNET_ADDRESS *Get_Routed_Device_Address(
int idx)
{
if ( idx == -1 )
return &Devices[iCurrent_Device_Idx].bacDevAddr;
else if ( (idx >= 0) && (idx < MAX_NUM_DEVICES) ) {
iCurrent_Device_Idx = idx;
return &Devices[idx].bacDevAddr;
}
else
return NULL;
if (idx == -1)
return &Devices[iCurrent_Device_Idx].bacDevAddr;
else if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
iCurrent_Device_Idx = idx;
return &Devices[idx].bacDevAddr;
} else
return NULL;
}
@@ -198,11 +194,10 @@ BACNET_ADDRESS * Get_Routed_Device_Address(
*/
void routed_get_my_address(
BACNET_ADDRESS * my_address)
{
if (my_address) {
memcpy(my_address, &Devices[iCurrent_Device_Idx].bacDevAddr,
sizeof( BACNET_ADDRESS ));
memcpy(my_address, &Devices[iCurrent_Device_Idx].bacDevAddr,
sizeof(BACNET_ADDRESS));
}
}
@@ -224,32 +219,32 @@ void routed_get_my_address(
* meaning MAC broadcast, so it's an automatic match).
* Else False if no match or invalid idx is given.
*/
bool Routed_Device_Address_Lookup(
int idx,
uint8_t address_len,
uint8_t * mac_adress )
bool Routed_Device_Address_Lookup(
int idx,
uint8_t address_len,
uint8_t * mac_adress)
{
bool result = false;
DEVICE_OBJECT_DATA *pDev = &Devices[idx];
int i;
bool result = false;
DEVICE_OBJECT_DATA *pDev = &Devices[idx];
int i;
if ( (idx >= 0) && (idx < MAX_NUM_DEVICES) ) {
if ( address_len == 0 ) {
/* Automatic match */
iCurrent_Device_Idx = idx;
result = true;
} else if ( mac_adress != NULL ) {
for (i = 0; i < address_len; i++) {
if (pDev->bacDevAddr.mac[i] != mac_adress[i])
break;
}
if ( i == address_len ) { /* Success! */
iCurrent_Device_Idx = idx;
result = true;
}
}
}
return result;
if ((idx >= 0) && (idx < MAX_NUM_DEVICES)) {
if (address_len == 0) {
/* Automatic match */
iCurrent_Device_Idx = idx;
result = true;
} else if (mac_adress != NULL) {
for (i = 0; i < address_len; i++) {
if (pDev->bacDevAddr.mac[i] != mac_adress[i])
break;
}
if (i == address_len) { /* Success! */
iCurrent_Device_Idx = idx;
result = true;
}
}
}
return result;
}
@@ -279,63 +274,61 @@ bool Routed_Device_Address_Lookup(
* Else False if no match or invalid idx is given; the cursor will
* be returned as -1 in these cases.
*/
bool Routed_Device_GetNext(
BACNET_ADDRESS * dest,
int * DNET_list,
int * cursor )
bool Routed_Device_GetNext(
BACNET_ADDRESS * dest,
int *DNET_list,
int *cursor)
{
int dnet = DNET_list[0]; /* Get the DNET of our virtual network */
int dnet = DNET_list[0]; /* Get the DNET of our virtual network */
int idx = *cursor;
bool bSuccess = false;
/* First, see if the index is out of range.
* Eg, last call to GetNext may have been the last successful one.
*/
if ( (idx < 0) || (idx >= MAX_NUM_DEVICES) )
idx = -1;
if ((idx < 0) || (idx >= MAX_NUM_DEVICES))
idx = -1;
/* Next, see if it's a BACnet broadcast.
* For broadcasts, all Devices get a chance at it.
*/
else if (dest->net == BACNET_BROADCAST_NETWORK) {
/* Just take the entry indexed by the cursor */
bSuccess = Routed_Device_Address_Lookup( idx++,
dest->len, dest->adr );
/* Just take the entry indexed by the cursor */
bSuccess = Routed_Device_Address_Lookup(idx++, dest->len, dest->adr);
}
/* Or see if it's for the main Gateway Device, because
* there's no routing info.
*/
else if (dest->net == 0) {
else if (dest->net == 0) {
/* Handle like a normal, non-routed access of the Gateway Device.
* But first, make sure our internal access is pointing at
* that Device in our table by telling it "no routing info" : */
bSuccess = Routed_Device_Address_Lookup( 0,
dest->len, dest->adr );
/* Next step: no more matches: */
idx = -1;
bSuccess = Routed_Device_Address_Lookup(0, dest->len, dest->adr);
/* Next step: no more matches: */
idx = -1;
}
/* Or if is our virtual DNET, check
* against each of our virtually routed Devices.
* If we get a match, have it handle the APDU.
* For broadcasts, all Devices get a chance at it.
*/
else if (dest->net == dnet) {
if ( idx == 0 ) /* Step over this case (starting point) */
idx = 1;
while (idx < MAX_NUM_DEVICES) {
bSuccess = Routed_Device_Address_Lookup( idx++,
dest->len, dest->adr );
if ( bSuccess )
break; /* We don't need to keep looking */
}
}
else if (dest->net == dnet) {
if (idx == 0) /* Step over this case (starting point) */
idx = 1;
while (idx < MAX_NUM_DEVICES) {
bSuccess =
Routed_Device_Address_Lookup(idx++, dest->len, dest->adr);
if (bSuccess)
break; /* We don't need to keep looking */
}
}
if ( !bSuccess )
*cursor = -1;
else if ( idx == MAX_NUM_DEVICES ) /* No more to GetNext */
*cursor = -1;
if (!bSuccess)
*cursor = -1;
else if (idx == MAX_NUM_DEVICES) /* No more to GetNext */
*cursor = -1;
else
*cursor = idx;
*cursor = idx;
return bSuccess;
}
@@ -353,24 +346,24 @@ bool Routed_Device_GetNext(
* an automatic match.
* Else False if not a reachable network.
*/
bool Routed_Device_Is_Valid_Network(
uint16_t dest_net,
int * DNET_list )
bool Routed_Device_Is_Valid_Network(
uint16_t dest_net,
int *DNET_list)
{
int dnet = DNET_list[0]; /* Get the DNET of our virtual network */
int dnet = DNET_list[0]; /* Get the DNET of our virtual network */
bool bSuccess = false;
/* First, see if it's a BACnet broadcast (automatic pass). */
if ( dest_net == BACNET_BROADCAST_NETWORK)
bSuccess = true;
if (dest_net == BACNET_BROADCAST_NETWORK)
bSuccess = true;
/* Or see if it's for the main Gateway Device, because
* there's no routing info.
*/
else if (dest_net == 0)
bSuccess = true;
else if (dest_net == 0)
bSuccess = true;
/* Or see if matches our virtual DNET */
else if (dest_net == dnet)
bSuccess = true;
else if (dest_net == dnet)
bSuccess = true;
return bSuccess;
}
@@ -396,20 +389,20 @@ uint32_t Routed_Device_Index_To_Instance(
bool Routed_Device_Valid_Object_Instance_Number(
uint32_t object_id)
{
bool bResult = false;
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
bool bResult = false;
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
/* BACnet allows for a wildcard instance number */
if (object_id == BACNET_MAX_INSTANCE)
bResult = true;
if ( pDev->bacObj.Object_Instance_Number == object_id )
bResult = true;
return bResult;
if (object_id == BACNET_MAX_INSTANCE)
bResult = true;
if (pDev->bacObj.Object_Instance_Number == object_id)
bResult = true;
return bResult;
}
char *Routed_Device_Name(
uint32_t object_instance)
{
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
if (object_instance == pDev->bacObj.Object_Instance_Number) {
return pDev->bacObj.Object_Name;
}
@@ -429,7 +422,7 @@ int Routed_Device_Read_Property_Local(
int apdu_len = 0; /* return value */
BACNET_CHARACTER_STRING char_string;
uint8_t *apdu = NULL;
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
if ((rpdata == NULL) || (rpdata->application_data == NULL) ||
(rpdata->application_data_len == 0)) {
@@ -440,7 +433,7 @@ int Routed_Device_Read_Property_Local(
case PROP_OBJECT_IDENTIFIER:
apdu_len =
encode_application_object_id(&apdu[0], OBJECT_DEVICE,
pDev->bacObj.Object_Instance_Number);
pDev->bacObj.Object_Instance_Number);
break;
case PROP_OBJECT_NAME:
characterstring_init_ansi(&char_string, pDev->bacObj.Object_Name);
@@ -457,11 +450,11 @@ int Routed_Device_Read_Property_Local(
encode_application_unsigned(&apdu[0], pDev->Database_Revision);
break;
default:
apdu_len = Device_Read_Property_Local( rpdata);
apdu_len = Device_Read_Property_Local(rpdata);
break;
}
return ( apdu_len );
return (apdu_len);
}
bool Routed_Device_Write_Property_Local(
@@ -489,8 +482,8 @@ bool Routed_Device_Write_Property_Local(
&wp_data->error_class, &wp_data->error_code);
if (status) {
if ((value.type.Object_Id.type == OBJECT_DEVICE) &&
(Routed_Device_Set_Object_Instance_Number(value.type.
Object_Id.instance))) {
(Routed_Device_Set_Object_Instance_Number(value.
type.Object_Id.instance))) {
/* FIXME: we could send an I-Am broadcast to let the world know */
} else {
status = false;
@@ -504,13 +497,13 @@ bool Routed_Device_Write_Property_Local(
WPValidateString(&value, MAX_DEV_NAME_LEN, false,
&wp_data->error_class, &wp_data->error_code);
if (status) {
Routed_Device_Set_Object_Name(characterstring_value(&value.
type.Character_String),
Routed_Device_Set_Object_Name(characterstring_value
(&value.type.Character_String),
characterstring_length(&value.type.Character_String));
}
break;
default:
status = Device_Write_Property_Local( wp_data);
status = Device_Write_Property_Local(wp_data);
break;
}
return status;
@@ -537,7 +530,7 @@ bool Routed_Device_Set_Object_Instance_Number(
if (object_id <= BACNET_MAX_INSTANCE) {
/* Make the change and update the database revision */
Devices[iCurrent_Device_Idx].bacObj.Object_Instance_Number = object_id;
Devices[iCurrent_Device_Idx].bacObj.Object_Instance_Number = object_id;
Routed_Device_Inc_Database_Revision();
} else
status = false;
@@ -558,7 +551,7 @@ bool Routed_Device_Set_Object_Name(
size_t length)
{
bool status = false; /*return value */
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
if (length < MAX_DEV_NAME_LEN) {
/* Make the change and update the database revision */
@@ -576,7 +569,7 @@ bool Routed_Device_Set_Description(
size_t length)
{
bool status = false; /*return value */
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
if (length < MAX_DEV_DESC_LEN) {
memmove(pDev->Description, name, length);
@@ -596,8 +589,6 @@ bool Routed_Device_Set_Description(
void Routed_Device_Inc_Database_Revision(
void)
{
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
pDev->Database_Revision++;
DEVICE_OBJECT_DATA *pDev = &Devices[iCurrent_Device_Idx];
pDev->Database_Revision++;
}
+8 -8
View File
@@ -469,8 +469,8 @@ int Lighting_Output_Read_Property(
object_index =
Lighting_Output_Instance_To_Index(rpdata->object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Lighting_Output_Level[object_index][rpdata->array_index
- 1] == LIGHTING_LEVEL_NULL)
if (Lighting_Output_Level[object_index][rpdata->
array_index - 1] == LIGHTING_LEVEL_NULL)
apdu_len = encode_application_null(&apdu[0]);
else {
real_value = Lighting_Output_Level[object_index]
@@ -554,11 +554,11 @@ bool Lighting_Output_Write_Property(
if (status) {
level = LIGHTING_LEVEL_NULL;
object_index =
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
Lighting_Output_Instance_To_Index(wp_data->
object_instance);
status =
Lighting_Output_Present_Value_Relinquish
(wp_data->object_instance, wp_data->priority);
Lighting_Output_Present_Value_Relinquish(wp_data->
object_instance, wp_data->priority);
if (wp_data->priority == 6) {
/* Command priority 6 is reserved for use by Minimum On/Off
algorithm and may not be used for other purposes in any
@@ -585,8 +585,8 @@ bool Lighting_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Lighting_Output_Instance_To_Index
(wp_data->object_instance);
Lighting_Output_Instance_To_Index(wp_data->
object_instance);
Lighting_Output_Out_Of_Service[object_index] =
value.type.Boolean;
}
+4 -4
View File
@@ -323,8 +323,8 @@ bool Life_Safety_Point_Write_Property(
if (status) {
if (value.type.Enumerated <= MAX_LIFE_SAFETY_MODE) {
object_index =
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Instance_To_Index(wp_data->
object_instance);
Life_Safety_Point_Mode[object_index] =
value.type.Enumerated;
} else {
@@ -340,8 +340,8 @@ bool Life_Safety_Point_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Life_Safety_Point_Instance_To_Index
(wp_data->object_instance);
Life_Safety_Point_Instance_To_Index(wp_data->
object_instance);
Life_Safety_Point_Out_Of_Service[object_index] =
value.type.Boolean;
}
+10 -12
View File
@@ -277,8 +277,7 @@ static char *Multistate_Input_State_Text(
char *pName = NULL; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if ((index < MAX_MULTISTATE_INPUTS) &&
(state_index > 0) &&
if ((index < MAX_MULTISTATE_INPUTS) && (state_index > 0) &&
(state_index <= MULTISTATE_NUMBER_OF_STATES)) {
state_index--;
pName = State_Text[index][state_index];
@@ -298,8 +297,7 @@ bool Multistate_Input_State_Text_Set(
bool status = false; /* return value */
index = Multistate_Input_Instance_To_Index(object_instance);
if ((index < MAX_MULTISTATE_INPUTS) &&
(state_index > 0) &&
if ((index < MAX_MULTISTATE_INPUTS) && (state_index > 0) &&
(state_index <= MULTISTATE_NUMBER_OF_STATES)) {
state_index--;
status = true;
@@ -405,8 +403,8 @@ int Multistate_Input_Read_Property(
/* if no index was specified, then try to encode the entire list */
/* into one packet. */
object_index =
Multistate_Input_Instance_To_Index
(rpdata->object_instance);
Multistate_Input_Instance_To_Index(rpdata->
object_instance);
for (i = 1; i <= MULTISTATE_NUMBER_OF_STATES; i++) {
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance,
@@ -427,8 +425,8 @@ int Multistate_Input_Read_Property(
}
} else {
object_index =
Multistate_Input_Instance_To_Index
(rpdata->object_instance);
Multistate_Input_Instance_To_Index(rpdata->
object_instance);
if (rpdata->array_index <= MULTISTATE_NUMBER_OF_STATES) {
characterstring_init_ansi(&char_string,
Multistate_Input_State_Text(rpdata->object_instance,
@@ -488,8 +486,8 @@ bool Multistate_Input_Write_Property(
if (status) {
if (Out_Of_Service[object_index]) {
status =
Multistate_Input_Present_Value_Set
(wp_data->object_instance, value.type.Unsigned_Int);
Multistate_Input_Present_Value_Set(wp_data->
object_instance, value.type.Unsigned_Int);
if (!status) {
wp_data->error_class = ERROR_CLASS_PROPERTY;
wp_data->error_code = ERROR_CODE_VALUE_OUT_OF_RANGE;
@@ -507,8 +505,8 @@ bool Multistate_Input_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Multistate_Input_Instance_To_Index
(wp_data->object_instance);
Multistate_Input_Instance_To_Index(wp_data->
object_instance);
Out_Of_Service[object_index] = value.type.Boolean;
}
break;
+10 -10
View File
@@ -266,8 +266,8 @@ int Multistate_Output_Read_Property(
/* into one packet. */
else if (rpdata->array_index == BACNET_ARRAY_ALL) {
object_index =
Multistate_Output_Instance_To_Index
(rpdata->object_instance);
Multistate_Output_Instance_To_Index(rpdata->
object_instance);
for (i = 0; i < BACNET_MAX_PRIORITY; i++) {
/* FIXME: check if we have room before adding it to APDU */
if (Multistate_Output_Level[object_index][i] ==
@@ -292,8 +292,8 @@ int Multistate_Output_Read_Property(
}
} else {
object_index =
Multistate_Output_Instance_To_Index
(rpdata->object_instance);
Multistate_Output_Instance_To_Index(rpdata->
object_instance);
if (rpdata->array_index <= BACNET_MAX_PRIORITY) {
if (Multistate_Output_Level[object_index]
[rpdata->array_index - 1] == MULTISTATE_NULL)
@@ -375,8 +375,8 @@ bool Multistate_Output_Write_Property(
(value.type.Unsigned_Int <= MULTISTATE_NUMBER_OF_STATES)) {
level = value.type.Unsigned_Int;
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
priority--;
Multistate_Output_Level[object_index][priority] =
(uint8_t) level;
@@ -403,8 +403,8 @@ bool Multistate_Output_Write_Property(
if (status) {
level = MULTISTATE_NULL;
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
priority = wp_data->priority;
if (priority && (priority <= BACNET_MAX_PRIORITY)) {
priority--;
@@ -430,8 +430,8 @@ bool Multistate_Output_Write_Property(
&wp_data->error_class, &wp_data->error_code);
if (status) {
object_index =
Multistate_Output_Instance_To_Index
(wp_data->object_instance);
Multistate_Output_Instance_To_Index(wp_data->
object_instance);
Multistate_Output_Out_Of_Service[object_index] =
value.type.Boolean;
}
+7 -7
View File
@@ -735,9 +735,9 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) {
iOffset += len;
len =
bacapp_decode_context_data(&wp_data->application_data
[iOffset], wp_data->application_data_len, &value,
PROP_LOG_DEVICE_OBJECT_PROPERTY);
bacapp_decode_context_data(&wp_data->
application_data[iOffset], wp_data->application_data_len,
&value, PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || ((value.context_tag != 2) &&
(value.context_tag != 3))) {
/* Bad decode or wrong tag */
@@ -754,8 +754,8 @@ bool Trend_Log_Write_Property(
if (wp_data->application_data_len != 0) {
iOffset += len;
len =
bacapp_decode_context_data
(&wp_data->application_data[iOffset],
bacapp_decode_context_data(&wp_data->
application_data[iOffset],
wp_data->application_data_len, &value,
PROP_LOG_DEVICE_OBJECT_PROPERTY);
if ((len == 0) || (value.context_tag != 3)) {
@@ -1097,8 +1097,8 @@ int rr_trend_log_encode(
pRequest->ItemCount = 0; /* Start out with nothing */
/* Bail out now if nowt - should never happen for a Trend Log but ... */
if (LogInfo[Trend_Log_Instance_To_Index(pRequest->
object_instance)].ulRecordCount == 0)
if (LogInfo[Trend_Log_Instance_To_Index(pRequest->object_instance)].
ulRecordCount == 0)
return (0);
if ((pRequest->RequestType == RR_BY_POSITION) ||