From aa33cb940bb31c74903fb7dc26e5d2f264064911 Mon Sep 17 00:00:00 2001 From: Ian C Date: Thu, 26 Dec 2024 19:05:07 +0000 Subject: Dev check in. Added tester. --- wifi.h | 39 +++++++++++++++++++++++++++++---------- 1 file changed, 29 insertions(+), 10 deletions(-) (limited to 'wifi.h') diff --git a/wifi.h b/wifi.h index b0b184a..9a8ee71 100644 --- a/wifi.h +++ b/wifi.h @@ -26,23 +26,42 @@ #ifndef DOTDLOAD_WIFI_H #define DOTDLOAD_WIFI_H -/* Connect to the wifi modem and return true if connection is successful. - If the connection fails diagnostics will be printed to stderr. +#include + +/* Status type +*/ +typedef enum +{ + eWifiOK, + eWifiNotAvailable, + eWifiNotConnected, + eWifiUnknownHost, + eWifiFailedToWrite, + eWifiFailedToReceive, + eWifiTimeout, + eWifiInvalidURL +} WifiStatus; + +/* Connect to the wifi modem and return status. +*/ +WifiStatus WifiConnect(void); + +/* Connect to a URL. Returns status. */ -int WifiConnect(void); +WifiStatus ConnectURL(const char *method, const char *url); -/* Connect to a URL. Returns true if the connection is made. +/* Sends a formatted string to the connection. Returns status. */ -int ConnectURL(const char *url); +WifiStatus SendFormatted(const char *format, ...); -/* Send a byte to the connection. Returns true if no errors. +/* Send a byte to the connection. Returns status. */ -int SendByte(unsigned char c); +WifiStatus SendByte(unsigned char c); -/* Get a byte from the connection. Returns true if no errors and updates the - passed pointer. +/* Get a byte from the connection. Returns status and updates the passed + pointer. */ -int GetByte(unsigned char *c); +WifiStatus GetByte(unsigned char *c); #endif -- cgit v1.2.3