Host library for controlling a WiConnect enabled Wi-Fi module.

Dependents:   wiconnect-ota_example wiconnect-web_setup_example wiconnect-test-console wiconnect-tcp_server_example ... more

Revision:
0:ea85c4bb5e1f
Child:
1:6ec9998427ad
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SocketInterface.h	Mon Aug 11 09:58:24 2014 +0000
@@ -0,0 +1,54 @@
+/*
+ * Copyright 2014, ACKme Networks
+ * All Rights Reserved.
+ *
+ * This is UNPUBLISHED PROPRIETARY SOURCE CODE of ACKme Networks;
+ * the contents of this file may not be disclosed to third parties, copied
+ * or duplicated in any form, in whole or in part, without the prior
+ * written permission of ACKme Networks.
+ */
+
+#pragma once
+
+#include "Wiconnect.h"
+#include "types/Socket.h"
+#include "types/SocketIrqHandlerMap.h"
+
+
+namespace wiconnect {
+
+
+#define SOCKET_ANY_PORT (uint16_t)0
+
+
+
+class SocketInterface
+{
+public:
+    SocketInterface(Wiconnect *wiconnect);
+    ~SocketInterface();
+
+    WiconnectResult closeAllSockets();
+    WiconnectResult registerSocketIrqHandler(Pin irqPin, const Callback &handler);
+    WiconnectResult unregisterSocketIrqHandler(Pin irqPin);
+
+    WiconnectResult connect(Socket &socket, SocketType type, const char *host, uint16_t remortPort, uint16_t localPort, const void *args, Pin irqPin);
+    WiconnectResult tcpConnect(Socket &socket, const char *host, uint16_t remortPort, Pin irqPin = NC);
+    WiconnectResult tlsConnect(Socket &socket, const char *host, uint16_t remortPort, const char *certFilename = NULL, Pin irqPin = NC);
+    WiconnectResult udpConnect(Socket &socket, const char *host, uint16_t remortPort, uint16_t localPort = SOCKET_ANY_PORT, Pin irqPin = NC);
+    WiconnectResult httpConnect(Socket &socket, const char *url, const HttpSocketArgs *args);
+    WiconnectResult httpGet(Socket &socket, const char *url, bool openOnly = false, const char *certFilename = NULL);
+    WiconnectResult httpPost(Socket &socket, const char *url, const char *contextType, bool openOnly = true, const char *certFilename = NULL);
+    WiconnectResult httpHead(Socket &socket, const char *url, const char *certFilename = NULL);
+    WiconnectResult httpAddHeader(Socket &socket, const char *key, const char *value);
+    WiconnectResult httpGetStatus(Socket &socket, uint32_t *statusCodePtr);
+
+protected:
+    SocketIrqHandlerMap irqHandlers;
+
+private:
+    Wiconnect *wiconnect;
+};
+
+}
+