gs fan / GSwifi_old

Fork of GSwifi_old by gs fan

Revision:
23:a783c62c36d0
Parent:
22:9b077e2823ce
Child:
24:5c350ae2e703
--- a/GSwifi.h	Wed Dec 26 08:41:43 2012 +0000
+++ b/GSwifi.h	Mon Jan 21 05:58:28 2013 +0000
@@ -37,6 +37,19 @@
 #define GS_DATA_SIZE 500
 #endif
 
+#ifdef GS_UART_DIRECT
+#if defined(TARGET_LPC1768) || defined(TARGET_LPC2368)
+#define _gs_getc() LPC_UART1->RBR
+#define _gs_putc(c) while(!(LPC_UART1->LSR & (1<<5))); LPC_UART1->THR = c
+#elif defined(TARGET_LPC11U24)
+#define _gs_getc() LPC_USART->RBR
+#define _gs_putc(c) while(!(LPC_USART->LSR & (1<<5))); LPC_USART->THR = c
+#endif
+#else
+#define _gs_getc() _gs.getc()
+#define _gs_putc(c) _gs.putc(c)
+#endif
+
 /**
  * Wi-Fi security
  */
@@ -72,6 +85,7 @@
 };
 
 enum GSRESPONCE {
+    GSRES_NONE,
     GSRES_NORMAL,
     GSRES_CONNECT,
     GSRES_WPS,
@@ -361,6 +375,9 @@
      * attach uri to cgi handler
      */
     int attach_httpd (const char *uri, onHttpdCgiFunc ponHttpCgi);
+#ifdef GS_USE_WEBSOCKET
+    int send_websocket (int cid, const char *buf, int len);
+#endif
 #endif
 
     /**
@@ -385,6 +402,7 @@
     int urldecode (char *str, char *buf, int len);
 
 #ifdef DEBUG
+    void dump ();
     void test ();
     int getc();
     void putc(char c);
@@ -405,8 +423,10 @@
 #endif
 
 #ifdef GS_USE_HTTPD
+    int get_handler (char *uri);
     int httpd_request (int cid, GS_httpd *gshttpd, char *dir);
     char *mimetype (char *file);
+    int strnicmp (char *p1, char *p2, int n);
 #endif
 
 private:
@@ -415,7 +435,7 @@
     volatile bool _connect;
     volatile GSSTATUS _status;
     volatile int _gs_ok, _gs_failure, _gs_enter;
-    volatile int _response;
+    volatile GSRESPONCE _response;
     GSMODE _gs_mode;
     int _escape;
     int _cid, _rssi;
@@ -432,6 +452,10 @@
     int _handler_count;
 
     void poll_httpd (int cid, int len);
+#ifdef GS_USE_WEBSOCKET
+    void poll_websocket (int cid, int len);
+    void send_websocket_accept (int cid);
+#endif
 #endif
 };