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:
Patrick Grimm
2022-01-29 23:08:08 +01:00
committed by GitHub
parent 295f127c2b
commit 5daa34dae3
2 changed files with 21 additions and 23 deletions
+20 -3
View File
@@ -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 */