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.
m2mobjectinstance_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 "m2mobjectinstance_stub.h" 00017 00018 u_int8_t m2mobjectinstance_stub::int_value; 00019 bool m2mobjectinstance_stub::bool_value; 00020 M2MResource* m2mobjectinstance_stub::resource; 00021 M2MResource* m2mobjectinstance_stub::create_resource; 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 M2MResourceList m2mobjectinstance_stub::resource_list(12); 00026 00027 M2MResourceInstance* m2mobjectinstance_stub::create_resource_instance; 00028 sn_coap_hdr_s* m2mobjectinstance_stub::header; 00029 M2MBase::BaseType m2mobjectinstance_stub::base_type; 00030 00031 00032 void m2mobjectinstance_stub::clear() 00033 { 00034 int_value = 0; 00035 bool_value = false; 00036 resource = NULL; 00037 create_resource = NULL; 00038 create_resource_instance = NULL; 00039 header = NULL; 00040 base_type = M2MBase::ObjectInstance; 00041 resource_list.clear(); 00042 } 00043 00044 M2MObjectInstance::M2MObjectInstance(M2MObject& parent, const String &object_name, 00045 const String &resource_type, 00046 char *path, 00047 bool external_blockwise_store) 00048 : M2MBase(object_name, 00049 M2MBase::Dynamic, 00050 resource_type, 00051 path, 00052 external_blockwise_store), 00053 _parent(parent) 00054 { 00055 } 00056 00057 M2MObjectInstance::M2MObjectInstance(M2MObject& parent, const lwm2m_parameters_s* static_res) 00058 : M2MBase(static_res), _parent(parent) 00059 { 00060 00061 } 00062 00063 M2MObjectInstance::~M2MObjectInstance() 00064 { 00065 } 00066 00067 M2MResource* M2MObjectInstance::create_static_resource(const lwm2m_parameters_s* static_res, 00068 M2MResourceInstance::ResourceType type) 00069 { 00070 return m2mobjectinstance_stub::create_resource; 00071 } 00072 00073 M2MResource* M2MObjectInstance::create_static_resource(const String &resource_name, 00074 const String &resource_type, 00075 M2MResourceInstance::ResourceType type, 00076 const uint8_t *value, 00077 const uint8_t value_length, 00078 bool multiple_instance, 00079 bool external_blockwise_store) 00080 { 00081 return m2mobjectinstance_stub::create_resource; 00082 } 00083 00084 M2MResource* M2MObjectInstance::create_dynamic_resource(const lwm2m_parameters_s* static_res, 00085 M2MResourceInstance::ResourceType type, 00086 bool observable) 00087 { 00088 return m2mobjectinstance_stub::create_resource; 00089 } 00090 00091 M2MResource* M2MObjectInstance::create_dynamic_resource(const String &resource_name, 00092 const String &resource_type, 00093 M2MResourceInstance::ResourceType type, 00094 bool observable, 00095 bool multiple_instance, 00096 bool external_blockwise_store) 00097 { 00098 return m2mobjectinstance_stub::create_resource; 00099 } 00100 00101 M2MResourceInstance* M2MObjectInstance::create_static_resource_instance(const String &resource_name, 00102 const String &resource_type, 00103 M2MResourceInstance::ResourceType type, 00104 const uint8_t *value, 00105 const uint8_t value_length, 00106 uint16_t instance_id, 00107 bool external_blockwise_store) 00108 { 00109 return m2mobjectinstance_stub::create_resource_instance; 00110 } 00111 00112 00113 M2MResourceInstance* M2MObjectInstance::create_dynamic_resource_instance(const String &resource_name, 00114 const String &resource_type, 00115 M2MResourceInstance::ResourceType type, 00116 bool observable, 00117 uint16_t instance_id, 00118 bool external_blockwise_store) 00119 { 00120 return m2mobjectinstance_stub::create_resource_instance; 00121 } 00122 00123 bool M2MObjectInstance::remove_resource(const String &) 00124 { 00125 return m2mobjectinstance_stub::bool_value; 00126 } 00127 00128 bool M2MObjectInstance::remove_resource(const char *resource_name) 00129 { 00130 return m2mobjectinstance_stub::bool_value; 00131 } 00132 00133 bool M2MObjectInstance::remove_resource_instance(const String &, uint16_t) 00134 { 00135 return m2mobjectinstance_stub::bool_value; 00136 } 00137 00138 M2MResource* M2MObjectInstance::resource(const String &) const 00139 { 00140 return m2mobjectinstance_stub::resource; 00141 } 00142 00143 M2MResource* M2MObjectInstance::resource(const char *resource_name) const 00144 { 00145 return m2mobjectinstance_stub::resource; 00146 } 00147 00148 const M2MResourceList& M2MObjectInstance::resources() const 00149 { 00150 return m2mobjectinstance_stub::resource_list; 00151 } 00152 00153 uint16_t M2MObjectInstance::resource_count() const 00154 { 00155 return m2mobjectinstance_stub::int_value; 00156 } 00157 00158 uint16_t M2MObjectInstance::resource_count(const String& ) const 00159 { 00160 return m2mobjectinstance_stub::int_value; 00161 } 00162 00163 uint16_t M2MObjectInstance::resource_count(const char* ) const 00164 { 00165 return m2mobjectinstance_stub::int_value; 00166 } 00167 00168 M2MBase::BaseType M2MObjectInstance::base_type() const 00169 { 00170 return m2mobjectinstance_stub::base_type; 00171 } 00172 00173 void M2MObjectInstance::add_observation_level(M2MBase::Observation) 00174 { 00175 } 00176 00177 void M2MObjectInstance::remove_observation_level(M2MBase::Observation) 00178 { 00179 } 00180 00181 sn_coap_hdr_s* M2MObjectInstance::handle_get_request(nsdl_s *, 00182 sn_coap_hdr_s *, 00183 M2MObservationHandler *) 00184 { 00185 return m2mobjectinstance_stub::header; 00186 } 00187 00188 sn_coap_hdr_s* M2MObjectInstance::handle_put_request(nsdl_s *, 00189 sn_coap_hdr_s *, 00190 M2MObservationHandler *, 00191 bool &) 00192 { 00193 return m2mobjectinstance_stub::header; 00194 } 00195 00196 sn_coap_hdr_s* M2MObjectInstance::handle_post_request(nsdl_s *, 00197 sn_coap_hdr_s *, 00198 M2MObservationHandler *, 00199 bool &execute, 00200 sn_nsdl_addr_s *) 00201 { 00202 execute = m2mobjectinstance_stub::bool_value; 00203 return m2mobjectinstance_stub::header; 00204 } 00205 00206 void M2MObjectInstance::notification_update(M2MBase::Observation) 00207 { 00208 }
Generated on Tue Jul 12 2022 21:20:27 by
