Removed ifdef BACFILE where no longer needed. (#1225)
This commit is contained in:
+4
-7
@@ -105,11 +105,6 @@ option(
|
||||
"build with uci"
|
||||
OFF)
|
||||
|
||||
option(
|
||||
BACFILE
|
||||
"enable bacnet file support"
|
||||
ON)
|
||||
|
||||
option(
|
||||
BACNET_BACKUP_RESTORE
|
||||
"enable backup and restore support"
|
||||
@@ -754,7 +749,6 @@ target_compile_definitions(
|
||||
$<$<BOOL:${BACNET_PROPERTY_LISTS}>:BACNET_PROPERTY_LISTS=1>
|
||||
$<$<BOOL:${BAC_ROUTING}>:BAC_ROUTING>
|
||||
$<$<BOOL:${BACNET_SEGMENTATION_ENABLED}>:BACNET_SEGMENTATION_ENABLED=1>
|
||||
$<$<BOOL:${BACFILE}>:BACFILE>
|
||||
$<$<BOOL:${BACNET_BACKUP_RESTORE}>:BACNET_BACKUP_RESTORE>
|
||||
$<$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>:BACNET_STACK_STATIC_DEFINE>
|
||||
PRIVATE
|
||||
@@ -784,6 +778,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
||||
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/linux)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC m)
|
||||
add_compile_definitions(BACNET_PORT=linux)
|
||||
add_compile_definitions(BACFILE=1)
|
||||
include_directories(ports/posix)
|
||||
|
||||
target_sources(${PROJECT_NAME} PRIVATE
|
||||
@@ -810,6 +805,7 @@ elseif(WIN32)
|
||||
message(STATUS "BACNET: building for win32")
|
||||
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/win32)
|
||||
add_compile_definitions(BACNET_PORT=win32)
|
||||
add_compile_definitions(BACFILE=1)
|
||||
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC wsock32)
|
||||
|
||||
@@ -871,6 +867,7 @@ elseif(APPLE)
|
||||
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/bsd)
|
||||
add_compile_definitions(BACNET_PORT=bsd)
|
||||
add_compile_definitions(USE_MACH_TIME)
|
||||
add_compile_definitions(BACFILE=1)
|
||||
include_directories(ports/posix)
|
||||
|
||||
target_sources(${PROJECT_NAME} PRIVATE
|
||||
@@ -916,6 +913,7 @@ elseif(${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD")
|
||||
message(STATUS "BACNET: building for FreeBSD")
|
||||
set(BACNET_PORT_DIRECTORY_PATH ${CMAKE_CURRENT_LIST_DIR}/ports/bsd)
|
||||
include_directories(ports/posix)
|
||||
add_compile_definitions(BACFILE=1)
|
||||
link_directories(/usr/lib)
|
||||
link_libraries(c)
|
||||
link_libraries(m)
|
||||
@@ -1327,4 +1325,3 @@ message(STATUS "BACNET: BACDL_ZIGBEE:...................\"${BACDL_ZIGBEE}\"")
|
||||
message(STATUS "BACNET: BACDL_ETHERNET:.................\"${BACDL_ETHERNET}\"")
|
||||
message(STATUS "BACNET: BACNET_SEGMENTATION_ENABLED:....\"${BACNET_SEGMENTATION_ENABLED}\"")
|
||||
message(STATUS "BACNET: BACNET_BACKUP_RESTORE:..........\"${BACNET_BACKUP_RESTORE}\"")
|
||||
message(STATUS "BACNET: BACFILE:........................\"${BACFILE}\"")
|
||||
|
||||
+1
-1
@@ -171,7 +171,7 @@ static void Init_Service_Handlers(uint32_t first_object_instance)
|
||||
SERVICE_CONFIRMED_WRITE_PROPERTY, handler_write_property);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_RANGE, handler_read_range);
|
||||
#if defined(BACFILE)
|
||||
#if defined BACNET_BACKUP_RESTORE
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, handler_atomic_read_file);
|
||||
apdu_set_confirmed_handler(
|
||||
|
||||
+2
-6
@@ -49,9 +49,7 @@
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
#include "bacnet/basic/object/nc.h"
|
||||
#endif /* defined(INTRINSIC_REPORTING) */
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif /* defined(BACFILE) */
|
||||
#if defined(BAC_UCI)
|
||||
#include "bacnet/basic/ucix/ucix.h"
|
||||
#endif /* defined(BAC_UCI) */
|
||||
@@ -177,14 +175,12 @@ static void Init_Service_Handlers(void)
|
||||
bactext_error_code_name(object_data.error_code));
|
||||
}
|
||||
}
|
||||
#if defined(BACFILE)
|
||||
#if defined BACNET_BACKUP_RESTORE
|
||||
/* file for backup and restore example */
|
||||
object_data.object_instance = bacfile_create(BACNET_MAX_INSTANCE);
|
||||
if (object_data.object_instance != BACNET_MAX_INSTANCE) {
|
||||
bacfile_pathname_set(object_data.object_instance, "backup_1.bin");
|
||||
#if defined(BACNET_BACKUP_RESTORE)
|
||||
Device_Configuration_File_Set(0, object_data.object_instance);
|
||||
#endif
|
||||
printf(
|
||||
"Created %s-%u path=%s for backup and restore (%u files).\n",
|
||||
bactext_object_type_name(OBJECT_FILE),
|
||||
@@ -211,7 +207,7 @@ static void Init_Service_Handlers(void)
|
||||
SERVICE_CONFIRMED_WRITE_PROP_MULTIPLE, handler_write_property_multiple);
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_READ_RANGE, handler_read_range);
|
||||
#if defined(BACFILE)
|
||||
#if defined BACNET_BACKUP_RESTORE
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, handler_atomic_read_file);
|
||||
apdu_set_confirmed_handler(
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
#include "bacnet/basic/object/nc.h"
|
||||
#endif /* defined(INTRINSIC_REPORTING) */
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif /* defined(BACFILE) */
|
||||
#if defined(BAC_UCI)
|
||||
#include "bacnet/basic/ucix/ucix.h"
|
||||
#endif /* defined(BAC_UCI) */
|
||||
|
||||
@@ -275,14 +275,10 @@ bool bacfile_posix_read_record_data(
|
||||
*/
|
||||
void bacfile_posix_init(void)
|
||||
{
|
||||
#if defined(BACFILE)
|
||||
bacfile_write_stream_data_callback_set(bacfile_posix_write_stream_data);
|
||||
bacfile_read_stream_data_callback_set(bacfile_posix_read_stream_data);
|
||||
bacfile_write_record_data_callback_set(bacfile_posix_write_record_data);
|
||||
bacfile_read_record_data_callback_set(bacfile_posix_read_record_data);
|
||||
bacfile_file_size_callback_set(bacfile_posix_file_size);
|
||||
bacfile_file_size_set_callback_set(bacfile_posix_file_size_set);
|
||||
#elif defined(BACDL_BSC)
|
||||
#error BACFILE is not defined for BACnet/SC!
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -31,9 +31,7 @@
|
||||
#include "bacnet/basic/object/mso.h"
|
||||
#include "bacnet/basic/object/msv.h"
|
||||
#include "bacnet/basic/object/program.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
#include "bacnet/basic/object/netport.h"
|
||||
#endif
|
||||
@@ -97,11 +95,9 @@ static struct my_object_functions {
|
||||
Program_Index_To_Instance, Program_Valid_Instance,
|
||||
Program_Object_Name, Program_Read_Property,
|
||||
Program_Write_Property, Program_Property_Lists},
|
||||
#if defined(BACFILE)
|
||||
{ OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance,
|
||||
bacfile_valid_instance, bacfile_object_name, bacfile_read_property,
|
||||
bacfile_write_property, BACfile_Property_Lists },
|
||||
#endif
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
{ OBJECT_NETWORK_PORT, Network_Port_Init, Network_Port_Count,
|
||||
Network_Port_Index_To_Instance, Network_Port_Valid_Instance,
|
||||
|
||||
+3
-7
@@ -38,9 +38,7 @@
|
||||
#include "bacnet/basic/object/mso.h"
|
||||
#include "bacnet/basic/object/ms-input.h"
|
||||
#include "bacnet/basic/object/trendlog.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif
|
||||
|
||||
/** Static receive buffer, initialized with zeros by the C Library Startup Code.
|
||||
*/
|
||||
@@ -164,16 +162,14 @@ static void Init_Service_Handlers(void)
|
||||
/* handle the data coming back from confirmed requests */
|
||||
apdu_set_confirmed_ack_handler(
|
||||
SERVICE_CONFIRMED_READ_PROPERTY, handler_read_property_ack);
|
||||
#if defined(BACFILE)
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, handler_atomic_read_file);
|
||||
#endif
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_SUBSCRIBE_COV, handler_cov_subscribe);
|
||||
|
||||
#if 0
|
||||
/* Adding these handlers require the project(s) to change. */
|
||||
#if defined(BACFILE)
|
||||
#if defined BACNET_BACKUP_RESTORE
|
||||
apdu_set_confirmed_handler(
|
||||
SERVICE_CONFIRMED_ATOMIC_READ_FILE, handler_atomic_read_file);
|
||||
apdu_set_confirmed_handler(SERVICE_CONFIRMED_ATOMIC_WRITE_FILE,
|
||||
handler_atomic_write_file);
|
||||
#endif
|
||||
|
||||
@@ -25,9 +25,7 @@
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#if (BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif
|
||||
#if (BACNET_PROTOCOL_REVISION >= 17)
|
||||
#include "bacnet/basic/object/netport.h"
|
||||
#endif
|
||||
|
||||
@@ -58,9 +58,7 @@
|
||||
#if defined(INTRINSIC_REPORTING)
|
||||
#include "bacnet/basic/object/nc.h"
|
||||
#endif /* defined(INTRINSIC_REPORTING) */
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif /* defined(BACFILE) */
|
||||
#include "bacnet/basic/object/bitstring_value.h"
|
||||
#include "bacnet/basic/object/csv.h"
|
||||
#include "bacnet/basic/object/iv.h"
|
||||
@@ -393,7 +391,6 @@ static object_functions_t My_Object_Table[] = {
|
||||
Color_Temperature_Create, Color_Temperature_Delete,
|
||||
Color_Temperature_Timer, Color_Temperature_Writable_Property_List },
|
||||
#endif
|
||||
#if defined(BACFILE)
|
||||
{ OBJECT_FILE, bacfile_init, bacfile_count, bacfile_index_to_instance,
|
||||
bacfile_valid_instance, bacfile_object_name, bacfile_read_property,
|
||||
bacfile_write_property, BACfile_Property_Lists,
|
||||
@@ -402,7 +399,6 @@ static object_functions_t My_Object_Table[] = {
|
||||
NULL /* Add_List_Element */, NULL /* Remove_List_Element */,
|
||||
bacfile_create, bacfile_delete, NULL /* Timer */,
|
||||
BACfile_Writable_Property_List },
|
||||
#endif
|
||||
{ OBJECT_SCHEDULE, Schedule_Init, Schedule_Count,
|
||||
Schedule_Index_To_Instance, Schedule_Valid_Instance,
|
||||
Schedule_Object_Name, Schedule_Read_Property, Schedule_Write_Property,
|
||||
@@ -887,14 +883,9 @@ static list_element_function Device_Remove_List_Element_Callback;
|
||||
#if defined BACNET_BACKUP_RESTORE
|
||||
/* number of backup files */
|
||||
#ifndef BACNET_BACKUP_FILE_COUNT
|
||||
#if defined(BACFILE)
|
||||
#define BACNET_BACKUP_FILE_COUNT 1
|
||||
#else
|
||||
#define BACNET_BACKUP_FILE_COUNT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BACNET_BACKUP_FILE_COUNT
|
||||
/* device A will read the Configuration_Files property of the Device object.
|
||||
This property will be used to determine the files to read and in what
|
||||
order the files will be read. The value of the Configuration_Files
|
||||
@@ -902,7 +893,6 @@ static list_element_function Device_Remove_List_Element_Callback;
|
||||
configuration File object references before the backup request is
|
||||
accepted by device B. */
|
||||
static uint32_t Configuration_Files[BACNET_BACKUP_FILE_COUNT];
|
||||
#endif
|
||||
/* If the restore is successful, no other actions by device A shall
|
||||
be required, and device B will update the Last_Restore_Time property
|
||||
in its Device object. */
|
||||
@@ -3087,11 +3077,9 @@ void Device_Start_Backup(void)
|
||||
property_list.Proprietary.pList, writable_properties,
|
||||
Device_Read_Property);
|
||||
if (len > 0) {
|
||||
#if defined(BACFILE)
|
||||
(void)bacfile_write_offset(
|
||||
Configuration_Files[0], offset, &object_apdu[0],
|
||||
(uint32_t)len);
|
||||
#endif
|
||||
offset += len;
|
||||
}
|
||||
}
|
||||
@@ -3118,14 +3106,10 @@ void Device_Start_Restore(void)
|
||||
bacapp_timestamp_datetime_set(&Last_Restore_Time, &bdateTime);
|
||||
Backup_State = BACKUP_STATE_PREPARING_FOR_RESTORE;
|
||||
/* create objects from the backup file */
|
||||
#if defined(BACFILE)
|
||||
file_size = bacfile_file_size(Configuration_Files[0]);
|
||||
#endif
|
||||
while (offset < file_size) {
|
||||
#if defined(BACFILE)
|
||||
apdu_len = bacfile_read_offset(
|
||||
Configuration_Files[0], offset, &apdu[0], sizeof(apdu));
|
||||
#endif
|
||||
if (apdu_len > 0) {
|
||||
decoded_len = create_object_decode_service_request(
|
||||
apdu, apdu_len, &create_data);
|
||||
|
||||
@@ -37,9 +37,7 @@
|
||||
#include "bacnet/basic/object/mso.h"
|
||||
#include "bacnet/basic/object/ms-input.h"
|
||||
#include "bacnet/basic/object/trendlog.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h" /* object list dependency */
|
||||
#endif
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
/* os specific includes */
|
||||
#include "bacnet/basic/sys/mstimer.h"
|
||||
|
||||
|
||||
@@ -23,9 +23,7 @@
|
||||
#include "bacnet/basic/binding/address.h"
|
||||
#include "bacnet/basic/object/trendlog.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h" /* object list dependency */
|
||||
#endif
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
|
||||
/* number of demo objects */
|
||||
#ifndef MAX_TREND_LOGS
|
||||
|
||||
@@ -1266,14 +1266,9 @@ static uint32_t Interval_Offset_Minutes;
|
||||
#if defined BACNET_BACKUP_RESTORE
|
||||
/* number of backup files */
|
||||
#ifndef BACNET_BACKUP_FILE_COUNT
|
||||
#if defined(BACFILE)
|
||||
#define BACNET_BACKUP_FILE_COUNT 1
|
||||
#else
|
||||
#define BACNET_BACKUP_FILE_COUNT 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if BACNET_BACKUP_FILE_COUNT
|
||||
/* device A will read the Configuration_Files property of the Device object.
|
||||
This property will be used to determine the files to read and in what
|
||||
order the files will be read. The value of the Configuration_Files
|
||||
@@ -1281,7 +1276,6 @@ static uint32_t Interval_Offset_Minutes;
|
||||
configuration File object references before the backup request is
|
||||
accepted by device B. */
|
||||
static uint32_t Configuration_Files[BACNET_BACKUP_FILE_COUNT];
|
||||
#endif
|
||||
/* If the restore is successful, no other actions by device A shall
|
||||
be required, and device B will update the Last_Restore_Time property
|
||||
in its Device object. */
|
||||
@@ -3410,11 +3404,9 @@ void Device_Start_Backup(void)
|
||||
property_list.Proprietary.pList, writable_properties,
|
||||
Device_Read_Property);
|
||||
if (len > 0) {
|
||||
#if defined(BACFILE)
|
||||
(void)bacfile_write_offset(
|
||||
Configuration_Files[0], offset, &object_apdu[0],
|
||||
(uint32_t)len);
|
||||
#endif
|
||||
offset += len;
|
||||
}
|
||||
}
|
||||
@@ -3441,14 +3433,10 @@ void Device_Start_Restore(void)
|
||||
bacapp_timestamp_datetime_set(&Last_Restore_Time, &bdateTime);
|
||||
Backup_State = BACKUP_STATE_PREPARING_FOR_RESTORE;
|
||||
/* create objects from the backup file */
|
||||
#if defined(BACFILE)
|
||||
file_size = bacfile_file_size(Configuration_Files[0]);
|
||||
#endif
|
||||
while (offset < file_size) {
|
||||
#if defined(BACFILE)
|
||||
apdu_len = bacfile_read_offset(
|
||||
Configuration_Files[0], offset, &apdu[0], sizeof(apdu));
|
||||
#endif
|
||||
if (apdu_len > 0) {
|
||||
decoded_len = create_object_decode_service_request(
|
||||
apdu, apdu_len, &create_data);
|
||||
|
||||
@@ -20,9 +20,7 @@
|
||||
#include "bacnet/reject.h"
|
||||
#include "bacnet/arf.h"
|
||||
/* basic objects, services, TSM, and datalink */
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
@@ -79,7 +77,6 @@ last octet or record of the file, then the 'End Of File' parameter
|
||||
shall be TRUE, otherwise FALSE.
|
||||
*/
|
||||
|
||||
#if defined(BACFILE)
|
||||
void handler_atomic_read_file(
|
||||
uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
@@ -196,4 +193,3 @@ ARF_ABORT:
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -14,9 +14,7 @@
|
||||
#include "bacnet/npdu.h"
|
||||
#include "bacnet/apdu.h"
|
||||
#include "bacnet/arf.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif
|
||||
/* basic objects, services, TSM, and datalink */
|
||||
#include "bacnet/basic/object/device.h"
|
||||
#include "bacnet/basic/tsm/tsm.h"
|
||||
@@ -27,7 +25,6 @@
|
||||
/* Note: it does not have to be the same file=instance */
|
||||
/* that someone can read from us. It is common to */
|
||||
/* use the description as the file name. */
|
||||
#if defined(BACFILE)
|
||||
void handler_atomic_read_file_ack(
|
||||
uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
@@ -54,4 +51,3 @@ void handler_atomic_read_file_ack(
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -26,9 +26,7 @@
|
||||
#include "bacnet/basic/services.h"
|
||||
#include "bacnet/basic/sys/debug.h"
|
||||
#include "bacnet/datalink/datalink.h"
|
||||
#if defined(BACFILE)
|
||||
#include "bacnet/basic/object/bacfile.h"
|
||||
#endif
|
||||
|
||||
/*
|
||||
from BACnet SSPC-135-2004
|
||||
@@ -59,7 +57,6 @@ of the BACnet device is a local matter and is not defined by this
|
||||
standard.
|
||||
*/
|
||||
|
||||
#if defined(BACFILE)
|
||||
void handler_atomic_write_file(
|
||||
uint8_t *service_request,
|
||||
uint16_t service_len,
|
||||
@@ -161,4 +158,3 @@ AWF_ABORT:
|
||||
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -36,6 +36,7 @@ add_executable(${PROJECT_NAME}
|
||||
# Support files and stubs (pathname alphabetical)
|
||||
${SRC_DIR}/bacnet/abort.c
|
||||
${SRC_DIR}/bacnet/access_rule.c
|
||||
${SRC_DIR}/bacnet/arf.c
|
||||
${SRC_DIR}/bacnet/assigned_access_rights.c
|
||||
${SRC_DIR}/bacnet/authentication_factor.c
|
||||
${SRC_DIR}/bacnet/authentication_factor_format.c
|
||||
@@ -65,6 +66,7 @@ add_executable(${PROJECT_NAME}
|
||||
${SRC_DIR}/bacnet/basic/object/ao.c
|
||||
${SRC_DIR}/bacnet/basic/object/auditlog.c
|
||||
${SRC_DIR}/bacnet/basic/object/av.c
|
||||
${SRC_DIR}/bacnet/basic/object/bacfile.c
|
||||
${SRC_DIR}/bacnet/basic/object/bi.c
|
||||
${SRC_DIR}/bacnet/basic/object/bitstring_value.c
|
||||
${SRC_DIR}/bacnet/basic/object/blo.c
|
||||
|
||||
Reference in New Issue
Block a user