From 5d48f1280612b2f525c9a2d60f96434f1a217156 Mon Sep 17 00:00:00 2001 From: kutayboz Date: Thu, 3 Aug 2023 17:44:37 +0300 Subject: Finished cfg file implementation. Preliminary readme. v1.0.0 --- include/utils.h | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'include/utils.h') diff --git a/include/utils.h b/include/utils.h index 06c48e6..2a32a54 100644 --- a/include/utils.h +++ b/include/utils.h @@ -5,14 +5,26 @@ enum { /* Mandatory */ PATH_TO_SERIAL_PORT_POS, PATH_TO_GPIO_CHIP_POS, + MQTT_URL_POS, + NETWORK_APN_POS, /* Optional */ + MQTT_USERNAME_POS, + MQTT_PASSWORD_POS, + MQTT_ROOT_TOPIC_POS, NETWORK_USERNAME_POS, NETWORK_PASSWORD_POS, NETWORK_AUTH_POS, STR_LIST_LENGTH }; -enum { PIN_PWR_KEY_POS, PIN_STATUS_POS, INT_LIST_LENGTH }; +enum { /*Mandatory */ + PIN_PWR_KEY_POS, + PIN_STATUS_POS, + MQTT_PORT_POS, + /* Optional */ + NETWORK_OPERATOR_POS, + INT_LIST_LENGTH +}; typedef struct { char *name; @@ -24,6 +36,7 @@ typedef struct { int value; } intData; +/* Initialize this with NULL and 0 values. */ typedef struct { strData *strDataList; intData *intDataList; @@ -41,8 +54,8 @@ network_username = "something something" network_password = "something something" network_auth = "something something" */ -int readCfg(listCfgData dataCfg, const char *pathExe); +int readCfg(listCfgData *cfgData, const char *pathExe); -int freeCfgData(listCfgData cfgData); +int freeCfgData(listCfgData *cfgData); #endif -- cgit v1.3