Added Database_Revision property to PIC port.

This commit is contained in:
skarg
2012-05-11 15:04:51 +00:00
parent 54c4ce342c
commit e9098c2cfa
+29 -6
View File
@@ -49,13 +49,35 @@
into the read-property encoding. */ into the read-property encoding. */
static uint32_t Object_Instance_Number = 12345; static uint32_t Object_Instance_Number = 12345;
static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL; static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL;
static uint8_t Database_Revision;
BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE; BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
void Device_Reinit( bool Device_Reinitialize(
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
{
bool status = false;
if (characterstring_ansi_same(&rd_data->password, "filister")) {
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;
}
BACNET_REINITIALIZED_STATE Device_Reinitialized_State(
void) void)
{ {
dcc_set_status_duration(COMMUNICATION_ENABLE, 0); return Reinitialize_State;
} }
void Device_Init( void Device_Init(
@@ -84,6 +106,7 @@ bool Device_Set_Object_Instance_Number(
if (object_id <= BACNET_MAX_INSTANCE) { if (object_id <= BACNET_MAX_INSTANCE) {
Object_Instance_Number = object_id; Object_Instance_Number = object_id;
Database_Revision++;
/* FIXME: Write the data to the eeprom */ /* FIXME: Write the data to the eeprom */
/* I2C_Write_Block( /* I2C_Write_Block(
EEPROM_DEVICE_ADDRESS, EEPROM_DEVICE_ADDRESS,
@@ -126,13 +149,13 @@ uint16_t Device_Vendor_Identifier(
uint8_t Device_Protocol_Version( uint8_t Device_Protocol_Version(
void) void)
{ {
return 1; return BACNET_PROTOCOL_VERSION;
} }
uint8_t Device_Protocol_Revision( uint8_t Device_Protocol_Revision(
void) void)
{ {
return 5; return BACNET_PROTOCOL_REVISION;
} }
BACNET_SEGMENTATION Device_Segmentation_Supported( BACNET_SEGMENTATION Device_Segmentation_Supported(
@@ -144,7 +167,7 @@ BACNET_SEGMENTATION Device_Segmentation_Supported(
uint8_t Device_Database_Revision( uint8_t Device_Database_Revision(
void) void)
{ {
return 0; return Database_Revision;
} }
/* Since many network clients depend on the object list */ /* Since many network clients depend on the object list */