joey shelton / LED_Demo

Dependencies:   MAX44000 PWM_Tone_Library nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mobjectinstance_stub.cpp Source File

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::operator=(const M2MObjectInstance& )
00045 {
00046     return *this;
00047 }
00048 
00049 M2MObjectInstance::M2MObjectInstance(const M2MObjectInstance& other)
00050 : M2MBase(other),
00051   _object_callback(other._object_callback)
00052 {
00053     *this = other;
00054 }
00055 
00056 M2MObjectInstance::M2MObjectInstance(const String &object_name, M2MObjectCallback &object_callback)
00057 : M2MBase(object_name,M2MBase::Dynamic),
00058   _object_callback(object_callback)
00059 {
00060 }
00061 
00062 M2MObjectInstance::~M2MObjectInstance()
00063 {
00064 }
00065 
00066 M2MResource* M2MObjectInstance::create_static_resource(const String &,
00067                                                const String &,
00068                                                M2MResourceInstance::ResourceType,
00069                                                const uint8_t *,
00070                                                const uint8_t,
00071                                                bool)
00072 {
00073     return m2mobjectinstance_stub::create_resource;
00074 }
00075 
00076 M2MResource* M2MObjectInstance::create_dynamic_resource(const String &,
00077                                                 const String &,
00078                                                 M2MResourceInstance::ResourceType,
00079                                                 bool,
00080                                                 bool)
00081 {
00082     return m2mobjectinstance_stub::create_resource;
00083 }
00084 
00085 M2MResourceInstance* M2MObjectInstance::create_static_resource_instance(const String &,
00086                                                const String &,
00087                                                M2MResourceInstance::ResourceType,
00088                                                const uint8_t *,
00089                                                const uint8_t,
00090                                                uint16_t)
00091 {
00092     return m2mobjectinstance_stub::create_resource_instance;
00093 }
00094 
00095 M2MResourceInstance* M2MObjectInstance::create_dynamic_resource_instance(const String &,
00096                                                 const String &,
00097                                                 M2MResourceInstance::ResourceType,
00098                                                 bool,
00099                                                 uint16_t)
00100 {
00101     return m2mobjectinstance_stub::create_resource_instance;
00102 }
00103 
00104 bool M2MObjectInstance::remove_resource(const String &)
00105 {
00106     return m2mobjectinstance_stub::bool_value;
00107 }
00108 
00109 bool M2MObjectInstance::remove_resource_instance(const String &, uint16_t)
00110 {
00111     return m2mobjectinstance_stub::bool_value;
00112 }
00113 
00114 M2MResource* M2MObjectInstance::resource(const String &) const
00115 {
00116     return m2mobjectinstance_stub::resource;
00117 }
00118 
00119 const M2MResourceList& M2MObjectInstance::resources() const
00120 {
00121     return m2mobjectinstance_stub::resource_list;
00122 }
00123 
00124 uint16_t M2MObjectInstance::resource_count() const
00125 {
00126     return m2mobjectinstance_stub::int_value;
00127 }
00128 
00129 uint16_t M2MObjectInstance::resource_count(const String& ) const
00130 {
00131     return m2mobjectinstance_stub::int_value;
00132 }
00133 
00134 M2MBase::BaseType M2MObjectInstance::base_type() const
00135 {
00136     return m2mobjectinstance_stub::base_type;
00137 }
00138 
00139 void M2MObjectInstance::add_observation_level(M2MBase::Observation)
00140 {
00141 }
00142 
00143 void M2MObjectInstance::remove_observation_level(M2MBase::Observation)
00144 {
00145 }
00146 
00147 sn_coap_hdr_s* M2MObjectInstance::handle_get_request(nsdl_s *,
00148                                   sn_coap_hdr_s *,
00149                                   M2MObservationHandler *)
00150 {
00151     return m2mobjectinstance_stub::header;
00152 }
00153 
00154 sn_coap_hdr_s* M2MObjectInstance::handle_put_request(nsdl_s *,
00155                                   sn_coap_hdr_s *,
00156                                   M2MObservationHandler *,
00157                                   bool &)
00158 {
00159     return m2mobjectinstance_stub::header;
00160 }
00161 
00162 sn_coap_hdr_s* M2MObjectInstance::handle_post_request(nsdl_s *,
00163                                    sn_coap_hdr_s *,
00164                                    M2MObservationHandler *,
00165                                    bool &execute)
00166 {
00167     execute = m2mobjectinstance_stub::bool_value;
00168     return m2mobjectinstance_stub::header;
00169 }
00170 
00171 void M2MObjectInstance::notification_update(M2MBase::Observation)
00172 {
00173 }