A stack which works with or without an Mbed os library. Provides IPv4 or IPv6 with a full 1500 byte buffer.

Dependents:   oldheating gps motorhome heating

Revision:
96:43eb7a110f1a
Parent:
61:aad055f1b0d1
Child:
127:fcdfbfad8770
--- a/tcp/http/httpsend.c	Fri Dec 14 11:36:45 2018 +0000
+++ b/tcp/http/httpsend.c	Sat Dec 29 19:03:50 2018 +0000
@@ -14,3 +14,25 @@
 }
 void HttpAddData  (const char* data, int length)                                {        TcpBufAddData(data, length);                      }
 void HttpAddStream(void (*startFunction)(void), int (*enumerateFunction)(void)) {        TcpBufAddStream(startFunction, enumerateFunction);}
+void HttpAddNibbleAsHex(int nibble)
+{
+    nibble &= 0x0F;
+    char c;
+    if      (nibble < 0x0A) c = nibble + '0';
+    else if (nibble < 0x10) c = nibble - 0xA + 'A';
+    else                    c = '0';
+    HttpAddChar(c);
+}
+void HttpAddInt12AsHex(int value)
+{   
+    HttpAddNibbleAsHex(value >> 8);
+    HttpAddNibbleAsHex(value >> 4);
+    HttpAddNibbleAsHex(value >> 0);
+}
+void HttpAddInt16AsHex(int value)
+{   
+    HttpAddNibbleAsHex(value >> 12);
+    HttpAddNibbleAsHex(value >>  8);
+    HttpAddNibbleAsHex(value >>  4);
+    HttpAddNibbleAsHex(value >>  0);
+}