LNLS Driver Heaters DCM Firmware with two sockets: - HTTP server at port 80 - TCP socket at port 5757 for EPICS

Dependencies:   mbed mbed-rtos AMC7812B EthernetInterface TextLCD

Firmware for DCM heaters driver - 8 channel, 12V/1.5A, PWM controlled with interlock and failure diagnostics

Mauricio Martins Donatti

Brazilian Synchrotron Light Laboratory

Electronics Support Group - GAE

mauricio.donatti@lnls.br

Extra scripts on Github page:

1. Driver_DCM_Socket.py: Open a socket and comunicate with the Driver.

2. Find_IP.py: Search a subdomain for devices (IPs) with a TCP Server Socket on the specified port.

3. firmware.txt: device firmware link (MBED).

4. index.html: HTTP server GET answer - html + JS.

Revision:
3:820e3a42c06b
Parent:
2:7a49ed074968
--- a/HTTP_SERVER.h	Mon Apr 26 11:22:48 2021 +0000
+++ b/HTTP_SERVER.h	Fri Aug 06 13:07:37 2021 +0000
@@ -6,8 +6,17 @@
 #include "definitions.h"
 #include "string.h"
 
+//Debug interface
+#ifdef HTTP_DEBUG
+    #define HTTP_PRINTF(fmt, ...)      printf("HTTP: " fmt "\r\n", ##__VA_ARGS__)
+
+#else
+    #define HTTP_PRINTF(fmt,...)       __NOP()
+#endif
+
 #define MAX_BUFFER_SIZE 1024
 
+
 using namespace std;
 
 enum PortNum {
@@ -29,18 +38,34 @@
      *  @retval TRUE SACCESS
      *  @retval FALSE
      */
-    bool init();
+    bool init(char *html_pointer,int html_len);
     /** Run the surver service while listening flag is true.
      *
      *  @return state ending.
      *  @retval TRUE at error end.
      *  @retval FALSE at normal end.
      */
-    bool run(channel *CH);
+    bool run(channel *CH,char* name);
 
     //  Handlers
     TCPSocketServer     tcpsvr; //  TCP server
     TCPSocketConnection tcpcon; //  TCP server connection clerk
+    
+private:
+    //HTML file - with Javascript
+    char *index_html;
+    int index_html_len; //index with html length
+        
+    char* httpmethod;
+    char* filepath;
+    char* http_ver;
+    
+    char buffer[MAX_BUFFER_SIZE];   //receive and transmit buffer
+    char tmp_buffer[200];           //aux buffer
+    int status_code;                //http status code
+    char reason_phrase[30];         //http reason phrase
+    
+    int i;                 //index buffer
 };
 
 #endif
\ No newline at end of file