mbed Connector Interface simplification API on top of mbed-client
Fork of mbedConnectorInterfaceV3 by
NOTE:
This repo has been replaced with https://github.com/ARMmbed/mbedConnectorInterface. No further updates will occur with this repo. Please use the github repo instead. Thanks!
Diff: source/DynamicResource.cpp
- Revision:
- 24:c92984bede9c
- Parent:
- 21:0bbe9057e7b1
- Child:
- 27:b8aaf7dc7023
diff -r 5852c0884714 -r c92984bede9c source/DynamicResource.cpp --- 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