Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of libMiMic by
mbed/Httpd.cpp
- Committer:
- nyatla
- Date:
- 2013-07-11
- Revision:
- 45:63d6aa80e26d
- Parent:
- 19:33b9ba0859ee
- Child:
- 46:61edfd4b16ee
File content as of revision 45:63d6aa80e26d:
#include "Httpd.h"
#include "HttpdConnection.h"
namespace MiMic
{
char Httpd::_shared_buf[SIZE_OF_HTTP_BUF];
void Httpd::onRequestHandler(NyLPC_TcHttpdConnection_t* i_connection)
{
HttpdConnection c(i_connection);
((struct Httpd2*)(i_connection->_parent_httpd))->_parent->onRequest(c);
}
Httpd::Httpd(int i_port_number)
{
NyLPC_cHttpd_initialize((NyLPC_TcHttpd_t*)(&this->_inst),(NyLPC_TUInt16)i_port_number);
this->_inst._parent=this;
this->_inst.super.function.onRequest=onRequestHandler;
}
Httpd::~Httpd()
{
NyLPC_cHttpd_finalize((NyLPC_TcHttpd_t*)(&this->_inst));
}
void Httpd::loop()
{
NyLPC_cHttpd_loop((NyLPC_TcHttpd_t*)(&this->_inst));
}
void Httpd::lock()
{
NyLPC_cHttpd_lock((NyLPC_TcHttpd_t*)(&this->_inst));
}
void Httpd::unlock()
{
NyLPC_cHttpd_unlock((NyLPC_TcHttpd_t*)(&this->_inst));
}
void Httpd::loopTask()
{
NyLPC_TcThread_t* th=(NyLPC_TcThread_t*)malloc(sizeof(NyLPC_TcThread_t));
NyLPC_cThread_initialize(th,256,NyLPC_TcThread_PRIORITY_IDLE);
NyLPC_cThread_start(th,Httpd::taskHandler,&(this->_inst));
}
int Httpd::taskHandler(void* i_param)
{
NyLPC_cHttpd_loop((NyLPC_TcHttpd_t*)i_param);
}
}
