Followed Steve's good recommendation, and made routed_get_my_address() be a variant of datalink_get_my_address() just when routing is in use. Haven't done anything about the sending functions yet.
Renamed Lookup_Routed_Device_Address() as Routed_Device_Address_Lookup(), and replaced it in the routed npdu handler with a function that finds the "next" gateway or routed device, as per the destination address. (Less tied to the specifics of the gw_device.c implementation.) Fixed a few build warnings (eg, %zu for size_t arguments). Until we improve the makefile system, I've enabled BAC_ROUTING in config.h
This commit is contained in:
@@ -197,10 +197,8 @@ extern "C" {
|
||||
unsigned max_apdu_len,
|
||||
BACNET_PROPERTY_ID property);
|
||||
|
||||
#if PRINT_ENABLED
|
||||
#define BACAPP_PRINT_ENABLED
|
||||
#else
|
||||
#ifdef TEST
|
||||
#ifndef BACAPP_PRINT_ENABLED
|
||||
#if PRINT_ENABLED || defined TEST
|
||||
#define BACAPP_PRINT_ENABLED
|
||||
#endif
|
||||
#endif
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
|
||||
/* Enable the Gateway (Routing) functionality here, if desired. */
|
||||
#if !defined(BAC_ROUTING)
|
||||
#define BAC_ROUTING 0
|
||||
#define BAC_ROUTING 1
|
||||
#endif
|
||||
#if !defined(MAX_NUM_DEVICES)
|
||||
#if BAC_ROUTING
|
||||
|
||||
@@ -81,7 +81,11 @@
|
||||
#endif
|
||||
#define datalink_cleanup bip_cleanup
|
||||
#define datalink_get_broadcast_address bip_get_broadcast_address
|
||||
#if BAC_ROUTING
|
||||
#define datalink_get_my_address routed_get_my_address
|
||||
#else
|
||||
#define datalink_get_my_address bip_get_my_address
|
||||
#endif
|
||||
|
||||
#else /* Ie, BACDL_ALL */
|
||||
#include "npdu.h"
|
||||
|
||||
@@ -319,10 +319,18 @@ extern "C" {
|
||||
int idx );
|
||||
BACNET_ADDRESS * Get_Routed_Device_Address(
|
||||
int idx );
|
||||
bool Lookup_Routed_Device_Address(
|
||||
|
||||
void routed_get_my_address(
|
||||
BACNET_ADDRESS * my_address);
|
||||
|
||||
bool Routed_Device_Address_Lookup(
|
||||
int idx,
|
||||
uint8_t address_len,
|
||||
uint8_t * mac_adress );
|
||||
bool Routed_Device_GetNext(
|
||||
BACNET_ADDRESS * dest,
|
||||
int * DNET_list,
|
||||
int * cursor );
|
||||
|
||||
uint32_t Routed_Device_Index_To_Instance(
|
||||
unsigned index);
|
||||
|
||||
Reference in New Issue
Block a user