From 15b34952c44f19e6e31d81096c6ee43b6f1a201d Mon Sep 17 00:00:00 2001 From: kutayboz Date: Mon, 12 Jun 2023 00:16:46 +0300 Subject: Working MQTT publishing --- include/bg96.h | 9 +++++---- include/serial.h | 6 ++++-- 2 files changed, 9 insertions(+), 6 deletions(-) (limited to 'include') diff --git a/include/bg96.h b/include/bg96.h index 116b4ab..b304479 100644 --- a/include/bg96.h +++ b/include/bg96.h @@ -5,12 +5,13 @@ int powerOn(char *pathToPort, char *pathToChip, int statusPin, int pwrKeyPin); int powerOff(char *pathToPort, char *pathToChip, int statusPin, int pwrKeyPin); -int setupPublicConnection(char *pathToPort); +int cfgPublicNetwork(char *pathToPort); -int waitForConnection(char *pathToPort, int waitTimeSeconds); +int waitForNetwork(char *pathToPort, int waitTimeSeconds); -int tcpipInit(char *pathToPort); +int mqttDisc(char *pathToPort); -int tcpipClose(char *pathToPort); +int mqttConn(char *pathToPort, char *hostURL, int hostPort, char *username, + char *password); #endif diff --git a/include/serial.h b/include/serial.h index ccf0c6e..033fd54 100644 --- a/include/serial.h +++ b/include/serial.h @@ -1,9 +1,11 @@ #ifndef __INCLUDE_SERIAL__ #define __INCLUDE_SERIAL__ +typedef enum { SUCCESS, ERROR_READ, ERROR_TIMEOUT } SERIAL_RETURN_CODE; + int openSerialPort(char pathToPort[]); -int querySerialPort(char **output, int serialPort, char *input, - int timeoutSeconds); +SERIAL_RETURN_CODE querySerialPort(char **output, int serialPort, char *input, + int timeoutSeconds, char *lastLineSubStr); #endif -- cgit v1.3