Got rid of the handler-set functions for RP,RPM,WP,RD. Just referencing the device object functions directly.

This commit is contained in:
skarg
2010-02-18 03:06:03 +00:00
parent 2b2077a329
commit 1f9c13d37b
10 changed files with 196 additions and 237 deletions
+31 -19
View File
@@ -46,6 +46,11 @@
#include "bi.h"
#include "bo.h"
/* forward prototype */
int Device_Read_Property_Local(
BACNET_READ_PROPERTY_DATA *rpdata);
bool Device_Write_Property_Local(
BACNET_WRITE_PROPERTY_DATA * wp_data);
static struct object_functions {
BACNET_OBJECT_TYPE Object_Type;
@@ -65,8 +70,8 @@ static struct object_functions {
Device_Index_To_Instance,
Device_Valid_Object_Instance_Number,
Device_Name,
Device_Read_Property,
Device_Write_Property,
Device_Read_Property_Local,
Device_Write_Property_Local,
Device_Property_Lists},
{OBJECT_ANALOG_INPUT,
Analog_Input_Init,
@@ -225,7 +230,7 @@ static int Read_Property_Common(
/* Encodes the property APDU and returns the length,
or sets the error, and returns -1 */
int Device_Objects_Read_Property(
int Device_Read_Property(
BACNET_READ_PROPERTY_DATA *rpdata)
{
int apdu_len = -1;
@@ -249,7 +254,7 @@ int Device_Objects_Read_Property(
return apdu_len;
}
bool Device_Objects_Write_Property(
bool Device_Write_Property(
BACNET_WRITE_PROPERTY_DATA * wp_data)
{
int apdu_len = -1;
@@ -294,7 +299,7 @@ static unsigned property_list_count(
}
/* for a given object type, returns the special property list */
static void Device_Objects_Property_List(
void Device_Objects_Property_List(
BACNET_OBJECT_TYPE object_type,
struct special_property_list_t *pPropertyList)
{
@@ -366,11 +371,26 @@ char *Device_Name(
return NULL;
}
void Device_Reinit(
void)
bool Device_Reinitialize(
BACNET_REINITIALIZE_DEVICE_DATA *rd_data)
{
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
Device_Set_Object_Instance_Number(BACNET_MAX_INSTANCE);
bool status = false;
if (characterstring_ansi_same(&rd_data->password, "rehmite")) {
Reinitialize_State = rd_data->state;
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
/* Note: you could use a mix of state
and password to multiple things */
/* note: you probably want to restart *after* the
simple ack has been sent from the return handler
so just set a flag from here */
status = true;
} else {
rd_data->error_class = ERROR_CLASS_SECURITY;
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
}
return status;
}
void Device_Init(
@@ -378,11 +398,6 @@ void Device_Init(
{
struct object_functions *pObject = NULL;
handler_read_property_function_set(Device_Objects_Read_Property);
handler_rpm_function_set(Device_Objects_Read_Property);
handler_rpm_list_set(Device_Objects_Property_List);
handler_write_property_function_set(Device_Objects_Write_Property);
pObject = &Object_Table[0];
while (pObject->Object_Type < MAX_BACNET_OBJECT_TYPE) {
if (pObject->Object_Init) {
@@ -390,9 +405,6 @@ void Device_Init(
}
pObject++;
}
Reinitialize_State = REINITIALIZED_STATE_IDLE;
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
/* Get the data from the eeprom */
eeprom_bytes_read(NV_EEPROM_DEVICE_0, (uint8_t *) & Object_Instance_Number,
@@ -598,7 +610,7 @@ char *Device_Valid_Object_Id(
}
/* return the length of the apdu encoded or -1 for error */
int Device_Read_Property(
int Device_Read_Property_Local(
BACNET_READ_PROPERTY_DATA *rpdata)
{
int apdu_len = 0; /* return value */
@@ -796,7 +808,7 @@ int Device_Read_Property(
return apdu_len;
}
bool Device_Write_Property(
bool Device_Write_Property_Local(
BACNET_WRITE_PROPERTY_DATA * wp_data)
{
bool status = false; /* return value */