Ram Gandikota
/
metronome
FRDM K64F Metronome
mbed-client/test/mbedclient/utest/stub/m2mnsdlinterface_stub.cpp@0:a2cb7295a1f7, 2017-05-14 (annotated)
- Committer:
- ram54288
- Date:
- Sun May 14 18:35:07 2017 +0000
- Revision:
- 0:a2cb7295a1f7
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
ram54288 | 0:a2cb7295a1f7 | 1 | /* |
ram54288 | 0:a2cb7295a1f7 | 2 | * Copyright (c) 2015 ARM Limited. All rights reserved. |
ram54288 | 0:a2cb7295a1f7 | 3 | * SPDX-License-Identifier: Apache-2.0 |
ram54288 | 0:a2cb7295a1f7 | 4 | * Licensed under the Apache License, Version 2.0 (the License); you may |
ram54288 | 0:a2cb7295a1f7 | 5 | * not use this file except in compliance with the License. |
ram54288 | 0:a2cb7295a1f7 | 6 | * You may obtain a copy of the License at |
ram54288 | 0:a2cb7295a1f7 | 7 | * |
ram54288 | 0:a2cb7295a1f7 | 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
ram54288 | 0:a2cb7295a1f7 | 9 | * |
ram54288 | 0:a2cb7295a1f7 | 10 | * Unless required by applicable law or agreed to in writing, software |
ram54288 | 0:a2cb7295a1f7 | 11 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT |
ram54288 | 0:a2cb7295a1f7 | 12 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
ram54288 | 0:a2cb7295a1f7 | 13 | * See the License for the specific language governing permissions and |
ram54288 | 0:a2cb7295a1f7 | 14 | * limitations under the License. |
ram54288 | 0:a2cb7295a1f7 | 15 | */ |
ram54288 | 0:a2cb7295a1f7 | 16 | #include "m2mnsdlinterface_stub.h" |
ram54288 | 0:a2cb7295a1f7 | 17 | |
ram54288 | 0:a2cb7295a1f7 | 18 | |
ram54288 | 0:a2cb7295a1f7 | 19 | bool m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 20 | uint32_t m2mnsdlinterface_stub::int_value; |
ram54288 | 0:a2cb7295a1f7 | 21 | void * m2mnsdlinterface_stub::void_value; |
ram54288 | 0:a2cb7295a1f7 | 22 | String *m2mnsdlinterface_stub::string_value; |
ram54288 | 0:a2cb7295a1f7 | 23 | |
ram54288 | 0:a2cb7295a1f7 | 24 | void m2mnsdlinterface_stub::clear() |
ram54288 | 0:a2cb7295a1f7 | 25 | { |
ram54288 | 0:a2cb7295a1f7 | 26 | bool_value = false; |
ram54288 | 0:a2cb7295a1f7 | 27 | int_value = 0; |
ram54288 | 0:a2cb7295a1f7 | 28 | *string_value = ""; |
ram54288 | 0:a2cb7295a1f7 | 29 | void_value = NULL; |
ram54288 | 0:a2cb7295a1f7 | 30 | } |
ram54288 | 0:a2cb7295a1f7 | 31 | |
ram54288 | 0:a2cb7295a1f7 | 32 | M2MNsdlInterface::M2MNsdlInterface(M2MNsdlObserver &observer) |
ram54288 | 0:a2cb7295a1f7 | 33 | : _observer(observer) |
ram54288 | 0:a2cb7295a1f7 | 34 | { |
ram54288 | 0:a2cb7295a1f7 | 35 | //m2mnsdlinterface_stub::string_value = new String(""); |
ram54288 | 0:a2cb7295a1f7 | 36 | } |
ram54288 | 0:a2cb7295a1f7 | 37 | |
ram54288 | 0:a2cb7295a1f7 | 38 | M2MNsdlInterface::~M2MNsdlInterface() |
ram54288 | 0:a2cb7295a1f7 | 39 | { |
ram54288 | 0:a2cb7295a1f7 | 40 | //delete m2mnsdlinterface_stub::string_value; |
ram54288 | 0:a2cb7295a1f7 | 41 | } |
ram54288 | 0:a2cb7295a1f7 | 42 | |
ram54288 | 0:a2cb7295a1f7 | 43 | bool M2MNsdlInterface::initialize() |
ram54288 | 0:a2cb7295a1f7 | 44 | { |
ram54288 | 0:a2cb7295a1f7 | 45 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 46 | } |
ram54288 | 0:a2cb7295a1f7 | 47 | |
ram54288 | 0:a2cb7295a1f7 | 48 | void M2MNsdlInterface::create_endpoint(const String &, |
ram54288 | 0:a2cb7295a1f7 | 49 | const String &, |
ram54288 | 0:a2cb7295a1f7 | 50 | const int32_t, |
ram54288 | 0:a2cb7295a1f7 | 51 | const String &, |
ram54288 | 0:a2cb7295a1f7 | 52 | const uint8_t, |
ram54288 | 0:a2cb7295a1f7 | 53 | const String &) |
ram54288 | 0:a2cb7295a1f7 | 54 | { |
ram54288 | 0:a2cb7295a1f7 | 55 | } |
ram54288 | 0:a2cb7295a1f7 | 56 | |
ram54288 | 0:a2cb7295a1f7 | 57 | void M2MNsdlInterface::delete_endpoint() |
ram54288 | 0:a2cb7295a1f7 | 58 | { |
ram54288 | 0:a2cb7295a1f7 | 59 | } |
ram54288 | 0:a2cb7295a1f7 | 60 | |
ram54288 | 0:a2cb7295a1f7 | 61 | bool M2MNsdlInterface::create_nsdl_list_structure(const M2MObjectList &) |
ram54288 | 0:a2cb7295a1f7 | 62 | { |
ram54288 | 0:a2cb7295a1f7 | 63 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 64 | } |
ram54288 | 0:a2cb7295a1f7 | 65 | |
ram54288 | 0:a2cb7295a1f7 | 66 | bool M2MNsdlInterface::remove_nsdl_resource(M2MBase* base) |
ram54288 | 0:a2cb7295a1f7 | 67 | { |
ram54288 | 0:a2cb7295a1f7 | 68 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 69 | } |
ram54288 | 0:a2cb7295a1f7 | 70 | |
ram54288 | 0:a2cb7295a1f7 | 71 | bool M2MNsdlInterface::create_bootstrap_resource(sn_nsdl_addr_s *, const String& name) |
ram54288 | 0:a2cb7295a1f7 | 72 | { |
ram54288 | 0:a2cb7295a1f7 | 73 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 74 | } |
ram54288 | 0:a2cb7295a1f7 | 75 | |
ram54288 | 0:a2cb7295a1f7 | 76 | bool M2MNsdlInterface::send_register_message(uint8_t*, |
ram54288 | 0:a2cb7295a1f7 | 77 | uint8_t, |
ram54288 | 0:a2cb7295a1f7 | 78 | const uint16_t, |
ram54288 | 0:a2cb7295a1f7 | 79 | sn_nsdl_addr_type_e) |
ram54288 | 0:a2cb7295a1f7 | 80 | { |
ram54288 | 0:a2cb7295a1f7 | 81 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 82 | } |
ram54288 | 0:a2cb7295a1f7 | 83 | |
ram54288 | 0:a2cb7295a1f7 | 84 | bool M2MNsdlInterface::send_update_registration(const uint32_t) |
ram54288 | 0:a2cb7295a1f7 | 85 | { |
ram54288 | 0:a2cb7295a1f7 | 86 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 87 | } |
ram54288 | 0:a2cb7295a1f7 | 88 | |
ram54288 | 0:a2cb7295a1f7 | 89 | bool M2MNsdlInterface::send_unregister_message() |
ram54288 | 0:a2cb7295a1f7 | 90 | { |
ram54288 | 0:a2cb7295a1f7 | 91 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 92 | } |
ram54288 | 0:a2cb7295a1f7 | 93 | |
ram54288 | 0:a2cb7295a1f7 | 94 | void *M2MNsdlInterface::memory_alloc(uint16_t size) |
ram54288 | 0:a2cb7295a1f7 | 95 | { |
ram54288 | 0:a2cb7295a1f7 | 96 | return malloc(size); |
ram54288 | 0:a2cb7295a1f7 | 97 | } |
ram54288 | 0:a2cb7295a1f7 | 98 | |
ram54288 | 0:a2cb7295a1f7 | 99 | void M2MNsdlInterface::memory_free(void *ptr) |
ram54288 | 0:a2cb7295a1f7 | 100 | { |
ram54288 | 0:a2cb7295a1f7 | 101 | free(ptr); |
ram54288 | 0:a2cb7295a1f7 | 102 | ptr = NULL; |
ram54288 | 0:a2cb7295a1f7 | 103 | } |
ram54288 | 0:a2cb7295a1f7 | 104 | |
ram54288 | 0:a2cb7295a1f7 | 105 | uint8_t M2MNsdlInterface::send_to_server_callback(struct nsdl_s *, |
ram54288 | 0:a2cb7295a1f7 | 106 | sn_nsdl_capab_e, |
ram54288 | 0:a2cb7295a1f7 | 107 | uint8_t *, |
ram54288 | 0:a2cb7295a1f7 | 108 | uint16_t, |
ram54288 | 0:a2cb7295a1f7 | 109 | sn_nsdl_addr_s *) |
ram54288 | 0:a2cb7295a1f7 | 110 | { |
ram54288 | 0:a2cb7295a1f7 | 111 | return (uint8_t)m2mnsdlinterface_stub::int_value; |
ram54288 | 0:a2cb7295a1f7 | 112 | } |
ram54288 | 0:a2cb7295a1f7 | 113 | |
ram54288 | 0:a2cb7295a1f7 | 114 | uint8_t M2MNsdlInterface::received_from_server_callback(struct nsdl_s *, |
ram54288 | 0:a2cb7295a1f7 | 115 | sn_coap_hdr_s *, |
ram54288 | 0:a2cb7295a1f7 | 116 | sn_nsdl_addr_s *) |
ram54288 | 0:a2cb7295a1f7 | 117 | { |
ram54288 | 0:a2cb7295a1f7 | 118 | return (uint8_t)m2mnsdlinterface_stub::int_value; |
ram54288 | 0:a2cb7295a1f7 | 119 | } |
ram54288 | 0:a2cb7295a1f7 | 120 | |
ram54288 | 0:a2cb7295a1f7 | 121 | uint8_t M2MNsdlInterface::resource_callback(struct nsdl_s *, |
ram54288 | 0:a2cb7295a1f7 | 122 | sn_coap_hdr_s *, |
ram54288 | 0:a2cb7295a1f7 | 123 | sn_nsdl_addr_s *, |
ram54288 | 0:a2cb7295a1f7 | 124 | sn_nsdl_capab_e) |
ram54288 | 0:a2cb7295a1f7 | 125 | { |
ram54288 | 0:a2cb7295a1f7 | 126 | return (uint8_t)m2mnsdlinterface_stub::int_value; |
ram54288 | 0:a2cb7295a1f7 | 127 | } |
ram54288 | 0:a2cb7295a1f7 | 128 | |
ram54288 | 0:a2cb7295a1f7 | 129 | |
ram54288 | 0:a2cb7295a1f7 | 130 | bool M2MNsdlInterface::process_received_data(uint8_t *, |
ram54288 | 0:a2cb7295a1f7 | 131 | uint16_t , |
ram54288 | 0:a2cb7295a1f7 | 132 | sn_nsdl_addr_s *) |
ram54288 | 0:a2cb7295a1f7 | 133 | { |
ram54288 | 0:a2cb7295a1f7 | 134 | return m2mnsdlinterface_stub::bool_value; |
ram54288 | 0:a2cb7295a1f7 | 135 | } |
ram54288 | 0:a2cb7295a1f7 | 136 | |
ram54288 | 0:a2cb7295a1f7 | 137 | void M2MNsdlInterface::stop_timers() |
ram54288 | 0:a2cb7295a1f7 | 138 | { |
ram54288 | 0:a2cb7295a1f7 | 139 | |
ram54288 | 0:a2cb7295a1f7 | 140 | } |
ram54288 | 0:a2cb7295a1f7 | 141 | |
ram54288 | 0:a2cb7295a1f7 | 142 | void M2MNsdlInterface::timer_expired(M2MTimerObserver::Type) |
ram54288 | 0:a2cb7295a1f7 | 143 | { |
ram54288 | 0:a2cb7295a1f7 | 144 | } |
ram54288 | 0:a2cb7295a1f7 | 145 | |
ram54288 | 0:a2cb7295a1f7 | 146 | void M2MNsdlInterface::observation_to_be_sent(M2MBase *, uint16_t, Vector<uint16_t>, bool) |
ram54288 | 0:a2cb7295a1f7 | 147 | { |
ram54288 | 0:a2cb7295a1f7 | 148 | } |
ram54288 | 0:a2cb7295a1f7 | 149 | |
ram54288 | 0:a2cb7295a1f7 | 150 | void M2MNsdlInterface::send_delayed_response(M2MBase *) |
ram54288 | 0:a2cb7295a1f7 | 151 | { |
ram54288 | 0:a2cb7295a1f7 | 152 | } |
ram54288 | 0:a2cb7295a1f7 | 153 | |
ram54288 | 0:a2cb7295a1f7 | 154 | void M2MNsdlInterface::resource_to_be_deleted(M2MBase *) |
ram54288 | 0:a2cb7295a1f7 | 155 | { |
ram54288 | 0:a2cb7295a1f7 | 156 | } |
ram54288 | 0:a2cb7295a1f7 | 157 | |
ram54288 | 0:a2cb7295a1f7 | 158 | void M2MNsdlInterface::value_updated(M2MBase *, const String&) |
ram54288 | 0:a2cb7295a1f7 | 159 | { |
ram54288 | 0:a2cb7295a1f7 | 160 | } |
ram54288 | 0:a2cb7295a1f7 | 161 | |
ram54288 | 0:a2cb7295a1f7 | 162 | void M2MNsdlInterface::remove_object(M2MBase *) |
ram54288 | 0:a2cb7295a1f7 | 163 | { |
ram54288 | 0:a2cb7295a1f7 | 164 | } |
ram54288 | 0:a2cb7295a1f7 | 165 | |
ram54288 | 0:a2cb7295a1f7 | 166 | nsdl_s* M2MNsdlInterface::get_nsdl_handle() |
ram54288 | 0:a2cb7295a1f7 | 167 | { |
ram54288 | 0:a2cb7295a1f7 | 168 | return (nsdl_s*) m2mnsdlinterface_stub::void_value; |
ram54288 | 0:a2cb7295a1f7 | 169 | } |
ram54288 | 0:a2cb7295a1f7 | 170 | |
ram54288 | 0:a2cb7295a1f7 | 171 | void M2MNsdlInterface::handle_bootstrap_put_message(sn_coap_hdr_s *coap_header, sn_nsdl_addr_s *address) |
ram54288 | 0:a2cb7295a1f7 | 172 | { |
ram54288 | 0:a2cb7295a1f7 | 173 | |
ram54288 | 0:a2cb7295a1f7 | 174 | } |
ram54288 | 0:a2cb7295a1f7 | 175 | |
ram54288 | 0:a2cb7295a1f7 | 176 | void M2MNsdlInterface::handle_bootstrap_finished(sn_coap_hdr_s *coap_header,sn_nsdl_addr_s *address) |
ram54288 | 0:a2cb7295a1f7 | 177 | { |
ram54288 | 0:a2cb7295a1f7 | 178 | |
ram54288 | 0:a2cb7295a1f7 | 179 | } |
ram54288 | 0:a2cb7295a1f7 | 180 | |
ram54288 | 0:a2cb7295a1f7 | 181 | void M2MNsdlInterface::handle_bootstrap_delete(sn_coap_hdr_s *coap_header,sn_nsdl_addr_s *address) |
ram54288 | 0:a2cb7295a1f7 | 182 | { |
ram54288 | 0:a2cb7295a1f7 | 183 | |
ram54288 | 0:a2cb7295a1f7 | 184 | } |
ram54288 | 0:a2cb7295a1f7 | 185 | |
ram54288 | 0:a2cb7295a1f7 | 186 | bool M2MNsdlInterface::parse_bootstrap_message(sn_coap_hdr_s *coap_header, bool is_security_object) |
ram54288 | 0:a2cb7295a1f7 | 187 | { |
ram54288 | 0:a2cb7295a1f7 | 188 | |
ram54288 | 0:a2cb7295a1f7 | 189 | } |
ram54288 | 0:a2cb7295a1f7 | 190 | |
ram54288 | 0:a2cb7295a1f7 | 191 | bool M2MNsdlInterface::validate_security_object() |
ram54288 | 0:a2cb7295a1f7 | 192 | { |
ram54288 | 0:a2cb7295a1f7 | 193 | |
ram54288 | 0:a2cb7295a1f7 | 194 | } |
ram54288 | 0:a2cb7295a1f7 | 195 | |
ram54288 | 0:a2cb7295a1f7 | 196 | void M2MNsdlInterface::handle_bootstrap_error() |
ram54288 | 0:a2cb7295a1f7 | 197 | { |
ram54288 | 0:a2cb7295a1f7 | 198 | |
ram54288 | 0:a2cb7295a1f7 | 199 | } |
ram54288 | 0:a2cb7295a1f7 | 200 | |
ram54288 | 0:a2cb7295a1f7 | 201 | const String& M2MNsdlInterface::endpoint_name() const |
ram54288 | 0:a2cb7295a1f7 | 202 | { |
ram54288 | 0:a2cb7295a1f7 | 203 | return *m2mnsdlinterface_stub::string_value; |
ram54288 | 0:a2cb7295a1f7 | 204 | } |