mbedConnectorInterface back port from mbedOS v3 using mbed-client C++ call interface
Diff: source/DynamicResource.cpp
- Revision:
- 24:c92984bede9c
- Parent:
- 21:0bbe9057e7b1
--- a/source/DynamicResource.cpp Sat Jun 11 02:34:34 2016 +0000 +++ b/source/DynamicResource.cpp Sun Jun 12 02:49:50 2016 +0000 @@ -241,9 +241,15 @@ #else // POST() check if ((op & M2MBase::POST_ALLOWED) != 0) { - string value = this->coapDataToString(this->m_res->value(),this->m_res->value_length()); - this->logger()->log("%s: Calling resource(POST) with [%s]=[%s]",this->m_res_type.c_str(),this->getFullName().c_str(),value.c_str()); - this->post((void *)value.c_str()); + if (args != NULL) { + this->logger()->log("%s: Calling resource(POST) with [%s]=[%s]",this->m_res_type.c_str(),this->getFullName().c_str(),(char *)args); + this->post(args); + } + else { + string value = this->coapDataToString(this->m_res->value(),this->m_res->value_length()); + this->logger()->log("%s: Calling resource(POST) with [%s]=[%s]",this->m_res_type.c_str(),this->getFullName().c_str(),value.c_str()); + this->post((void *)value.c_str()); + } return 0; } #endif @@ -272,10 +278,15 @@ #else // DELETE() check if ((op & M2MBase::DELETE_ALLOWED) != 0) { - string value = this->coapDataToString(this->m_res->value(),this->m_res->value_length()); - this->logger()->log("%s: Calling resource(DELETE) with [%s]=[%s]",this->m_res_type.c_str(),this->getFullName().c_str(),value.c_str()); - this->del((void *)value.c_str()); - return 0; + if (args != NULL) { + this->logger()->log("%s: Calling resource(DELETE) with [%s]=[%s]",this->m_res_type.c_str(),this->getFullName().c_str(),(char *)args); + this->del(args); + } + else { + string value = this->coapDataToString(this->m_res->value(),this->m_res->value_length()); + this->logger()->log("%s: Calling resource(DELETE) with [%s]=[%s]",this->m_res_type.c_str(),this->getFullName().c_str(),value.c_str()); + this->del((void *)value.c_str()); + } } #endif