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: MAX44000 PWM_Tone_Library nexpaq_mdk
Fork of LED_Demo by
m2mresource_stub.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 "m2mresource_stub.h" 00017 00018 uint32_t m2mresource_stub::int_value; 00019 uint8_t* m2mresource_stub::delayed_token; 00020 uint8_t m2mresource_stub::delayed_token_len; 00021 bool m2mresource_stub::bool_value; 00022 00023 // The statically initialized list must be bigh enough to cater 00024 // for all the tests, or the utest framework will complain for memory leak. 00025 M2MResourceInstanceList m2mresource_stub::list(12); 00026 00027 M2MResourceInstance *m2mresource_stub::instance; 00028 sn_coap_hdr_s *m2mresource_stub::header; 00029 void m2mresource_stub::clear() 00030 { 00031 int_value = 0; 00032 delayed_token = NULL; 00033 delayed_token_len = 0; 00034 bool_value = false; 00035 list.clear(); 00036 instance = NULL; 00037 } 00038 00039 M2MResource& M2MResource::operator=(const M2MResource& other) 00040 { 00041 return *this; 00042 } 00043 00044 M2MResource::M2MResource(const M2MResource& other) 00045 : M2MResourceInstance(other) 00046 { 00047 *this = other; 00048 } 00049 00050 M2MResource::M2MResource(M2MObjectInstanceCallback &object_instance_callback, 00051 const String &resource_name, 00052 const String &resource_type, 00053 M2MResourceInstance::ResourceType type, 00054 const uint8_t *value, 00055 const uint8_t value_length, 00056 const uint16_t object_instance_id, 00057 const String &object_name, 00058 bool) 00059 : M2MResourceInstance(resource_name, resource_type, type, value, value_length, 00060 object_instance_callback, object_instance_id, object_name) 00061 { 00062 } 00063 00064 M2MResource::M2MResource(M2MObjectInstanceCallback &object_instance_callback, 00065 const String &resource_name, 00066 const String &resource_type, 00067 M2MResourceInstance::ResourceType type, 00068 bool, 00069 const uint16_t object_instance_id, 00070 const String &object_name, 00071 bool) 00072 : M2MResourceInstance(resource_name, resource_type, type, 00073 object_instance_callback, object_instance_id, object_name) 00074 { 00075 } 00076 00077 M2MResource::~M2MResource() 00078 { 00079 } 00080 00081 bool M2MResource::supports_multiple_instances() const 00082 { 00083 return m2mresource_stub::bool_value; 00084 } 00085 00086 void M2MResource::get_delayed_token(unsigned char *&token, unsigned char &token_len) 00087 { 00088 token_len = 0; 00089 if(token) { 00090 free(token); 00091 token = NULL; 00092 } 00093 token = (uint8_t *)malloc(m2mresource_stub::delayed_token_len); 00094 if(token) { 00095 token_len = m2mresource_stub::delayed_token_len; 00096 memcpy((uint8_t *)token, (uint8_t *)m2mresource_stub::delayed_token, token_len); 00097 } 00098 } 00099 00100 bool M2MResource::remove_resource_instance(uint16_t inst_id) 00101 { 00102 return m2mresource_stub::bool_value; 00103 } 00104 00105 M2MResourceInstance* M2MResource::resource_instance(uint16_t inst_id) const 00106 { 00107 return m2mresource_stub::instance; 00108 } 00109 00110 const M2MResourceInstanceList& M2MResource::resource_instances() const 00111 { 00112 return m2mresource_stub::list; 00113 } 00114 00115 uint16_t M2MResource::resource_instance_count() const 00116 { 00117 return m2mresource_stub::int_value; 00118 } 00119 00120 bool M2MResource::handle_observation_attribute(char *&query) 00121 { 00122 return m2mresource_stub::bool_value; 00123 } 00124 00125 void M2MResource::add_resource_instance(M2MResourceInstance *) 00126 { 00127 } 00128 00129 void M2MResource::add_observation_level(M2MBase::Observation) 00130 { 00131 } 00132 00133 void M2MResource::remove_observation_level(M2MBase::Observation) 00134 { 00135 } 00136 00137 void M2MResource::notification_update() 00138 { 00139 } 00140 00141 sn_coap_hdr_s* M2MResource::handle_get_request(nsdl_s *, 00142 sn_coap_hdr_s *, 00143 M2MObservationHandler *) 00144 { 00145 return m2mresource_stub::header; 00146 } 00147 00148 sn_coap_hdr_s* M2MResource::handle_put_request(nsdl_s *, 00149 sn_coap_hdr_s *, 00150 M2MObservationHandler *, 00151 bool &) 00152 { 00153 return m2mresource_stub::header; 00154 } 00155 00156 sn_coap_hdr_s* M2MResource::handle_post_request(nsdl_s *, 00157 sn_coap_hdr_s *, 00158 M2MObservationHandler *, 00159 bool &) 00160 { 00161 return m2mresource_stub::header; 00162 }
Generated on Tue Jul 12 2022 12:28:39 by
