Merged revision(s) 3172 from branches/releases/bacnet-stack-0-8-0:
Fixed ReinitializeDevice service error handling of states for demos and ports. ........
This commit is contained in:
@@ -578,57 +578,6 @@ void Device_Objects_Property_List(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Commands a Device re-initialization, to a given state.
|
|
||||||
* The request's password must match for the operation to succeed.
|
|
||||||
* This implementation provides a framework, but doesn't
|
|
||||||
* actually *DO* anything.
|
|
||||||
* @note You could use a mix of states and passwords to multiple outcomes.
|
|
||||||
* @note You probably want to restart *after* the simple ack has been sent
|
|
||||||
* from the return handler, so just set a local flag here.
|
|
||||||
* @ingroup ObjIntf
|
|
||||||
*
|
|
||||||
* @param rd_data [in,out] The information from the RD request.
|
|
||||||
* On failure, the error class and code will be set.
|
|
||||||
* @return True if succeeds (password is correct), else False.
|
|
||||||
*/
|
|
||||||
bool Device_Reinitialize(
|
|
||||||
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
|
|
||||||
{
|
|
||||||
bool status = false;
|
|
||||||
|
|
||||||
if (characterstring_ansi_same(&rd_data->password, "Jesus")) {
|
|
||||||
switch (rd_data->state) {
|
|
||||||
case BACNET_REINIT_COLDSTART:
|
|
||||||
case BACNET_REINIT_WARMSTART:
|
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_STARTBACKUP:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_ENDBACKUP:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_STARTRESTORE:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_ENDRESTORE:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_ABORTRESTORE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||||
static const int Device_Properties_Required[] = {
|
static const int Device_Properties_Required[] = {
|
||||||
PROP_OBJECT_IDENTIFIER,
|
PROP_OBJECT_IDENTIFIER,
|
||||||
@@ -745,6 +694,71 @@ static uint32_t Database_Revision = 0;
|
|||||||
/* Auto_Slave_Discovery */
|
/* Auto_Slave_Discovery */
|
||||||
/* Slave_Address_Binding */
|
/* Slave_Address_Binding */
|
||||||
/* Profile_Name */
|
/* Profile_Name */
|
||||||
|
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
||||||
|
static const char *Reinit_Password = "filister";
|
||||||
|
|
||||||
|
/** Commands a Device re-initialization, to a given state.
|
||||||
|
* The request's password must match for the operation to succeed.
|
||||||
|
* This implementation provides a framework, but doesn't
|
||||||
|
* actually *DO* anything.
|
||||||
|
* @note You could use a mix of states and passwords to multiple outcomes.
|
||||||
|
* @note You probably want to restart *after* the simple ack has been sent
|
||||||
|
* from the return handler, so just set a local flag here.
|
||||||
|
* @ingroup ObjIntf
|
||||||
|
*
|
||||||
|
* @param rd_data [in,out] The information from the RD request.
|
||||||
|
* On failure, the error class and code will be set.
|
||||||
|
* @return True if succeeds (password is correct), else False.
|
||||||
|
*/
|
||||||
|
bool Device_Reinitialize(
|
||||||
|
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
|
||||||
|
{
|
||||||
|
bool status = false;
|
||||||
|
|
||||||
|
/* Note: you could use a mix of state and password to multiple things */
|
||||||
|
if (characterstring_ansi_same(&rd_data->password, Reinit_Password)) {
|
||||||
|
switch (rd_data->state) {
|
||||||
|
case BACNET_REINIT_COLDSTART:
|
||||||
|
case BACNET_REINIT_WARMSTART:
|
||||||
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
|
/* note: you probably want to restart *after* the
|
||||||
|
simple ack has been sent from the return handler
|
||||||
|
so just set a flag from here */
|
||||||
|
Reinitialize_State = rd_data->state;
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
case BACNET_REINIT_STARTBACKUP:
|
||||||
|
case BACNET_REINIT_ENDBACKUP:
|
||||||
|
case BACNET_REINIT_STARTRESTORE:
|
||||||
|
case BACNET_REINIT_ENDRESTORE:
|
||||||
|
case BACNET_REINIT_ABORTRESTORE:
|
||||||
|
if (dcc_communication_disabled()) {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED;
|
||||||
|
} else {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code =
|
||||||
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} 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)
|
||||||
|
{
|
||||||
|
return Reinitialize_State;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned Device_Count(
|
unsigned Device_Count(
|
||||||
void)
|
void)
|
||||||
|
|||||||
@@ -235,57 +235,6 @@ void Device_Objects_Property_List(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Commands a Device re-initialization, to a given state.
|
|
||||||
* The request's password must match for the operation to succeed.
|
|
||||||
* This implementation provides a framework, but doesn't
|
|
||||||
* actually *DO* anything.
|
|
||||||
* @note You could use a mix of states and passwords to multiple outcomes.
|
|
||||||
* @note You probably want to restart *after* the simple ack has been sent
|
|
||||||
* from the return handler, so just set a local flag here.
|
|
||||||
* @ingroup ObjIntf
|
|
||||||
*
|
|
||||||
* @param rd_data [in,out] The information from the RD request.
|
|
||||||
* On failure, the error class and code will be set.
|
|
||||||
* @return True if succeeds (password is correct), else False.
|
|
||||||
*/
|
|
||||||
bool Device_Reinitialize(
|
|
||||||
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
|
|
||||||
{
|
|
||||||
bool status = false;
|
|
||||||
|
|
||||||
if (characterstring_ansi_same(&rd_data->password, "raspberry")) {
|
|
||||||
switch (rd_data->state) {
|
|
||||||
case BACNET_REINIT_COLDSTART:
|
|
||||||
case BACNET_REINIT_WARMSTART:
|
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_STARTBACKUP:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_ENDBACKUP:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_STARTRESTORE:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_ENDRESTORE:
|
|
||||||
break;
|
|
||||||
case BACNET_REINIT_ABORTRESTORE:
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
/* 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||||
static const int Device_Properties_Required[] = {
|
static const int Device_Properties_Required[] = {
|
||||||
PROP_OBJECT_IDENTIFIER,
|
PROP_OBJECT_IDENTIFIER,
|
||||||
@@ -391,6 +340,71 @@ static uint32_t Database_Revision = 0;
|
|||||||
/* Auto_Slave_Discovery */
|
/* Auto_Slave_Discovery */
|
||||||
/* Slave_Address_Binding */
|
/* Slave_Address_Binding */
|
||||||
/* Profile_Name */
|
/* Profile_Name */
|
||||||
|
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
||||||
|
static const char *Reinit_Password = "raspberry";
|
||||||
|
|
||||||
|
/** Commands a Device re-initialization, to a given state.
|
||||||
|
* The request's password must match for the operation to succeed.
|
||||||
|
* This implementation provides a framework, but doesn't
|
||||||
|
* actually *DO* anything.
|
||||||
|
* @note You could use a mix of states and passwords to multiple outcomes.
|
||||||
|
* @note You probably want to restart *after* the simple ack has been sent
|
||||||
|
* from the return handler, so just set a local flag here.
|
||||||
|
* @ingroup ObjIntf
|
||||||
|
*
|
||||||
|
* @param rd_data [in,out] The information from the RD request.
|
||||||
|
* On failure, the error class and code will be set.
|
||||||
|
* @return True if succeeds (password is correct), else False.
|
||||||
|
*/
|
||||||
|
bool Device_Reinitialize(
|
||||||
|
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
|
||||||
|
{
|
||||||
|
bool status = false;
|
||||||
|
|
||||||
|
/* Note: you could use a mix of state and password to multiple things */
|
||||||
|
if (characterstring_ansi_same(&rd_data->password, Reinit_Password)) {
|
||||||
|
switch (rd_data->state) {
|
||||||
|
case BACNET_REINIT_COLDSTART:
|
||||||
|
case BACNET_REINIT_WARMSTART:
|
||||||
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
|
/* note: you probably want to restart *after* the
|
||||||
|
simple ack has been sent from the return handler
|
||||||
|
so just set a flag from here */
|
||||||
|
Reinitialize_State = rd_data->state;
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
case BACNET_REINIT_STARTBACKUP:
|
||||||
|
case BACNET_REINIT_ENDBACKUP:
|
||||||
|
case BACNET_REINIT_STARTRESTORE:
|
||||||
|
case BACNET_REINIT_ENDRESTORE:
|
||||||
|
case BACNET_REINIT_ABORTRESTORE:
|
||||||
|
if (dcc_communication_disabled()) {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED;
|
||||||
|
} else {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code =
|
||||||
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
} 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)
|
||||||
|
{
|
||||||
|
return Reinitialize_State;
|
||||||
|
}
|
||||||
|
|
||||||
unsigned Device_Count(
|
unsigned Device_Count(
|
||||||
void)
|
void)
|
||||||
|
|||||||
@@ -97,6 +97,7 @@ static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL;
|
|||||||
static BACNET_CHARACTER_STRING My_Object_Name;
|
static BACNET_CHARACTER_STRING My_Object_Name;
|
||||||
static uint32_t Database_Revision;
|
static uint32_t Database_Revision;
|
||||||
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
||||||
|
static const char *Reinit_Password = "rehmite";
|
||||||
|
|
||||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||||
static const int Device_Properties_Required[] = {
|
static const int Device_Properties_Required[] = {
|
||||||
@@ -379,15 +380,37 @@ bool Device_Reinitialize(
|
|||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
if (characterstring_ansi_same(&rd_data->password, "rehmite")) {
|
/* Note: you could use a mix of state and password to multiple things */
|
||||||
Reinitialize_State = rd_data->state;
|
if (characterstring_ansi_same(&rd_data->password, Reinit_Password)) {
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
switch (rd_data->state) {
|
||||||
/* Note: you could use a mix of state
|
case BACNET_REINIT_COLDSTART:
|
||||||
and password to multiple things */
|
case BACNET_REINIT_WARMSTART:
|
||||||
/* note: you probably want to restart *after* the
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
simple ack has been sent from the return handler
|
/* note: you probably want to restart *after* the
|
||||||
so just set a flag from here */
|
simple ack has been sent from the return handler
|
||||||
status = true;
|
so just set a flag from here */
|
||||||
|
Reinitialize_State = rd_data->state;
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
case BACNET_REINIT_STARTBACKUP:
|
||||||
|
case BACNET_REINIT_ENDBACKUP:
|
||||||
|
case BACNET_REINIT_STARTRESTORE:
|
||||||
|
case BACNET_REINIT_ENDRESTORE:
|
||||||
|
case BACNET_REINIT_ABORTRESTORE:
|
||||||
|
if (dcc_communication_disabled()) {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED;
|
||||||
|
} else {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code =
|
||||||
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rd_data->error_class = ERROR_CLASS_SECURITY;
|
rd_data->error_class = ERROR_CLASS_SECURITY;
|
||||||
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ static uint32_t Object_Instance_Number;
|
|||||||
static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL;
|
static BACNET_DEVICE_STATUS System_Status = STATUS_OPERATIONAL;
|
||||||
static uint32_t Database_Revision;
|
static uint32_t Database_Revision;
|
||||||
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
||||||
|
static const char *Reinit_Password = "rehmite";
|
||||||
|
|
||||||
/* These three arrays are used by the ReadPropertyMultiple handler */
|
/* These three arrays are used by the ReadPropertyMultiple handler */
|
||||||
static const int Device_Properties_Required[] = {
|
static const int Device_Properties_Required[] = {
|
||||||
@@ -320,15 +321,37 @@ bool Device_Reinitialize(
|
|||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
if (characterstring_ansi_same(&rd_data->password, "rehmite")) {
|
/* Note: you could use a mix of state and password to multiple things */
|
||||||
Reinitialize_State = rd_data->state;
|
if (characterstring_ansi_same(&rd_data->password, Reinit_Password)) {
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
switch (rd_data->state) {
|
||||||
/* Note: you could use a mix of state
|
case BACNET_REINIT_COLDSTART:
|
||||||
and password to multiple things */
|
case BACNET_REINIT_WARMSTART:
|
||||||
/* note: you probably want to restart *after* the
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
simple ack has been sent from the return handler
|
/* note: you probably want to restart *after* the
|
||||||
so just set a flag from here */
|
simple ack has been sent from the return handler
|
||||||
status = true;
|
so just set a flag from here */
|
||||||
|
Reinitialize_State = rd_data->state;
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
case BACNET_REINIT_STARTBACKUP:
|
||||||
|
case BACNET_REINIT_ENDBACKUP:
|
||||||
|
case BACNET_REINIT_STARTRESTORE:
|
||||||
|
case BACNET_REINIT_ENDRESTORE:
|
||||||
|
case BACNET_REINIT_ABORTRESTORE:
|
||||||
|
if (dcc_communication_disabled()) {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED;
|
||||||
|
} else {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code =
|
||||||
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rd_data->error_class = ERROR_CLASS_SECURITY;
|
rd_data->error_class = ERROR_CLASS_SECURITY;
|
||||||
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
||||||
|
|||||||
@@ -52,22 +52,44 @@ 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;
|
static uint8_t Database_Revision;
|
||||||
BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
||||||
|
static char Reinit_Password[16] = "filister";
|
||||||
|
|
||||||
bool Device_Reinitialize(
|
bool Device_Reinitialize(
|
||||||
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
|
BACNET_REINITIALIZE_DEVICE_DATA * rd_data)
|
||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
char password[16] = "filister";
|
|
||||||
|
|
||||||
if (characterstring_ansi_same(&rd_data->password, password)) {
|
/* Note: you could use a mix of state and password to multiple things */
|
||||||
Reinitialize_State = rd_data->state;
|
if (characterstring_ansi_same(&rd_data->password, Reinit_Password)) {
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
switch (rd_data->state) {
|
||||||
/* Note: you could use a mix of state
|
case BACNET_REINIT_COLDSTART:
|
||||||
and password to multiple things */
|
case BACNET_REINIT_WARMSTART:
|
||||||
/* note: you probably want to restart *after* the
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
simple ack has been sent from the return handler
|
/* note: you probably want to restart *after* the
|
||||||
so just set a flag from here */
|
simple ack has been sent from the return handler
|
||||||
status = true;
|
so just set a flag from here */
|
||||||
|
Reinitialize_State = rd_data->state;
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
case BACNET_REINIT_STARTBACKUP:
|
||||||
|
case BACNET_REINIT_ENDBACKUP:
|
||||||
|
case BACNET_REINIT_STARTRESTORE:
|
||||||
|
case BACNET_REINIT_ENDRESTORE:
|
||||||
|
case BACNET_REINIT_ABORTRESTORE:
|
||||||
|
if (dcc_communication_disabled()) {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED;
|
||||||
|
} else {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code =
|
||||||
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rd_data->error_class = ERROR_CLASS_SECURITY;
|
rd_data->error_class = ERROR_CLASS_SECURITY;
|
||||||
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
||||||
|
|||||||
@@ -84,6 +84,7 @@ static struct my_object_functions {
|
|||||||
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 BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
static BACNET_REINITIALIZED_STATE Reinitialize_State = BACNET_REINIT_IDLE;
|
||||||
|
static const char *Reinit_Password = "filister";
|
||||||
static char My_Object_Name[MAX_DEV_NAME_LEN + 1] = "SimpleServer";
|
static char My_Object_Name[MAX_DEV_NAME_LEN + 1] = "SimpleServer";
|
||||||
static char Model_Name[MAX_DEV_MOD_LEN + 1] = "RX62N";
|
static char Model_Name[MAX_DEV_MOD_LEN + 1] = "RX62N";
|
||||||
static char Application_Software_Version[MAX_DEV_VER_LEN + 1] = "1.0";
|
static char Application_Software_Version[MAX_DEV_VER_LEN + 1] = "1.0";
|
||||||
@@ -290,15 +291,37 @@ bool Device_Reinitialize(
|
|||||||
{
|
{
|
||||||
bool status = false;
|
bool status = false;
|
||||||
|
|
||||||
if (characterstring_ansi_same(&rd_data->password, "rehmite")) {
|
/* Note: you could use a mix of state and password to multiple things */
|
||||||
Reinitialize_State = rd_data->state;
|
if (characterstring_ansi_same(&rd_data->password, Reinit_Password)) {
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
switch (rd_data->state) {
|
||||||
/* Note: you could use a mix of state
|
case BACNET_REINIT_COLDSTART:
|
||||||
and password to multiple things */
|
case BACNET_REINIT_WARMSTART:
|
||||||
/* note: you probably want to restart *after* the
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
simple ack has been sent from the return handler
|
/* note: you probably want to restart *after* the
|
||||||
so just set a flag from here */
|
simple ack has been sent from the return handler
|
||||||
status = true;
|
so just set a flag from here */
|
||||||
|
Reinitialize_State = rd_data->state;
|
||||||
|
status = true;
|
||||||
|
break;
|
||||||
|
case BACNET_REINIT_STARTBACKUP:
|
||||||
|
case BACNET_REINIT_ENDBACKUP:
|
||||||
|
case BACNET_REINIT_STARTRESTORE:
|
||||||
|
case BACNET_REINIT_ENDRESTORE:
|
||||||
|
case BACNET_REINIT_ABORTRESTORE:
|
||||||
|
if (dcc_communication_disabled()) {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_COMMUNICATION_DISABLED;
|
||||||
|
} else {
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code =
|
||||||
|
ERROR_CODE_OPTIONAL_FUNCTIONALITY_NOT_SUPPORTED;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
rd_data->error_class = ERROR_CLASS_SERVICES;
|
||||||
|
rd_data->error_code = ERROR_CODE_PARAMETER_OUT_OF_RANGE;
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
rd_data->error_class = ERROR_CLASS_SECURITY;
|
rd_data->error_class = ERROR_CLASS_SECURITY;
|
||||||
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
rd_data->error_code = ERROR_CODE_PASSWORD_FAILURE;
|
||||||
|
|||||||
@@ -368,10 +368,12 @@ bool Device_Reinitialize(
|
|||||||
switch (rd_data->state) {
|
switch (rd_data->state) {
|
||||||
case BACNET_REINIT_COLDSTART:
|
case BACNET_REINIT_COLDSTART:
|
||||||
case BACNET_REINIT_WARMSTART:
|
case BACNET_REINIT_WARMSTART:
|
||||||
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
dcc_set_status_duration(COMMUNICATION_ENABLE, 0);
|
||||||
/* note: you probably want to restart *after* the
|
/* Note: you could use a mix of state
|
||||||
simple ack has been sent from the return handler
|
and password to multiple things */
|
||||||
so just set a flag from here */
|
/* note: you probably want to restart *after* the
|
||||||
|
simple ack has been sent from the return handler
|
||||||
|
so just set a flag from here */
|
||||||
Reinitialize_State = rd_data->state;
|
Reinitialize_State = rd_data->state;
|
||||||
status = true;
|
status = true;
|
||||||
break;
|
break;
|
||||||
|
|||||||
Reference in New Issue
Block a user