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.
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Fork of 6_songs-from-the-cloud by
m2mobject.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/m2mobject.h" 00017 #include "mbed-client/m2mobservationhandler.h" 00018 #include "mbed-client/m2mconstants.h" 00019 #include "include/m2mtlvserializer.h" 00020 #include "include/m2mtlvdeserializer.h" 00021 #include "include/nsdllinker.h" 00022 #include "include/m2mreporthandler.h" 00023 #include "ns_trace.h" 00024 00025 M2MObject::M2MObject(const String &object_name) 00026 : M2MBase(object_name,M2MBase::Dynamic), 00027 _max_instance_count(MAX_UNINT_16_COUNT) 00028 { 00029 M2MBase::set_base_type(M2MBase::Object); 00030 if(M2MBase::name_id() != -1) { 00031 M2MBase::set_coap_content_type(COAP_CONTENT_OMA_TLV_TYPE); 00032 } 00033 } 00034 00035 M2MObject::~M2MObject() 00036 { 00037 if(!_instance_list.empty()) { 00038 M2MObjectInstanceList::const_iterator it; 00039 it = _instance_list.begin(); 00040 M2MObjectInstance* obj = NULL; 00041 uint16_t index = 0; 00042 for (; it!=_instance_list.end(); it++, index++ ) { 00043 //Free allocated memory for object instances. 00044 obj = *it; 00045 00046 char *obj_inst_id = (char*)malloc(20); 00047 if(obj_inst_id) { 00048 snprintf(obj_inst_id, 20,"%d",index); 00049 00050 String obj_name = M2MBase::name(); 00051 obj_name += String("/"); 00052 obj_name += String(obj_inst_id); 00053 00054 free(obj_inst_id); 00055 remove_resource_from_coap(obj_name); 00056 } 00057 00058 delete obj; 00059 obj = NULL; 00060 } 00061 remove_object_from_coap(); 00062 _instance_list.clear(); 00063 } 00064 } 00065 00066 M2MObject& M2MObject::operator=(const M2MObject& other) 00067 { 00068 if (this != &other) { // protect against invalid self-assignment 00069 if(!other._instance_list.empty()){ 00070 M2MObjectInstance* ins = NULL; 00071 M2MObjectInstanceList::const_iterator it; 00072 it = other._instance_list.begin(); 00073 for (; it!=other._instance_list.end(); it++ ) { 00074 ins = *it; 00075 _instance_list.push_back(new M2MObjectInstance(*ins)); 00076 } 00077 } 00078 } 00079 return *this; 00080 } 00081 00082 M2MObject::M2MObject(const M2MObject& other) 00083 : M2MBase(other), 00084 _max_instance_count(MAX_UNINT_16_COUNT) 00085 { 00086 this->operator=(other); 00087 } 00088 00089 M2MObjectInstance* M2MObject::create_object_instance(uint16_t instance_id) 00090 { 00091 tr_debug("M2MObject::create_object_instance - id: %d", instance_id); 00092 M2MObjectInstance *instance = NULL; 00093 if(!object_instance(instance_id)) { 00094 instance = new M2MObjectInstance(this->name(),*this); 00095 if(instance) { 00096 instance->set_instance_id(instance_id); 00097 _instance_list.push_back(instance); 00098 if(M2MBase::name_id() != -1) { 00099 instance->set_coap_content_type(COAP_CONTENT_OMA_TLV_TYPE); 00100 } 00101 } 00102 } 00103 return instance; 00104 } 00105 00106 bool M2MObject::remove_object_instance(uint16_t inst_id) 00107 { 00108 tr_debug("M2MObject::remove_object_instance(inst_id %d)", inst_id); 00109 bool success = false; 00110 if(!_instance_list.empty()) { 00111 M2MObjectInstance* obj = NULL; 00112 M2MObjectInstanceList::const_iterator it; 00113 it = _instance_list.begin(); 00114 int pos = 0; 00115 for ( ; it != _instance_list.end(); it++, pos++ ) { 00116 if((*it)->instance_id() == inst_id) { 00117 // Instance found and deleted. 00118 obj = *it; 00119 00120 char *obj_inst_id = (char*)malloc(20); 00121 if(obj_inst_id) { 00122 snprintf(obj_inst_id, 20,"%d",obj->instance_id()); 00123 00124 String obj_name = name(); 00125 obj_name += String("/"); 00126 obj_name += String(obj_inst_id); 00127 00128 free(obj_inst_id); 00129 00130 delete obj; 00131 obj = NULL; 00132 _instance_list.erase(pos); 00133 success = true; 00134 00135 remove_resource_from_coap(obj_name); 00136 } 00137 break; 00138 } 00139 } 00140 } 00141 return success; 00142 } 00143 00144 M2MObjectInstance* M2MObject::object_instance(uint16_t inst_id) const 00145 { 00146 tr_debug("M2MObject::object_instance(inst_id %d)", inst_id); 00147 M2MObjectInstance *obj = NULL; 00148 if(!_instance_list.empty()) { 00149 M2MObjectInstanceList::const_iterator it; 00150 it = _instance_list.begin(); 00151 for ( ; it != _instance_list.end(); it++ ) { 00152 if((*it)->instance_id() == inst_id) { 00153 // Instance found. 00154 obj = *it; 00155 break; 00156 } 00157 } 00158 } 00159 return obj; 00160 } 00161 00162 const M2MObjectInstanceList& M2MObject::instances() const 00163 { 00164 return _instance_list; 00165 } 00166 00167 uint16_t M2MObject::instance_count() const 00168 { 00169 return (uint16_t)_instance_list.size(); 00170 } 00171 00172 M2MBase::BaseType M2MObject::base_type() const 00173 { 00174 return M2MBase::base_type(); 00175 } 00176 00177 void M2MObject::add_observation_level(M2MBase::Observation observation_level) 00178 { 00179 M2MBase::add_observation_level(observation_level); 00180 if(!_instance_list.empty()) { 00181 M2MObjectInstanceList::const_iterator it; 00182 it = _instance_list.begin(); 00183 for ( ; it != _instance_list.end(); it++ ) { 00184 (*it)->add_observation_level(observation_level); 00185 } 00186 } 00187 } 00188 00189 void M2MObject::remove_observation_level(M2MBase::Observation observation_level) 00190 { 00191 M2MBase::remove_observation_level(observation_level); 00192 if(!_instance_list.empty()) { 00193 M2MObjectInstanceList::const_iterator it; 00194 it = _instance_list.begin(); 00195 for ( ; it != _instance_list.end(); it++ ) { 00196 (*it)->remove_observation_level(observation_level); 00197 } 00198 } 00199 } 00200 00201 sn_coap_hdr_s* M2MObject::handle_get_request(nsdl_s *nsdl, 00202 sn_coap_hdr_s *received_coap_header, 00203 M2MObservationHandler *observation_handler) 00204 { 00205 tr_debug("M2MObject::handle_get_request()"); 00206 sn_coap_msg_code_e msg_code = COAP_MSG_CODE_RESPONSE_CONTENT; 00207 sn_coap_hdr_s * coap_response = sn_nsdl_build_response(nsdl, 00208 received_coap_header, 00209 msg_code); 00210 //TODO: GET for Object is not yet implemented. 00211 // Need to first fix C library and then implement on C++ side. 00212 uint8_t * data = NULL; 00213 uint32_t data_length = 0; 00214 //TODO: GET for Object is not yet implemented. 00215 // Need to first fix C library and then implement on C++ side. 00216 if(received_coap_header) { 00217 // process the GET if we have registered a callback for it 00218 if ((operation() & SN_GRS_GET_ALLOWED) != 0) { 00219 if(coap_response) { 00220 uint16_t coap_content_type = 0; 00221 bool content_type_present = false; 00222 if(received_coap_header->content_type_ptr) { 00223 content_type_present = true; 00224 coap_response->content_type_ptr = (uint8_t*)malloc(received_coap_header->content_type_len); 00225 if(coap_response->content_type_ptr) { 00226 memset(coap_response->content_type_ptr, 0, received_coap_header->content_type_len); 00227 memcpy(coap_response->content_type_ptr, 00228 received_coap_header->content_type_ptr, 00229 received_coap_header->content_type_len); 00230 coap_response->content_type_len = received_coap_header->content_type_len; 00231 for(uint8_t i = 0; i < coap_response->content_type_len; i++) { 00232 coap_content_type = (coap_content_type << 8) + (coap_response->content_type_ptr[i] & 0xFF); 00233 } 00234 } 00235 } 00236 if(!content_type_present && 00237 M2MBase::coap_content_type() == COAP_CONTENT_OMA_TLV_TYPE) { 00238 coap_content_type = COAP_CONTENT_OMA_TLV_TYPE; 00239 } 00240 00241 tr_debug("M2MObject::handle_get_request() - Request Content-Type %d", coap_content_type); 00242 00243 // fill in the CoAP response payload 00244 if(COAP_CONTENT_OMA_TLV_TYPE == coap_content_type) { 00245 M2MTLVSerializer *serializer = new M2MTLVSerializer(); 00246 data = serializer->serialize(_instance_list, data_length); 00247 delete serializer; 00248 } else { // TOD0: Implement JSON Format. 00249 msg_code = COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT; // Content format not supported 00250 } 00251 00252 coap_response->payload_len = data_length; 00253 coap_response->payload_ptr = data; 00254 00255 coap_response->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s)); 00256 memset(coap_response->options_list_ptr, 0, sizeof(sn_coap_options_list_s)); 00257 00258 coap_response->options_list_ptr->max_age_ptr = (uint8_t*)malloc(1); 00259 memset(coap_response->options_list_ptr->max_age_ptr,0,1); 00260 coap_response->options_list_ptr->max_age_len = 1; 00261 00262 if(data){ 00263 if(received_coap_header->token_ptr) { 00264 tr_debug("M2MObject::handle_get_request - Sets Observation Token to resource"); 00265 set_observation_token(received_coap_header->token_ptr, 00266 received_coap_header->token_len); 00267 } 00268 00269 if(received_coap_header->options_list_ptr) { 00270 if(received_coap_header->options_list_ptr->observe) { 00271 if (is_observable()) { 00272 uint32_t number = 0; 00273 uint8_t observe_option = 0; 00274 if(received_coap_header->options_list_ptr->observe_ptr) { 00275 observe_option = *received_coap_header->options_list_ptr->observe_ptr; 00276 } 00277 if(START_OBSERVATION == observe_option) { 00278 tr_debug("M2MObject::handle_get_request - Starts Observation"); 00279 // If the observe length is 0 means register for observation. 00280 if(received_coap_header->options_list_ptr->observe_len != 0) { 00281 for(int i=0;i < received_coap_header->options_list_ptr->observe_len; i++) { 00282 number = (*(received_coap_header->options_list_ptr->observe_ptr + i) & 0xff) << 00283 8*(received_coap_header->options_list_ptr->observe_len- 1 - i); 00284 } 00285 } 00286 // If the observe value is 0 means register for observation. 00287 if(number == 0) { 00288 tr_debug("M2MObject::handle_get_request - Put Resource under Observation"); 00289 set_under_observation(true,observation_handler); 00290 add_observation_level(M2MBase::O_Attribute); 00291 uint8_t *obs_number = (uint8_t*)malloc(3); 00292 memset(obs_number,0,3); 00293 uint8_t observation_number_length = 1; 00294 00295 uint16_t number = observation_number(); 00296 00297 tr_debug("M2MObject::handle_get_request - Observation Number %d", number); 00298 obs_number[0] = ((number>>8) & 0xFF); 00299 obs_number[1] = (number & 0xFF); 00300 00301 if(number > 0xFF) { 00302 observation_number_length = 2; 00303 } 00304 coap_response->options_list_ptr->observe_ptr = obs_number; 00305 coap_response->options_list_ptr->observe_len = observation_number_length; 00306 } 00307 } else if (STOP_OBSERVATION == observe_option) { 00308 tr_debug("M2MObject::handle_get_request - Stops Observation"); 00309 // If the observe options_list_ptr->observe_ptr value is 1 means de-register from observation. 00310 set_under_observation(false,NULL); 00311 remove_observation_level(M2MBase::O_Attribute); 00312 } 00313 msg_code = COAP_MSG_CODE_RESPONSE_CONTENT; 00314 } 00315 else { 00316 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00317 } 00318 } 00319 } 00320 } else { 00321 msg_code = COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT; // Content format not supported 00322 } 00323 } 00324 }else { 00325 tr_error("M2MResource::handle_get_request - Return COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED"); 00326 // Operation is not allowed. 00327 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00328 } 00329 } else { 00330 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00331 } 00332 if(coap_response) { 00333 coap_response->msg_code = msg_code; 00334 } 00335 return coap_response; 00336 } 00337 00338 sn_coap_hdr_s* M2MObject::handle_put_request(nsdl_s *nsdl, 00339 sn_coap_hdr_s *received_coap_header, 00340 M2MObservationHandler */*observation_handler*/) 00341 { 00342 tr_debug("M2MObject::handle_put_request()"); 00343 sn_coap_msg_code_e msg_code = COAP_MSG_CODE_RESPONSE_CHANGED; // 2.04 00344 sn_coap_hdr_s *coap_response = sn_nsdl_build_response(nsdl, 00345 received_coap_header, 00346 msg_code); 00347 if(received_coap_header) { 00348 if ((operation() & SN_GRS_PUT_ALLOWED) != 0) { 00349 if(!received_coap_header->payload_ptr) { 00350 if(received_coap_header->options_list_ptr && 00351 received_coap_header->options_list_ptr->uri_query_ptr) { 00352 char *query = (char*)malloc(received_coap_header->options_list_ptr->uri_query_len+1); 00353 if (query){ 00354 memset(query, 0, received_coap_header->options_list_ptr->uri_query_len+1); 00355 memcpy(query, 00356 received_coap_header->options_list_ptr->uri_query_ptr, 00357 received_coap_header->options_list_ptr->uri_query_len); 00358 memset(query + received_coap_header->options_list_ptr->uri_query_len,'\0',1);//String terminator 00359 tr_debug("M2MObject::handle_put_request() - Query %s", query); 00360 // if anything was updated, re-initialize the stored notification attributes 00361 if (!handle_observation_attribute(query)){ 00362 tr_debug("M2MObject::handle_put_request() - Invalid query"); 00363 msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; // 4.00 00364 } 00365 free(query); 00366 } 00367 } else { 00368 tr_error("M2MObject::handle_put_request() - COAP_MSG_CODE_RESPONSE_BAD_REQUEST - Empty URI_QUERY"); 00369 msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; 00370 } 00371 } else { 00372 tr_error("M2MObject::handle_put_request() - COAP_MSG_CODE_RESPONSE_BAD_REQUEST -Payload exists"); 00373 msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; 00374 } 00375 } else { 00376 // Operation is not allowed. 00377 tr_error("M2MObject::handle_put_request() - COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED"); 00378 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00379 } 00380 } else { 00381 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00382 } 00383 if(coap_response) { 00384 coap_response->msg_code = msg_code; 00385 } 00386 return coap_response; 00387 } 00388 00389 00390 sn_coap_hdr_s* M2MObject::handle_post_request(nsdl_s *nsdl, 00391 sn_coap_hdr_s *received_coap_header, 00392 M2MObservationHandler *observation_handler) 00393 { 00394 tr_debug("M2MObject::handle_post_request()"); 00395 sn_coap_msg_code_e msg_code = COAP_MSG_CODE_RESPONSE_CHANGED; // 2.04 00396 // process the POST if we have registered a callback for it 00397 sn_coap_hdr_s *coap_response = sn_nsdl_build_response(nsdl, 00398 received_coap_header, 00399 msg_code); 00400 00401 if(received_coap_header) { 00402 if ((operation() & SN_GRS_POST_ALLOWED) != 0) { 00403 if(received_coap_header->payload_ptr) { 00404 tr_debug("M2MObject::handle_post_request() - Update Object with new values"); 00405 uint16_t coap_content_type = 0; 00406 bool content_type_present = false; 00407 if(received_coap_header->content_type_ptr) { 00408 content_type_present = true; 00409 if(coap_response) { 00410 coap_response->content_type_ptr = (uint8_t*)malloc(received_coap_header->content_type_len); 00411 if(coap_response->content_type_ptr) { 00412 memset(coap_response->content_type_ptr, 0, received_coap_header->content_type_len); 00413 memcpy(coap_response->content_type_ptr, 00414 received_coap_header->content_type_ptr, 00415 received_coap_header->content_type_len); 00416 coap_response->content_type_len = received_coap_header->content_type_len; 00417 for(uint8_t i = 0; i < coap_response->content_type_len; i++) { 00418 coap_content_type = (coap_content_type << 8) + (coap_response->content_type_ptr[i] & 0xFF); 00419 } 00420 } 00421 } 00422 } // if(received_coap_header->content_type_ptr) 00423 if(!content_type_present && 00424 M2MBase::coap_content_type() == COAP_CONTENT_OMA_TLV_TYPE) { 00425 coap_content_type = COAP_CONTENT_OMA_TLV_TYPE; 00426 } 00427 00428 tr_debug("M2MObject::handle_post_request() - Request Content-Type %d", coap_content_type); 00429 00430 if(COAP_CONTENT_OMA_TLV_TYPE == coap_content_type) { 00431 uint16_t instance_id = 0; 00432 // Check next free instance id 00433 for(instance_id = 0; instance_id <= _max_instance_count; instance_id++) { 00434 if(NULL == object_instance(instance_id)) { 00435 break; 00436 } 00437 if(instance_id == _max_instance_count) { 00438 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00439 break; 00440 } 00441 } 00442 if(COAP_MSG_CODE_RESPONSE_CHANGED == msg_code) { 00443 M2MTLVDeserializer *deserializer = new M2MTLVDeserializer(); 00444 bool is_obj_instance = false; 00445 bool obj_instance_exists = false; 00446 if (deserializer) { 00447 is_obj_instance = deserializer->is_object_instance(received_coap_header->payload_ptr); 00448 if (is_obj_instance) { 00449 instance_id = deserializer->instance_id(received_coap_header->payload_ptr); 00450 tr_debug("M2MObject::handle_post_request() - instance id in TLV: %d", instance_id); 00451 // Check if instance id already exists 00452 if (object_instance(instance_id)){ 00453 obj_instance_exists = true; 00454 } 00455 } 00456 } 00457 if (!obj_instance_exists) { 00458 M2MObjectInstance *obj_instance = create_object_instance(instance_id); 00459 if(obj_instance) { 00460 obj_instance->set_operation(M2MBase::GET_PUT_ALLOWED); 00461 } 00462 00463 if(deserializer) { 00464 String obj_name = ""; 00465 char *obj_inst_id = NULL; 00466 M2MTLVDeserializer::Error error = M2MTLVDeserializer::None; 00467 if(is_obj_instance) { 00468 tr_debug("M2MObject::handle_post_request() - TLV data contains ObjectInstance"); 00469 error = deserializer->deserialise_object_instances(received_coap_header->payload_ptr, 00470 received_coap_header->payload_len, 00471 *this, 00472 M2MTLVDeserializer::Post); 00473 } else if(deserializer->is_resource(received_coap_header->payload_ptr) || 00474 deserializer->is_multiple_resource(received_coap_header->payload_ptr)) { 00475 tr_debug("M2MObject::handle_post_request() - TLV data contains Resources"); 00476 error = deserializer->deserialize_resources(received_coap_header->payload_ptr, 00477 received_coap_header->payload_len, 00478 *obj_instance, 00479 M2MTLVDeserializer::Post); 00480 } else { 00481 error = M2MTLVDeserializer::NotValid; 00482 } 00483 switch(error) { 00484 case M2MTLVDeserializer::None: 00485 if(observation_handler) { 00486 observation_handler->value_updated(this); 00487 } 00488 coap_response->options_list_ptr = (sn_coap_options_list_s*)malloc(sizeof(sn_coap_options_list_s)); 00489 if (coap_response->options_list_ptr) { 00490 memset(coap_response->options_list_ptr, 0, sizeof(sn_coap_options_list_s)); 00491 00492 obj_name = M2MBase::name(); 00493 obj_name += String("/"); 00494 obj_inst_id = (char*)malloc(10); 00495 snprintf(obj_inst_id, 10,"%d",instance_id); 00496 obj_name += obj_inst_id; 00497 00498 coap_response->options_list_ptr->location_path_len = obj_name.length(); 00499 if (coap_response->options_list_ptr->location_path_len != 0) { 00500 coap_response->options_list_ptr->location_path_ptr = 00501 (uint8_t*)malloc(coap_response->options_list_ptr->location_path_len); 00502 if (coap_response->options_list_ptr->location_path_ptr) { 00503 memcpy(coap_response->options_list_ptr->location_path_ptr, 00504 obj_name.c_str(), 00505 coap_response->options_list_ptr->location_path_len); 00506 } 00507 } 00508 free(obj_inst_id); 00509 } 00510 msg_code = COAP_MSG_CODE_RESPONSE_CREATED; 00511 break; 00512 case M2MTLVDeserializer::NotAllowed: 00513 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; 00514 break; 00515 case M2MTLVDeserializer::NotValid: 00516 msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; 00517 break; 00518 case M2MTLVDeserializer::NotFound: 00519 msg_code = COAP_MSG_CODE_RESPONSE_NOT_FOUND; 00520 break; 00521 } 00522 } 00523 } else { 00524 tr_debug("M2MObject::handle_post_request() - COAP_MSG_CODE_RESPONSE_BAD_REQUEST"); 00525 msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; 00526 } 00527 delete deserializer; 00528 } 00529 } else { 00530 msg_code =COAP_MSG_CODE_RESPONSE_UNSUPPORTED_CONTENT_FORMAT; 00531 } // if(COAP_CONTENT_OMA_TLV_TYPE == coap_content_type) 00532 } else { 00533 tr_error("M2MObject::handle_post_request - COAP_MSG_CODE_RESPONSE_BAD_REQUEST - Missing Payload"); 00534 msg_code = COAP_MSG_CODE_RESPONSE_BAD_REQUEST; // 00535 } 00536 } else { // if ((object->operation() & SN_GRS_POST_ALLOWED) != 0) 00537 tr_error("M2MObject::handle_post_request - COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED"); 00538 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; // 4.05 00539 } 00540 } else { //if(received_coap_header) 00541 tr_error("M2MObject::handle_post_request - COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED"); 00542 msg_code = COAP_MSG_CODE_RESPONSE_METHOD_NOT_ALLOWED; // 4.05 00543 } 00544 00545 if(coap_response) { 00546 coap_response->msg_code = msg_code; 00547 } 00548 return coap_response; 00549 } 00550 00551 void M2MObject::notification_update() 00552 { 00553 tr_debug("M2MObject::notification_update"); 00554 M2MReportHandler *report_handler = M2MBase::report_handler(); 00555 if(report_handler && is_observable()) { 00556 report_handler->set_notification_trigger(); 00557 } 00558 } 00559
Generated on Tue Jul 12 2022 12:47:47 by
