Fix bbmd_register_as_foreign_device when only BBMD_CLIENT_ENABLED and not BBMD_ENABLED (#1032)
* fix timer for mstp statistics * fix `bbmd_register_as_foreign_device` when only `BBMD_CLIENT_ENABLED` and not `BBMD_ENABLED`
This commit is contained in:
@@ -100,7 +100,7 @@ void dlenv_bbmd_ttl_set(uint16_t ttl_secs)
|
|||||||
int dlenv_bbmd_result(void)
|
int dlenv_bbmd_result(void)
|
||||||
{
|
{
|
||||||
if (BBMD_Result > 0) {
|
if (BBMD_Result > 0) {
|
||||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
#if defined(BACDL_BIP) && BBMD_CLIENT_ENABLED
|
||||||
if (bvlc_get_last_result() == BVLC_RESULT_REGISTER_FOREIGN_DEVICE_NAK) {
|
if (bvlc_get_last_result() == BVLC_RESULT_REGISTER_FOREIGN_DEVICE_NAK) {
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@@ -127,24 +127,25 @@ int dlenv_bbmd_result(void)
|
|||||||
static int bbmd_register_as_foreign_device(void)
|
static int bbmd_register_as_foreign_device(void)
|
||||||
{
|
{
|
||||||
int retval = -1;
|
int retval = -1;
|
||||||
#if defined(BACDL_BIP) && BBMD_ENABLED
|
#if defined(BACDL_BIP) && BBMD_CLIENT_ENABLED
|
||||||
|
char *pEnv = NULL;
|
||||||
|
long long_value = 0;
|
||||||
|
#if BBMD_ENABLED
|
||||||
bool bdt_entry_valid = false;
|
bool bdt_entry_valid = false;
|
||||||
uint16_t bdt_entry_port = 0;
|
uint16_t bdt_entry_port = 0;
|
||||||
char *pEnv = NULL;
|
|
||||||
unsigned a[4] = { 0 };
|
unsigned a[4] = { 0 };
|
||||||
char bbmd_env[32] = "";
|
char bbmd_env[32] = "";
|
||||||
unsigned entry_number = 0;
|
unsigned entry_number = 0;
|
||||||
long long_value = 0;
|
|
||||||
int c;
|
int c;
|
||||||
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_table = NULL;
|
BACNET_IP_BROADCAST_DISTRIBUTION_TABLE_ENTRY *bdt_table = NULL;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
BBMD_Address.port = 0xBAC0;
|
||||||
pEnv = getenv("BACNET_BBMD_PORT");
|
pEnv = getenv("BACNET_BBMD_PORT");
|
||||||
if (pEnv) {
|
if (pEnv) {
|
||||||
long_value = strtol(pEnv, NULL, 0);
|
long_value = strtol(pEnv, NULL, 0);
|
||||||
if (long_value <= 0xFFFF) {
|
if (long_value <= 0xFFFF) {
|
||||||
BBMD_Address.port = (uint16_t)long_value;
|
BBMD_Address.port = (uint16_t)long_value;
|
||||||
} else {
|
|
||||||
BBMD_Address.port = 0xBAC0;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pEnv = getenv("BACNET_BBMD_TIMETOLIVE");
|
pEnv = getenv("BACNET_BBMD_TIMETOLIVE");
|
||||||
@@ -181,7 +182,9 @@ static int bbmd_register_as_foreign_device(void)
|
|||||||
(unsigned)BBMD_Address.address[3], (unsigned)BBMD_Address.port);
|
(unsigned)BBMD_Address.address[3], (unsigned)BBMD_Address.port);
|
||||||
}
|
}
|
||||||
BBMD_Timer_Seconds = BBMD_TTL_Seconds;
|
BBMD_Timer_Seconds = BBMD_TTL_Seconds;
|
||||||
} else {
|
}
|
||||||
|
#if BBMD_ENABLED
|
||||||
|
else {
|
||||||
for (entry_number = 1; entry_number <= 128; entry_number++) {
|
for (entry_number = 1; entry_number <= 128; entry_number++) {
|
||||||
bdt_entry_valid = false;
|
bdt_entry_valid = false;
|
||||||
snprintf(
|
snprintf(
|
||||||
@@ -257,6 +260,7 @@ static int bbmd_register_as_foreign_device(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
#endif
|
#endif
|
||||||
BBMD_Result = retval;
|
BBMD_Result = retval;
|
||||||
|
|
||||||
@@ -790,7 +794,7 @@ void dlenv_maintenance_timer(uint16_t elapsed_seconds)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Network_Port_Type(Network_Port_Instance) == PORT_TYPE_MSTP) {
|
if (Network_Port_Type(Network_Port_Instance) == PORT_TYPE_MSTP) {
|
||||||
Datalink_Debug_Timer_Seconds = elapsed_seconds;
|
Datalink_Debug_Timer_Seconds += elapsed_seconds;
|
||||||
if (Datalink_Debug_Timer_Seconds >= 60) {
|
if (Datalink_Debug_Timer_Seconds >= 60) {
|
||||||
Datalink_Debug_Timer_Seconds = 0;
|
Datalink_Debug_Timer_Seconds = 0;
|
||||||
if (Datalink_Debug) {
|
if (Datalink_Debug) {
|
||||||
|
|||||||
Reference in New Issue
Block a user