summaryrefslogtreecommitdiff
path: root/wifi.h
diff options
context:
space:
mode:
authorIan C <ianc@noddybox.co.uk>2024-12-26 19:05:07 +0000
committerIan C <ianc@noddybox.co.uk>2024-12-26 19:05:07 +0000
commitaa33cb940bb31c74903fb7dc26e5d2f264064911 (patch)
treeb9c5603ad71080b4f23a6b0473b33160e039f058 /wifi.h
parent80b1b51911e8c4221e918b50039caf7533751e4c (diff)
Dev check in. Added tester.
Diffstat (limited to 'wifi.h')
-rw-r--r--wifi.h39
1 files changed, 29 insertions, 10 deletions
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 <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