diff options
| author | kutayboz <kutayboz@gmail.com> | 2023-08-03 17:44:37 +0300 |
|---|---|---|
| committer | kutayboz <kutayboz@gmail.com> | 2023-08-03 17:44:37 +0300 |
| commit | 5d48f1280612b2f525c9a2d60f96434f1a217156 (patch) | |
| tree | 24443e33c6feb0dd581577efece1a278cc2549d0 /include | |
| parent | cd38d7c7d4710159b86ca5ed1557b46bba41d2ca (diff) | |
| download | celnetmon-1.0.0.tar.gz | |
Finished cfg file implementation. Preliminary readme. v1.0.0v1.0.0
Diffstat (limited to 'include')
| -rw-r--r-- | include/bg96.h | 28 | ||||
| -rw-r--r-- | include/utils.h | 19 |
2 files changed, 30 insertions, 17 deletions
diff --git a/include/bg96.h b/include/bg96.h index 3a8b762..17f885d 100644 --- a/include/bg96.h +++ b/include/bg96.h @@ -1,6 +1,7 @@ #ifndef __INCLUDE_BG96__ #define __INCLUDE_BG96__ +#include "utils.h" #include <time.h> typedef struct networkDataTag { @@ -10,35 +11,34 @@ typedef struct networkDataTag { struct tm netTime; } networkData; -int modemPowerToggle(char *pathToChip, int pinNum); +int modemPowerToggle(listCfgData cfgData, int pinNum); int initNetworkData(networkData *nD); int freeNetworkData(networkData *nD); -int powerOn(char *pathToPort, char *pathToChip, int statusPin, int pwrKeyPin); +int powerOn(listCfgData cfgData); -int powerOff(char *pathToPort, char *pathToChip, int statusPin, int pwrKeyPin); +int powerOff(listCfgData cfgData); -int configureNetwork(char *pathToPort); +int configureNetwork(listCfgData cfgData); -int cfg6GTN(char *pathToPort); +int cfg6GTN(listCfgData cfgData); -int defineNetworkDetails(char *pathToPort/* , int waitTimeSeconds */); +int defineNetworkDetails(listCfgData cfgData); -int waitForNetwork(char *pathToPort, int waitTimeSeconds); +int waitForNetwork(listCfgData cfgData, int waitTimeSeconds); -int mqttDisc(char *pathToPort); +int mqttDisc(listCfgData cfgData); -int mqttConn(char *pathToPort, char *hostURL, int hostPort, char *username, - char *password); +int mqttConn(listCfgData cfgData); -int mqttPubNetData(char *pathToPort, networkData nD); +int mqttPubNetData(listCfgData cfgData, networkData nD); -int gatherData(networkData *output, char *pathToPort); +int gatherData(networkData *output, listCfgData cfgData); -int initGNSS(char *pathToPort); +int initGNSS(listCfgData cfgData); -int stopGNSS(char *pathToPort); +int stopGNSS(listCfgData cfgData); #endif 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 |
