Change uci device_init from src to apps. it is more maintainable. (#219)
* Change uci device_init from src/bacnet/basic/object/device to apps/server to make it more maintainable Signed-off-by: Patrick Grimm <patrick@lunatiki.de>
This commit is contained in:
+20
-3
@@ -226,7 +226,6 @@ int main(int argc, char *argv[])
|
||||
if (!ctx)
|
||||
fprintf(stderr, "Failed to load config file bacnet_dev\n");
|
||||
uciId = ucix_get_option_int(ctx, "bacnet_dev", "0", "Id", 0);
|
||||
printf("ID: %i", uciId);
|
||||
if (uciId != 0) {
|
||||
Device_Set_Object_Instance_Number(uciId);
|
||||
} else {
|
||||
@@ -250,9 +249,27 @@ int main(int argc, char *argv[])
|
||||
in our device bindings list */
|
||||
address_init();
|
||||
Init_Service_Handlers();
|
||||
if (argc > 2) {
|
||||
Device_Object_Name_ANSI_Init(argv[2]);
|
||||
#if defined(BAC_UCI)
|
||||
const char *uciname;
|
||||
ctx = ucix_init("bacnet_dev");
|
||||
if (!ctx)
|
||||
fprintf(stderr, "Failed to load config file bacnet_dev\n");
|
||||
uciname = ucix_get_option(ctx, "bacnet_dev", "0", "Name");
|
||||
if (uciname != 0) {
|
||||
Device_Object_Name_ANSI_Init(uciname);
|
||||
} else {
|
||||
#endif /* defined(BAC_UCI) */
|
||||
if (argc > 2) {
|
||||
Device_Object_Name_ANSI_Init(argv[2]);
|
||||
}
|
||||
#if defined(BAC_UCI)
|
||||
}
|
||||
ucix_cleanup(ctx);
|
||||
#endif /* defined(BAC_UCI) */
|
||||
BACNET_CHARACTER_STRING DeviceName;
|
||||
if (Device_Object_Name(Device_Object_Instance_Number(),&DeviceName))
|
||||
printf("BACnet Device Name: %s\n", DeviceName.value);
|
||||
|
||||
dlenv_init();
|
||||
atexit(datalink_cleanup);
|
||||
/* configure the timeout values */
|
||||
|
||||
@@ -75,9 +75,6 @@
|
||||
#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) */
|
||||
|
||||
/* local forward (semi-private) and external prototypes */
|
||||
int Device_Read_Property_Local(BACNET_READ_PROPERTY_DATA *rpdata);
|
||||
@@ -1805,23 +1802,7 @@ bool Device_Value_List_Supported(BACNET_OBJECT_TYPE object_type)
|
||||
void Device_Init(object_functions_t *object_table)
|
||||
{
|
||||
struct object_functions *pObject = NULL;
|
||||
#if defined(BAC_UCI)
|
||||
const char *uciname;
|
||||
struct uci_context *ctx;
|
||||
fprintf(stderr, "Device_Init\n");
|
||||
ctx = ucix_init("bacnet_dev");
|
||||
if (!ctx)
|
||||
fprintf(stderr, "Failed to load config file bacnet_dev\n");
|
||||
uciname = ucix_get_option(ctx, "bacnet_dev", "0", "Name");
|
||||
if (uciname != 0) {
|
||||
characterstring_init_ansi(&My_Object_Name, uciname);
|
||||
} else {
|
||||
#endif /* defined(BAC_UCI) */
|
||||
characterstring_init_ansi(&My_Object_Name, "SimpleServer");
|
||||
#if defined(BAC_UCI)
|
||||
}
|
||||
ucix_cleanup(ctx);
|
||||
#endif /* defined(BAC_UCI) */
|
||||
characterstring_init_ansi(&My_Object_Name, "SimpleServer");
|
||||
datetime_init();
|
||||
if (object_table) {
|
||||
Object_Table = object_table;
|
||||
|
||||
Reference in New Issue
Block a user