diff options
author | Ian C <ianc@noddybox.co.uk> | 2024-12-26 19:05:07 +0000 |
---|---|---|
committer | Ian C <ianc@noddybox.co.uk> | 2024-12-26 19:05:07 +0000 |
commit | aa33cb940bb31c74903fb7dc26e5d2f264064911 (patch) | |
tree | b9c5603ad71080b4f23a6b0473b33160e039f058 /wifi.h | |
parent | 80b1b51911e8c4221e918b50039caf7533751e4c (diff) |
Dev check in. Added tester.
Diffstat (limited to 'wifi.h')
-rw-r--r-- | wifi.h | 39 |
1 files changed, 29 insertions, 10 deletions
@@ -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 <stdarg.h> + +/* 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 |