summaryrefslogtreecommitdiff
path: root/wifi.h
diff options
context:
space:
mode:
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