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.
HTTP_SERVER.h
- Committer:
- mmdonatti
- Date:
- 2021-08-06
- Revision:
- 3:820e3a42c06b
- Parent:
- 2:7a49ed074968
File content as of revision 3:820e3a42c06b:
//HTTP_SERVER.h #ifndef HTTP_SERVER_H #define HTTP_SERVER_H #include "EthernetInterface.h" #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 { TCP_PORT = 80 }; /** HttpServer class * * This is the class to make a mbed a simple HTTP Server. */ class HttpServer { public: HttpServer(); ~HttpServer(); /** HTTP SERVER Initialization. * * This function should be called first of all. * @return result of init() as boolean. * @retval TRUE SACCESS * @retval FALSE */ 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,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