Ram Gandikota / Mbed OS ABCD
Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mresource.cpp Source File

m2mresource.cpp

00001 /*
00002  * Copyright (c) 2015 ARM Limited. All rights reserved.
00003  * SPDX-License-Identifier: Apache-2.0
00004  * Licensed under the Apache License, Version 2.0 (the License); you may
00005  * not use this file except in compliance with the License.
00006  * You may obtain a copy of the License at
00007  *
00008  * http://www.apache.org/licenses/LICENSE-2.0
00009  *
00010  * Unless required by applicable law or agreed to in writing, software
00011  * distributed under the License is distributed on an AS IS BASIS, WITHOUT
00012  * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013  * See the License for the specific language governing permissions and
00014  * limitations under the License.
00015  */
00016 #include "mbed-client/m2mconstants.h"
00017 #include "mbed-client/m2mresource.h"
00018 #include "mbed-client/m2mobservationhandler.h"
00019 #include "include/m2mreporthandler.h"
00020 #include "include/m2mtlvserializer.h"
00021 #include "include/m2mtlvdeserializer.h"
00022 #include "mbed-trace/mbed_trace.h"
00023 
00024 #include <stdlib.h>
00025 
00026 #define TRACE_GROUP "mClt"
00027 
00028 M2MResource::M2MResource(M2MObjectInstance &parent,
00029                          const String &resource_name,
00030                          const String &resource_type,
00031                          M2MResourceInstance::ResourceType type,
00032                          const uint8_t *value,
00033                          const uint8_t value_length,
00034                          char *path,
00035                          const uint16_t object_instance_id,
00036                          bool multiple_instance,
00037                          bool external_blockwise_store)
00038 : M2MResourceInstance(*this, resource_name, resource_type, type, value, value_length,
00039                       object_instance_id,
00040                       path, external_blockwise_store),
00041   _parent(parent),
00042   _delayed_token(NULL),
00043   _delayed_token_len(0),
00044   _has_multiple_instances(multiple_instance),
00045   _delayed_response(false)
00046 {
00047     M2MBase::set_base_type(M2MBase::Resource);
00048     M2MBase::set_operation(M2MBase::GET_ALLOWED);
00049     M2MBase::set_observable(false);
00050 
00051 }
00052 
00053 M2MResource::M2MResource(M2MObjectInstance &parent,
00054                          const lwm2m_parameters_s* s,
00055                           M2MResourceInstance::ResourceType type,
00056                          const uint16_t object_instance_id)
00057 : M2MResourceInstance(*this, s, type, object_instance_id),
00058   _parent(parent),
00059   _delayed_token(NULL),
00060   _delayed_token_len(0),
00061   _has_multiple_instances(false),
00062   _delayed_response(false)
00063 {
00064     // tbd: _has_multiple_instances could be in flash, but no real benefit, because of current alignment.
00065 }
00066 
00067 M2MResource::M2MResource(M2MObjectInstance &parent,
00068                          const String &resource_name,
00069                          const String &resource_type,
00070                          M2MResourceInstance::ResourceType type,
00071                          bool observable,
00072                          char *path,
00073                          const uint16_t object_instance_id,
00074                          bool multiple_instance,
00075                          bool external_blockwise_store)
00076 : M2MResourceInstance(*this, resource_name, resource_type, type,
00077                       object_instance_id,
00078                       path,
00079                       external_blockwise_store),
00080   _parent(parent),
00081   _delayed_token(NULL),
00082   _delayed_token_len(0),
00083   _has_multiple_instances(multiple_instance),
00084   _delayed_response(false)
00085 {
00086     M2MBase::set_base_type(M2MBase::Resource);
00087     M2MBase::set_operation(M2MBase::GET_PUT_ALLOWED);
00088     M2MBase::set_observable(observable);
00089 }
00090 
00091 
00092 M2MResource::~M2MResource()
00093 {
00094     if(!_resource_instance_list.empty()) {
00095         M2MResourceInstance* res = NULL;
00096         M2MResourceInstanceList::const_iterator it;
00097         it = _resource_instance_list.begin();
00098         for (; it!=_resource_instance_list.end(); it++ ) {
00099             //Free allocated memory for resources.
00100             res = *it;
00101             delete res;
00102         }
00103         _resource_instance_list.clear();
00104     }
00105     free(_delayed_token);
00106 }
00107 
00108 bool M2MResource::supports_multiple_instances() const
00109 {
00110     return _has_multiple_instances;
00111 }
00112 
00113 void M2MResource::set_delayed_response(bool delayed_response)
00114 {
00115     _delayed_response = delayed_response;
00116 }
00117 
00118 bool M2MResource::send_delayed_post_response()
00119 {
00120     bool success = false;
00121     if(_delayed_response) {
00122         success = true;
00123         observation_handler()->send_delayed_response(this);
00124     }
00125     return success;
00126 }
00127 
00128 void M2MResource::get_delayed_token(uint8_t *&token, uint8_t &token_length)
00129 {
00130     token_length = 0;
00131     if(token) {
00132         free(token);
00133         token = NULL;
00134     }
00135     if(_delayed_token && _delayed_token_len > 0) {
00136         token = alloc_copy(_delayed_token, _delayed_token_len);
00137         if(token) {
00138             token_length = _delayed_token_len;
00139         }
00140     }
00141 }
00142 
00143 bool M2MResource::remove_resource_instance(uint16_t inst_id)
00144 {
00145     tr_debug("M2MResource::remove_resource(inst_id %d)", inst_id);
00146     bool success = false;
00147     if(!_resource_instance_list.empty()) {
00148         M2MResourceInstance* res = NULL;
00149         M2MResourceInstanceList::const_iterator it;
00150         it = _resource_instance_list.begin();
00151         int pos = 0;
00152         for ( ; it != _resource_instance_list.end(); it++, pos++ ) {
00153             if(((*it)->instance_id() == inst_id)) {
00154                 // Resource found and deleted.
00155                 res = *it;
00156                 delete res;
00157                 _resource_instance_list.erase(pos);
00158                 success = true;
00159                 break;
00160             }
00161         }
00162     }
00163     return success;
00164 }
00165 
00166 M2MResourceInstance* M2MResource::resource_instance(uint16_t inst_id) const
00167 {
00168     tr_debug("M2MResource::resource(resource_name inst_id %d)", inst_id);
00169     M2MResourceInstance *res = NULL;
00170     if(!_resource_instance_list.empty()) {
00171         M2MResourceInstanceList::const_iterator it;
00172         it = _resource_instance_list.begin();
00173         for ( ; it != _resource_instance_list.end(); it++ ) {
00174             if(((*it)->instance_id() == inst_id)) {
00175                 // Resource found.
00176                 res = *it;
00177                 break;
00178             }
00179         }
00180     }
00181     return res;
00182 }
00183 
00184 const M2MResourceInstanceList& M2MResource::resource_instances() const
00185 {
00186     return _resource_instance_list;
00187 }
00188 
00189 uint16_t M2MResource::resource_instance_count() const
00190 {
00191     return (uint16_t)_resource_instance_list.size();
00192 }
00193 
00194 bool M2MResource::delayed_response() const
00195 {
00196     return _delayed_response;
00197 }
00198 
00199 bool M2MResource::handle_observation_attribute(const char *query)
00200 {
00201     tr_debug("M2MResource::handle_observation_attribute - is_under_observation(%d)", is_under_observation());
00202     bool success = false;
00203     M2MReportHandler *handler = M2MBase::report_handler();
00204     if (!handler) {
00205         handler = M2MBase::create_report_handler();
00206     }
00207 
00208     if (handler) {
00209         success = handler->parse_notification_attribute(query,
00210                 M2MBase::base_type(), _resource_type);
00211         if (success) {
00212             if (is_under_observation()) {
00213                 handler->set_under_observation(true);
00214             }
00215         }
00216         else {
00217             handler->set_default_values();
00218         }
00219 
00220         if (success) {
00221             if(!_resource_instance_list.empty()) {
00222                 M2MResourceInstanceList::const_iterator it;
00223                 it = _resource_instance_list.begin();
00224                 for ( ; it != _resource_instance_list.end(); it++ ) {
00225                     M2MReportHandler *report_handler = (*it)->report_handler();
00226                     if(report_handler && is_under_observation()) {
00227                         report_handler->set_notification_trigger();
00228                     }
00229                 }
00230             }
00231         }
00232     }
00233     return success;
00234 }
00235 
00236 void M2MResource::add_observation_level(M2MBase::Observation observation_level)
00237 {
00238     M2MBase::add_observation_level(observation_level);
00239     if(!_resource_instance_list.empty()) {
00240         M2MResourceInstanceList::const_iterator inst;
00241         inst = _resource_instance_list.begin();
00242         for ( ; inst != _resource_instance_list.end(); inst++ ) {
00243             (*inst)->add_observation_level(observation_level);
00244         }
00245     }
00246 }
00247 
00248 void M2MResource::remove_observation_level(M2MBase::Observation observation_level)
00249 {
00250     M2MBase::remove_observation_level(observation_level);
00251     if(!_resource_instance_list.empty()) {
00252         M2MResourceInstanceList::const_iterator inst;
00253         inst = _resource_instance_list.begin();
00254         for ( ; inst != _resource_instance_list.end(); inst++ ) {
00255             (*inst)->remove_observation_level(observation_level);
00256         }
00257     }
00258 }
00259 
00260 void M2MResource::add_resource_instance(M2MResourceInstance *res)
00261 {
00262     tr_debug("M2MResource::add_resource_instance()");
00263     if(res) {
00264         _resource_instance_list.push_back(res);
00265     }
00266 }
00267 
00268 sn_coap_hdr_s* M2MResource::handle_get_request(nsdl_s *nsdl,
00269                                                sn_coap_hdr_s *received_coap_header,
00270                                                M2MObservationHandler *observation_handler)
00271 {
00272     tr_debug("M2MResource::handle_get_request()");
00273     sn_coap_msg_code_e msg_code = COAP_MSG_CODE_RESPONSE_CONTENT;
00274     sn_coap_hdr_s * coap_response = NULL;
00275     if(_has_multiple_instances) {
00276         coap_response = sn_nsdl_build_response(nsdl,
00277                                                received_coap_header,
00278                                                msg_code);
00279         if(received_coap_header) {
00280             // process the GET if we have registered a callback for it
00281             if ((operation() & SN_GRS_GET_ALLOWED) != 0) {
00282                 if(coap_response) {
00283                     uint16_t coap_content_type = 0;
00284                     bool content_type_present = false;
00285                     if(received_coap_header->content_format != COAP_CT_NONE){
00286                         content_type_present = true;
00287                         coap_content_type = received_coap_header->content_format;
00288                     }
00289 
00290                     if(!content_type_present &&
00291                        M2MBase::coap_content_type() == COAP_CONTENT_OMA_TLV_TYPE) {
00292                         coap_content_type = COAP_CONTENT_OMA_TLV_TYPE;
00293                     }
00294 
00295                     tr_debug("M2MResource::handle_get_request() - Request Content-Type %d", coap_content_type);
00296                     if (coap_response->content_format == COAP_CT_NONE) {
00297                         coap_response->content_format = sn_coap_content_format_e(coap_content_type);
00298                         if (coap_response->content_format != COAP_CT_NONE) {
00299                             set_coap_content_type(coap_content_type);
00300                         }
00301                     }
00302                     uint8_t *data = NULL;
00303                     uint32_t data_length = 0;
00304                     // fill in the CoAP response payload
00305                     if(COAP_CONTENT_OMA_TLV_TYPE == coap_content_type) {
00306                         M2MTLVSerializer serializer;
00307                         data = serializer.serialize(this, data_length);
00308                     } else {
00309                         msg_code = COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT; // Content format not supported
00310                     }
00311 
00312                     coap_response->payload_len = data_length;
00313                     coap_response->payload_ptr = data;
00314 
00315                     coap_response->options_list_ptr = sn_nsdl_alloc_options_list(nsdl, coap_response);
00316 
00317                     coap_response->options_list_ptr->max_age = max_age();
00318 
00319                     if(received_coap_header->options_list_ptr) {
00320                         if(received_coap_header->options_list_ptr->observe != -1) {
00321                             if (is_observable()) {
00322                                 uint32_t number = 0;
00323                                 uint8_t observe_option = 0;
00324                                 observe_option = received_coap_header->options_list_ptr->observe;
00325                                 if(START_OBSERVATION == observe_option) {
00326                                     tr_debug("M2MResource::handle_get_request - Starts Observation");
00327                                     // If the observe length is 0 means register for observation.
00328                                     if(received_coap_header->options_list_ptr->observe != -1) {
00329                                         number = received_coap_header->options_list_ptr->observe;
00330                                     }
00331                                     if(received_coap_header->token_ptr) {
00332                                         tr_debug("M2MResource::handle_get_request - Sets Observation Token to resource");
00333                                         set_observation_token(received_coap_header->token_ptr,
00334                                                               received_coap_header->token_len);
00335                                     }
00336 
00337                                     // If the observe value is 0 means register for observation.
00338                                     if(number == 0) {
00339                                         tr_debug("M2MResource::handle_get_request - Put Resource under Observation");
00340                                         M2MResourceInstanceList::const_iterator it;
00341                                         it = _resource_instance_list.begin();
00342                                         for (; it!=_resource_instance_list.end(); it++ ) {
00343                                             tr_debug("M2MResource::handle_get_request - set_resource_observer");
00344                                             (*it)->set_resource_observer(this);
00345                                             (*it)->add_observation_level(M2MBase::R_Attribute);
00346                                         }
00347                                         set_under_observation(true,observation_handler);
00348                                         M2MBase::add_observation_level(M2MBase::R_Attribute);
00349                                         coap_response->options_list_ptr->observe = observation_number();
00350                                     }
00351                                 } else if (STOP_OBSERVATION == observe_option) {
00352                                     tr_debug("M2MResource::handle_get_request - Stops Observation");
00353                                     set_under_observation(false,NULL);
00354                                     M2MBase::remove_observation_level(M2MBase::R_Attribute);
00355                                     M2MResourceInstanceList::const_iterator it;
00356                                     it = _resource_instance_list.begin();
00357                                     for (; it!=_resource_instance_list.end(); it++ ) {
00358                                         (*it)->set_resource_observer(NULL);
00359                                     }
00360                                 }
00361                                 msg_code = COAP_MSG_CODE_RESPONSE_CONTENT;
00362                             }
00363                             else {
00364                                 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED;
00365                             }
00366                         }
00367                     }
00368                 }
00369             } else {
00370                 tr_error("M2MResource::handle_get_request - Return COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED");
00371                 // Operation is not allowed.
00372                 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED;
00373             }
00374         }
00375         if(coap_response) {
00376             coap_response->msg_code = msg_code;
00377         }
00378     } else {
00379         coap_response = M2MResourceInstance::handle_get_request(nsdl,
00380                             received_coap_header,
00381                             observation_handler);
00382     }
00383     return coap_response;
00384 }
00385 
00386 sn_coap_hdr_s* M2MResource::handle_put_request(nsdl_s *nsdl,
00387                                                sn_coap_hdr_s *received_coap_header,
00388                                                M2MObservationHandler *observation_handler,
00389                                                bool &execute_value_updated)
00390 {
00391     tr_debug("M2MResource::handle_put_request()");
00392     sn_coap_msg_code_e msg_code = COAP_MSG_CODE_RESPONSE_CHANGED; // 2.04
00393     sn_coap_hdr_s * coap_response = NULL;
00394     if(_has_multiple_instances) {
00395         coap_response = sn_nsdl_build_response(nsdl,
00396                                                received_coap_header,
00397                                                msg_code);
00398         // process the PUT if we have registered a callback for it
00399         if(received_coap_header) {
00400             uint16_t coap_content_type = 0;
00401             bool content_type_present = false;
00402             if(received_coap_header->content_format != COAP_CT_NONE && coap_response) {
00403                 content_type_present = true;
00404                 coap_content_type = received_coap_header->content_format;
00405             }
00406             if(received_coap_header->options_list_ptr &&
00407                received_coap_header->options_list_ptr->uri_query_ptr) {
00408                 char *query = (char*)alloc_string_copy(received_coap_header->options_list_ptr->uri_query_ptr,
00409                                                         received_coap_header->options_list_ptr->uri_query_len);
00410                 if (query){
00411                     msg_code = COAP_MSG_CODE_RESPONSE_CHANGED;
00412                     tr_debug("M2MResource::handle_put_request() - Query %s", query);
00413                     // if anything was updated, re-initialize the stored notification attributes
00414                     if (!handle_observation_attribute(query)){
00415                         tr_debug("M2MResource::handle_put_request() - Invalid query");
00416                         msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; // 4.00
00417                     }
00418                     free(query);
00419                 }
00420             } else if ((operation() & SN_GRS_PUT_ALLOWED) != 0) {
00421                 if(!content_type_present &&
00422                    M2MBase::coap_content_type() == COAP_CONTENT_OMA_TLV_TYPE) {
00423                     coap_content_type = COAP_CONTENT_OMA_TLV_TYPE;
00424                 }
00425 
00426                 tr_debug("M2MResource::handle_put_request() - Request Content-Type %d", coap_content_type);
00427 
00428                 if(COAP_CONTENT_OMA_TLV_TYPE == coap_content_type) {
00429                     M2MTLVDeserializer deserializer;
00430                     M2MTLVDeserializer::Error error = M2MTLVDeserializer::None;
00431                     error = deserializer.deserialize_resource_instances(received_coap_header->payload_ptr,
00432                                                                          received_coap_header->payload_len,
00433                                                                          *this,
00434                                                                          M2MTLVDeserializer::Put);
00435                     switch(error) {
00436                         case M2MTLVDeserializer::None:
00437                             if(observation_handler) {
00438                                 String value = "";
00439                                 if (received_coap_header->uri_path_ptr != NULL &&
00440                                     received_coap_header->uri_path_len > 0) {
00441 
00442                                     value.append_raw((char*)received_coap_header->uri_path_ptr,received_coap_header->uri_path_len);
00443                                 }
00444                                 execute_value_updated = true;
00445                             }
00446                             msg_code = COAP_MSG_CODE_RESPONSE_CHANGED;
00447                             break;
00448                         case M2MTLVDeserializer::NotFound:
00449                             msg_code = COAP_MSG_CODE_RESPONSE_NOT_FOUND;
00450                             break;
00451                         case M2MTLVDeserializer::NotAllowed:
00452                             msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED;
00453                             break;
00454                         case M2MTLVDeserializer::NotValid:
00455                             msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST;
00456                             break;
00457                     }
00458                 } else {
00459                     msg_code =COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT;
00460                 } // if(COAP_CONTENT_OMA_TLV_TYPE == coap_content_type)
00461             } else {
00462                 // Operation is not allowed.
00463                 tr_error("M2MResource::handle_put_request() - COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED");
00464                 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED;
00465             }
00466         } else {
00467             msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED;
00468         }
00469         if(coap_response) {
00470             coap_response->msg_code = msg_code;
00471         }
00472     } else {
00473         coap_response = M2MResourceInstance::handle_put_request(nsdl,
00474                             received_coap_header,
00475                             observation_handler,
00476                             execute_value_updated);
00477     }
00478     return coap_response;
00479 }
00480 
00481 sn_coap_hdr_s* M2MResource::handle_post_request(nsdl_s *nsdl,
00482                                                 sn_coap_hdr_s *received_coap_header,
00483                                                 M2MObservationHandler */*observation_handler*/,
00484                                                 bool &/*execute_value_updated*/,
00485                                                 sn_nsdl_addr_s *address)
00486 {
00487     tr_debug("M2MResource::handle_post_request()");
00488     sn_coap_msg_code_e msg_code = COAP_MSG_CODE_RESPONSE_CHANGED; // 2.04
00489     sn_coap_hdr_s * coap_response = sn_nsdl_build_response(nsdl,
00490                                                            received_coap_header,
00491                                                            msg_code);
00492     // process the POST if we have registered a callback for it
00493     if(received_coap_header) {
00494         if ((operation() & SN_GRS_POST_ALLOWED) != 0) {
00495             M2MResource::M2MExecuteParameter *exec_params = new M2MResource::M2MExecuteParameter();
00496             if (exec_params) {
00497                 exec_params->_object_name = object_name();
00498                 exec_params->_resource_name = name();
00499                 exec_params->_object_instance_id = object_instance_id();
00500             }
00501             uint16_t coap_content_type = 0;
00502             if(received_coap_header->payload_ptr) {
00503                 if(received_coap_header->content_format != COAP_CT_NONE) {
00504                     coap_content_type = received_coap_header->content_format;
00505                 }
00506                 if(coap_content_type == 0) {
00507                     if (exec_params){
00508                         exec_params->_value = alloc_string_copy(received_coap_header->payload_ptr,
00509                                                                 received_coap_header->payload_len);
00510                         if (exec_params->_value) {
00511                             exec_params->_value_length = received_coap_header->payload_len;
00512                         }
00513                     }
00514                 } else {
00515                     msg_code = COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT;
00516                 }
00517             }
00518             if(COAP_MSG_CODE_RESPONSE_CHANGED == msg_code) {
00519                 tr_debug("M2MResource::handle_post_request - Execute resource function");
00520                 if(_delayed_response) {
00521                     msg_code = COAP_MSG_CODE_EMPTY;
00522                     coap_response->msg_type = COAP_MSG_TYPE_ACKNOWLEDGEMENT;
00523                     coap_response->msg_code = msg_code;
00524                     coap_response->msg_id = received_coap_header->msg_id;
00525                     if(received_coap_header->token_len) {
00526                         free(_delayed_token);
00527                         _delayed_token = NULL;
00528                         _delayed_token_len = 0;
00529                         _delayed_token = alloc_copy(received_coap_header->token_ptr, received_coap_header->token_len);
00530                         if(_delayed_token) {
00531                             _delayed_token_len = received_coap_header->token_len;
00532                         }
00533                         sn_nsdl_send_coap_message(nsdl, address, coap_response);
00534                     }
00535                 } else {
00536                     uint32_t length = 0;
00537                     get_value(coap_response->payload_ptr, length);
00538                     coap_response->payload_len = length;
00539                 }
00540                 execute(exec_params);
00541             }
00542             delete exec_params;
00543         } else { // if ((object->operation() & SN_GRS_POST_ALLOWED) != 0)
00544             tr_error("M2MResource::handle_post_request - COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED");
00545             msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; // 4.05
00546         }
00547     } else { //if(object && received_coap_header)
00548         tr_error("M2MResource::handle_post_request - COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED");
00549         msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; // 4.01
00550     }
00551     if(coap_response) {
00552         coap_response->msg_code = msg_code;
00553     }
00554     return coap_response;
00555 }
00556 
00557 void M2MResource::notification_update()
00558 {
00559     tr_debug("M2MResource::notification_update()");
00560     M2MReportHandler *report_handler = M2MBase::report_handler();
00561     if(report_handler && is_observable()) {
00562         report_handler->set_notification_trigger();
00563     }
00564 }
00565 
00566 M2MObjectInstance& M2MResource::get_parent_object_instance() const
00567 {
00568     return _parent;
00569 }
00570 
00571 const char* M2MResource::object_name() const
00572 {
00573     const M2MObjectInstance& parent_object_instance = _parent;
00574     const M2MObject& parent_object = parent_object_instance.get_parent_object();
00575 
00576     return parent_object.name();
00577 }
00578 
00579 
00580 M2MResource::M2MExecuteParameter::M2MExecuteParameter()
00581 {
00582     _value = NULL;
00583     _value_length = 0;
00584     _object_name = "";
00585     _resource_name = "";
00586     _object_instance_id = 0;
00587 }
00588 
00589 M2MResource::M2MExecuteParameter::~M2MExecuteParameter()
00590 {
00591     free(_value);
00592 }
00593 
00594 uint8_t *M2MResource::M2MExecuteParameter::get_argument_value() const
00595 {
00596     return _value;
00597 }
00598 
00599 uint16_t M2MResource::M2MExecuteParameter::get_argument_value_length() const
00600 {
00601     return _value_length;
00602 }
00603 
00604 const String& M2MResource::M2MExecuteParameter::get_argument_object_name() const
00605 {
00606     return _object_name;
00607 }
00608 
00609 const String& M2MResource::M2MExecuteParameter::get_argument_resource_name() const
00610 {
00611     return _resource_name;
00612 }
00613 
00614 uint16_t M2MResource::M2MExecuteParameter::get_argument_object_instance_id() const
00615 {
00616     return _object_instance_id;
00617 }
00618 
00619