This is Webservice SDK for mbed. LPCXpresso1769/LPC1768/FRDM-K64F/LPC4088
Fork of libMiMic by
Diff: mbed/HttpdConnection.cpp
- Revision:
- 17:f29e1ca90e3d
- Parent:
- 7:2b33a8d84eb3
- Child:
- 18:1970fec78229
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/mbed/HttpdConnection.cpp Fri Apr 26 05:26:34 2013 +0000 @@ -0,0 +1,49 @@ +#include "HttpdConnection.h" +namespace MiMic +{ + HttpdConnection::HttpdConnection(NyLPC_TcHttpdConnection* i_ref_inst) + { + this->_ref_inst=i_ref_inst; + } + bool HttpdConnection::sendHeader(unsigned short i_status_code,const char* i_content_type,const char* i_additional_header) + { + return NyLPC_TBool_TRUE==NyLPC_cHttpdConnection_sendResponseHeader(this->_ref_inst,i_status_code,i_content_type,i_additional_header); + } + bool HttpdConnection::sendHeader(unsigned short i_status_code,const char* i_content_type,const char* i_additional_header,unsigned int i_length) + { + return NyLPC_TBool_TRUE==NyLPC_cHttpdConnection_sendResponseHeader2(this->_ref_inst,i_status_code,i_content_type,i_length,i_additional_header); + } + bool HttpdConnection::sendBody(const void* i_data,NyLPC_TUInt32 i_size) + { + return NyLPC_TBool_TRUE==NyLPC_cHttpdConnection_sendResponseBody(this->_ref_inst,i_data,i_size); + } + bool HttpdConnection::sendBodyF(const char* i_fmt,...) + { + va_list a; + if(this->_ref_inst->_res_status!=NyLPC_cHttpdConnection_ResStatus_BODY) + { + NyLPC_OnErrorGoto(Error); + } + //Bodyの書込み + va_start(a,i_fmt); + if(!NyLPC_cHttpBodyWriter_formatV(&(this->_ref_inst->_body_writer),i_fmt,a)){ + NyLPC_OnErrorGoto(Error_Send); + } + va_end(a); + return true; + Error_Send: + va_end(a); + NyLPC_cHttpBodyWriter_finalize(&(this->_ref_inst->_in_stream)); + Error: + this->_ref_inst->_res_status=NyLPC_cHttpdConnection_ResStatus_ERROR; + return false; + } + void HttpdConnection::lockHttpd() + { + NyLPC_cHttpdConnection_lock(this->_ref_inst); + } + void HttpdConnection::releaseHttpd() + { + NyLPC_cHttpdConnection_unlock(this->_ref_inst); + } +} \ No newline at end of file