Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #define DEVICE_NAME_MAX_LENGTH 10
- #define DEVICE_SERIAL_MAX_LENGTH 20
- typedef struct
- {
- struct
- {
- char name[DEVICE_NAME_MAX_LENGTH + 1];
- char serial[DEVICE_SERIAL_MAX_LENGTH + 1];
- }
- device;
- struct
- {
- uint32_t levelMask;
- uint32_t outputMask;
- }
- syslog;
- struct
- {
- }
- dvr;
- struct
- {
- struct
- {
- struct
- {
- }
- courier;
- struct
- {
- }
- client;
- }
- process;
- }
- scl;
- }
- MainConfig_t;
- typedef struct
- {
- char* jsonDescriptor;
- uint32_t structPosition;
- uint32_t flashPosition;
- uint32_t size;
- void* def;
- }
- MainConfigEntry_t;
- const MainConfigEntry_t MainConfigDescriptor[] =
- {
- {"device.name", offsetof(MainConfig_t, device.name), 128, DEVICE_NAME_MAX_LENGTH + 1, (void*)"DEF_NAME"},
- {"device.serial", offsetof(MainConfig_t, device.serial), 128, DEVICE_SERIAL_MAX_LENGTH + 1, (void*)"DEF_NAME"},
- {"syslog.levelMask", offsetof(MainConfig_t, syslog.levelMask), 128, sizeof(uint32_t), (void*)(LOG_LVL_INFO | LOG_LVL_WARN | LOG_LVL_ERR)},
- {"syslog.outputMask", offsetof(MainConfig_t, syslog.outputMask), 0xFFFFFFFF, sizeof(uint32_t), (void*)(LOG_LVL_INFO | LOG_LVL_WARN | LOG_LVL_ERR)},
- };
- void MainConfigLoad(void)
- {
- //...
- }
- MainConfig_t MainConfig;
- void ExampleFunction(void)
- {
- printf("MachineName: %s", MainConfig.device.name);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement