nkjnm

Dependencies:   MAX44000 nexpaq_mdk

Fork of LED_Demo by Maxim nexpaq

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers m2mobject_stub.cpp Source File

m2mobject_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 "m2mobject_stub.h"
00017 
00018 u_int16_t m2mobject_stub::int_value;
00019 bool m2mobject_stub::bool_value;
00020 M2MObjectInstance* m2mobject_stub::inst;
00021 
00022 // The statically initialized object list must be bigh enough to cater 
00023 // for all the tests, or the utest framework will complain for memory leak.
00024 M2MObjectInstanceList m2mobject_stub::instance_list(12);
00025 
00026 M2MBase::BaseType m2mobject_stub::base_type;
00027 sn_coap_hdr_s *m2mobject_stub::header;
00028 
00029 void m2mobject_stub::clear()
00030 {
00031     int_value = 0;
00032     bool_value = false;
00033     m2mobject_stub::base_type = M2MBase::Object;
00034     instance_list.clear();
00035     header = NULL;
00036 }
00037 
00038 M2MObject::M2MObject(const String &object_name)
00039 : M2MBase(object_name,M2MBase::Dynamic)
00040 {
00041 }
00042 
00043 M2MObject::~M2MObject()
00044 {
00045 }
00046 
00047 M2MObject& M2MObject::operator=(const M2MObject& )
00048 {
00049     return *this;
00050 }
00051 
00052 M2MObject::M2MObject(const M2MObject& other)
00053 : M2MBase(other)
00054 {
00055     *this = other;
00056 }
00057 
00058 M2MObjectInstance* M2MObject::create_object_instance(uint16_t instance_id)
00059 {
00060     return m2mobject_stub::inst;
00061 }
00062 
00063 bool M2MObject::remove_object_instance(uint16_t)
00064 {
00065     return m2mobject_stub::bool_value;
00066 }
00067 
00068 M2MObjectInstance* M2MObject::object_instance(uint16_t) const
00069 {
00070     return m2mobject_stub::inst;
00071 }
00072 
00073 const M2MObjectInstanceList& M2MObject::instances() const
00074 {
00075     return m2mobject_stub::instance_list;
00076 }
00077 
00078 uint16_t M2MObject::instance_count() const
00079 {
00080     return m2mobject_stub::int_value;
00081 }
00082 
00083 M2MBase::BaseType M2MObject::base_type() const
00084 {
00085     return m2mobject_stub::base_type;
00086 }
00087 
00088 void M2MObject::add_observation_level(M2MBase::Observation)
00089 {
00090 
00091 }
00092 
00093 void M2MObject::remove_observation_level(M2MBase::Observation)
00094 {
00095 
00096 }
00097 
00098 sn_coap_hdr_s* M2MObject::handle_get_request(nsdl_s *,
00099                                   sn_coap_hdr_s *,
00100                                   M2MObservationHandler *)
00101 {
00102     return m2mobject_stub::header;
00103 }
00104 
00105 sn_coap_hdr_s* M2MObject::handle_put_request(nsdl_s *,
00106                                   sn_coap_hdr_s *,
00107                                   M2MObservationHandler *,
00108                                   bool &execute)
00109 {
00110     execute = m2mobject_stub::bool_value;
00111     return m2mobject_stub::header;
00112 }
00113 
00114 sn_coap_hdr_s* M2MObject::handle_post_request(nsdl_s *,
00115                                    sn_coap_hdr_s *,
00116                                    M2MObservationHandler *,
00117                                    bool &)
00118 {
00119     return m2mobject_stub::header;
00120 }
00121 
00122 void M2MObject::notification_update(uint16_t obj_instance_id)
00123 {
00124 }