FRDM K64F Metronome

Committer:
ram54288
Date:
Sun May 14 18:35:07 2017 +0000
Revision:
0:a2cb7295a1f7
Initial commit

Who changed what in which revision?

UserRevisionLine numberNew 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
ram54288 0:a2cb7295a1f7 17 #include "mbedclient.h"
ram54288 0:a2cb7295a1f7 18
ram54288 0:a2cb7295a1f7 19 #include "mbed-client/m2minterfacefactory.h"
ram54288 0:a2cb7295a1f7 20 #include "mbed-client/m2mdevice.h"
ram54288 0:a2cb7295a1f7 21 #include "mbed-client/m2mobjectinstance.h"
ram54288 0:a2cb7295a1f7 22 #include "mbed-client/m2mresource.h"
ram54288 0:a2cb7295a1f7 23
ram54288 0:a2cb7295a1f7 24 #ifdef TARGET_LIKE_MBED
ram54288 0:a2cb7295a1f7 25 #include "minar/minar.h"
ram54288 0:a2cb7295a1f7 26 #include "test_env.h"
ram54288 0:a2cb7295a1f7 27 #endif
ram54288 0:a2cb7295a1f7 28
ram54288 0:a2cb7295a1f7 29 #include <time.h>
ram54288 0:a2cb7295a1f7 30 #include <stdio.h>
ram54288 0:a2cb7295a1f7 31
ram54288 0:a2cb7295a1f7 32 // Enter your mbed Device Server's IPv4 address and Port number in
ram54288 0:a2cb7295a1f7 33 // mentioned format like 192.168.0.1:5693
ram54288 0:a2cb7295a1f7 34 const String &BOOTSTRAP_SERVER_ADDRESS = "coap://10.45.3.10:5693";
ram54288 0:a2cb7295a1f7 35 const String &BOOTSTRAP_SERVER_DTLS_ADDRESS = "coap://10.45.3.10:5694";
ram54288 0:a2cb7295a1f7 36
ram54288 0:a2cb7295a1f7 37 #ifdef SIXLOWPAN_INTERFACE
ram54288 0:a2cb7295a1f7 38 const String &MBED_SERVER_ADDRESS = "coap://FD00:FF1:CE0B:A5E1:1068:AF13:9B61:D557:5683";
ram54288 0:a2cb7295a1f7 39 const String &MBED_SERVER_DTLS_ADDRESS = "coap://FD00:FF1:CE0B:A5E1:1068:AF13:9B61:D557:5684";
ram54288 0:a2cb7295a1f7 40 #else
ram54288 0:a2cb7295a1f7 41 const String &MBED_SERVER_ADDRESS = "coap://10.45.3.10:5683";
ram54288 0:a2cb7295a1f7 42 //const String &MBED_SERVER_ADDRESS = "coap://10.45.0.152:5683";
ram54288 0:a2cb7295a1f7 43 const String &MBED_SERVER_DTLS_ADDRESS = "coap://10.45.3.10:5684";
ram54288 0:a2cb7295a1f7 44 #endif
ram54288 0:a2cb7295a1f7 45 const String CLIENT_NAME = "secure-client";
ram54288 0:a2cb7295a1f7 46
ram54288 0:a2cb7295a1f7 47 const String &MANUFACTURER = "ARM";
ram54288 0:a2cb7295a1f7 48 const String &TYPE = "type";
ram54288 0:a2cb7295a1f7 49 const String &MODEL_NUMBER = "2015";
ram54288 0:a2cb7295a1f7 50 const String &SERIAL_NUMBER = "12345";
ram54288 0:a2cb7295a1f7 51 const uint8_t STATIC_VALUE[] = "Static value";
ram54288 0:a2cb7295a1f7 52
ram54288 0:a2cb7295a1f7 53 #ifdef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 54 #include <unistd.h>
ram54288 0:a2cb7295a1f7 55 #else
ram54288 0:a2cb7295a1f7 56
ram54288 0:a2cb7295a1f7 57 #endif
ram54288 0:a2cb7295a1f7 58
ram54288 0:a2cb7295a1f7 59 MbedClient::MbedClient()
ram54288 0:a2cb7295a1f7 60 #ifndef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 61 :_led(LED3)
ram54288 0:a2cb7295a1f7 62 #endif
ram54288 0:a2cb7295a1f7 63 {
ram54288 0:a2cb7295a1f7 64 _security = NULL;
ram54288 0:a2cb7295a1f7 65 _interface = NULL;
ram54288 0:a2cb7295a1f7 66 _register_security = NULL;
ram54288 0:a2cb7295a1f7 67 _device = NULL;
ram54288 0:a2cb7295a1f7 68 _object = NULL;
ram54288 0:a2cb7295a1f7 69 _bootstrapped = false;
ram54288 0:a2cb7295a1f7 70 _error = false;
ram54288 0:a2cb7295a1f7 71 _registered = false;
ram54288 0:a2cb7295a1f7 72 _unregistered = false;
ram54288 0:a2cb7295a1f7 73 _registration_updated = false;
ram54288 0:a2cb7295a1f7 74 _value = 0;
ram54288 0:a2cb7295a1f7 75 }
ram54288 0:a2cb7295a1f7 76
ram54288 0:a2cb7295a1f7 77 MbedClient::~MbedClient() {
ram54288 0:a2cb7295a1f7 78 if(_security) {
ram54288 0:a2cb7295a1f7 79 delete _security;
ram54288 0:a2cb7295a1f7 80 }
ram54288 0:a2cb7295a1f7 81 if(_register_security){
ram54288 0:a2cb7295a1f7 82 delete _register_security;
ram54288 0:a2cb7295a1f7 83 }
ram54288 0:a2cb7295a1f7 84 if(_device) {
ram54288 0:a2cb7295a1f7 85 M2MDevice::delete_instance();
ram54288 0:a2cb7295a1f7 86 }
ram54288 0:a2cb7295a1f7 87 if(_object) {
ram54288 0:a2cb7295a1f7 88 delete _object;
ram54288 0:a2cb7295a1f7 89 }
ram54288 0:a2cb7295a1f7 90 if(_interface) {
ram54288 0:a2cb7295a1f7 91 delete _interface;
ram54288 0:a2cb7295a1f7 92 }
ram54288 0:a2cb7295a1f7 93 }
ram54288 0:a2cb7295a1f7 94
ram54288 0:a2cb7295a1f7 95 bool MbedClient::create_interface() {
ram54288 0:a2cb7295a1f7 96
ram54288 0:a2cb7295a1f7 97 M2MInterface::NetworkStack stack = M2MInterface::LwIP_IPv4;
ram54288 0:a2cb7295a1f7 98 #ifdef SIXLOWPAN_INTERFACE
ram54288 0:a2cb7295a1f7 99 stack = M2MInterface::Nanostack_IPv6;
ram54288 0:a2cb7295a1f7 100 #endif
ram54288 0:a2cb7295a1f7 101
ram54288 0:a2cb7295a1f7 102 /* From http://www.iana.org/assignments/port-numbers:
ram54288 0:a2cb7295a1f7 103 "The Dynamic and/or Private Ports are those from 49152 through 65535" */
ram54288 0:a2cb7295a1f7 104 srand(time(NULL));
ram54288 0:a2cb7295a1f7 105 uint16_t port = (rand() % (65535-49152)) + 49152;
ram54288 0:a2cb7295a1f7 106
ram54288 0:a2cb7295a1f7 107 _interface = M2MInterfaceFactory::create_interface(*this,
ram54288 0:a2cb7295a1f7 108 CLIENT_NAME,
ram54288 0:a2cb7295a1f7 109 "test",
ram54288 0:a2cb7295a1f7 110 60,
ram54288 0:a2cb7295a1f7 111 port,
ram54288 0:a2cb7295a1f7 112 "",
ram54288 0:a2cb7295a1f7 113 M2MInterface::UDP,
ram54288 0:a2cb7295a1f7 114 stack,
ram54288 0:a2cb7295a1f7 115 "");
ram54288 0:a2cb7295a1f7 116
ram54288 0:a2cb7295a1f7 117 return (_interface == NULL) ? false : true;
ram54288 0:a2cb7295a1f7 118 }
ram54288 0:a2cb7295a1f7 119
ram54288 0:a2cb7295a1f7 120 bool MbedClient::bootstrap_successful() {
ram54288 0:a2cb7295a1f7 121 #ifdef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 122 while(!_bootstrapped && !_error) {
ram54288 0:a2cb7295a1f7 123 sleep(1);
ram54288 0:a2cb7295a1f7 124 }
ram54288 0:a2cb7295a1f7 125 #endif
ram54288 0:a2cb7295a1f7 126 return _bootstrapped;
ram54288 0:a2cb7295a1f7 127 }
ram54288 0:a2cb7295a1f7 128
ram54288 0:a2cb7295a1f7 129 bool MbedClient::register_successful() {
ram54288 0:a2cb7295a1f7 130 #ifdef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 131 while(!_registered && !_error) {
ram54288 0:a2cb7295a1f7 132 sleep(1);
ram54288 0:a2cb7295a1f7 133 }
ram54288 0:a2cb7295a1f7 134 #endif
ram54288 0:a2cb7295a1f7 135 return _registered;
ram54288 0:a2cb7295a1f7 136 }
ram54288 0:a2cb7295a1f7 137
ram54288 0:a2cb7295a1f7 138 bool MbedClient::unregister_successful() {
ram54288 0:a2cb7295a1f7 139 #ifdef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 140 while(!_unregistered && !_error) {
ram54288 0:a2cb7295a1f7 141 sleep(1);
ram54288 0:a2cb7295a1f7 142 }
ram54288 0:a2cb7295a1f7 143 #endif
ram54288 0:a2cb7295a1f7 144 return _unregistered;
ram54288 0:a2cb7295a1f7 145 }
ram54288 0:a2cb7295a1f7 146
ram54288 0:a2cb7295a1f7 147 bool MbedClient::registration_update_successful() {
ram54288 0:a2cb7295a1f7 148 #ifdef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 149 while(!_registration_updated && !_error) {
ram54288 0:a2cb7295a1f7 150 sleep(1);
ram54288 0:a2cb7295a1f7 151 }
ram54288 0:a2cb7295a1f7 152 #endif
ram54288 0:a2cb7295a1f7 153 return _registration_updated;
ram54288 0:a2cb7295a1f7 154 }
ram54288 0:a2cb7295a1f7 155
ram54288 0:a2cb7295a1f7 156 M2MSecurity* MbedClient::create_bootstrap_object(bool useSecureConnection) {
ram54288 0:a2cb7295a1f7 157 // Creates bootstrap server object with Bootstrap server address and other parameters
ram54288 0:a2cb7295a1f7 158 // required for client to connect to bootstrap server.
ram54288 0:a2cb7295a1f7 159 M2MSecurity *security = M2MInterfaceFactory::create_security(M2MSecurity::Bootstrap);
ram54288 0:a2cb7295a1f7 160 if(security) {
ram54288 0:a2cb7295a1f7 161 if(useSecureConnection){
ram54288 0:a2cb7295a1f7 162 security->set_resource_value(M2MSecurity::M2MServerUri, BOOTSTRAP_SERVER_DTLS_ADDRESS);
ram54288 0:a2cb7295a1f7 163 //TODO: remove these, when bootstrapping server supports DTLS
ram54288 0:a2cb7295a1f7 164 delete security;
ram54288 0:a2cb7295a1f7 165 return NULL;
ram54288 0:a2cb7295a1f7 166 }else{
ram54288 0:a2cb7295a1f7 167 security->set_resource_value(M2MSecurity::M2MServerUri, BOOTSTRAP_SERVER_ADDRESS);
ram54288 0:a2cb7295a1f7 168 //TODO: refactor this out
ram54288 0:a2cb7295a1f7 169 security->set_resource_value(M2MSecurity::SecurityMode, M2MSecurity::NoSecurity);
ram54288 0:a2cb7295a1f7 170 }
ram54288 0:a2cb7295a1f7 171 }
ram54288 0:a2cb7295a1f7 172 return security;
ram54288 0:a2cb7295a1f7 173 }
ram54288 0:a2cb7295a1f7 174
ram54288 0:a2cb7295a1f7 175 M2MSecurity* MbedClient::create_register_object(bool useSecureConnection) {
ram54288 0:a2cb7295a1f7 176 // Creates bootstrap server object with Bootstrap server address and other parameters
ram54288 0:a2cb7295a1f7 177 // required for client to connect to bootstrap server.
ram54288 0:a2cb7295a1f7 178 M2MSecurity *security = M2MInterfaceFactory::create_security(M2MSecurity::M2MServer);
ram54288 0:a2cb7295a1f7 179 if(security) {
ram54288 0:a2cb7295a1f7 180 if(useSecureConnection){
ram54288 0:a2cb7295a1f7 181 security->set_resource_value(M2MSecurity::M2MServerUri, MBED_SERVER_DTLS_ADDRESS);
ram54288 0:a2cb7295a1f7 182 }else{
ram54288 0:a2cb7295a1f7 183 security->set_resource_value(M2MSecurity::M2MServerUri, MBED_SERVER_ADDRESS);
ram54288 0:a2cb7295a1f7 184 }
ram54288 0:a2cb7295a1f7 185 }
ram54288 0:a2cb7295a1f7 186 return security;
ram54288 0:a2cb7295a1f7 187 }
ram54288 0:a2cb7295a1f7 188
ram54288 0:a2cb7295a1f7 189 void MbedClient::test_bootstrap(M2MSecurity *security) {
ram54288 0:a2cb7295a1f7 190 if(_interface) {
ram54288 0:a2cb7295a1f7 191 // Bootstrap function.
ram54288 0:a2cb7295a1f7 192 _interface->bootstrap(security);
ram54288 0:a2cb7295a1f7 193 }
ram54288 0:a2cb7295a1f7 194 }
ram54288 0:a2cb7295a1f7 195
ram54288 0:a2cb7295a1f7 196 M2MDevice* MbedClient::create_device_object() {
ram54288 0:a2cb7295a1f7 197 // Creates device object which contains mandatory resources linked with
ram54288 0:a2cb7295a1f7 198 // device endpoint.
ram54288 0:a2cb7295a1f7 199 M2MDevice *device = M2MInterfaceFactory::create_device();
ram54288 0:a2cb7295a1f7 200 if(device) {
ram54288 0:a2cb7295a1f7 201 device->create_resource(M2MDevice::Manufacturer,MANUFACTURER);
ram54288 0:a2cb7295a1f7 202 device->create_resource(M2MDevice::DeviceType,TYPE);
ram54288 0:a2cb7295a1f7 203 device->create_resource(M2MDevice::ModelNumber,MODEL_NUMBER);
ram54288 0:a2cb7295a1f7 204 device->create_resource(M2MDevice::SerialNumber,SERIAL_NUMBER);
ram54288 0:a2cb7295a1f7 205 }
ram54288 0:a2cb7295a1f7 206 return device;
ram54288 0:a2cb7295a1f7 207 }
ram54288 0:a2cb7295a1f7 208
ram54288 0:a2cb7295a1f7 209 void MbedClient::execute_function(void *argument) {
ram54288 0:a2cb7295a1f7 210 #ifdef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 211 if(argument) {
ram54288 0:a2cb7295a1f7 212 char* arguments = (char*)argument;
ram54288 0:a2cb7295a1f7 213 printf("Received %s!!\n", arguments);
ram54288 0:a2cb7295a1f7 214 }
ram54288 0:a2cb7295a1f7 215 printf("I am executed !!\n");
ram54288 0:a2cb7295a1f7 216 #else
ram54288 0:a2cb7295a1f7 217 _led == 0 ? _led = 1 : _led = 0;
ram54288 0:a2cb7295a1f7 218 #endif
ram54288 0:a2cb7295a1f7 219 }
ram54288 0:a2cb7295a1f7 220
ram54288 0:a2cb7295a1f7 221 M2MObject* MbedClient::create_generic_object() {
ram54288 0:a2cb7295a1f7 222 _object = M2MInterfaceFactory::create_object("Test");
ram54288 0:a2cb7295a1f7 223 if(_object) {
ram54288 0:a2cb7295a1f7 224 M2MObjectInstance* inst = _object->create_object_instance();
ram54288 0:a2cb7295a1f7 225 if(inst) {
ram54288 0:a2cb7295a1f7 226 inst->set_operation(M2MBase::GET_ALLOWED);
ram54288 0:a2cb7295a1f7 227
ram54288 0:a2cb7295a1f7 228 M2MResource* res = inst->create_dynamic_resource("Dynamic",
ram54288 0:a2cb7295a1f7 229 "ResourceTest",
ram54288 0:a2cb7295a1f7 230 M2MResourceInstance::INTEGER,
ram54288 0:a2cb7295a1f7 231 true);
ram54288 0:a2cb7295a1f7 232
ram54288 0:a2cb7295a1f7 233 char buffer[20];
ram54288 0:a2cb7295a1f7 234 int size = sprintf(buffer,"%d",_value);
ram54288 0:a2cb7295a1f7 235 res->set_operation(M2MBase::GET_PUT_POST_ALLOWED);
ram54288 0:a2cb7295a1f7 236 res->set_value((const uint8_t*)buffer,
ram54288 0:a2cb7295a1f7 237 (const uint32_t)size);
ram54288 0:a2cb7295a1f7 238 res->set_execute_function(execute_callback(this,&MbedClient::execute_function));
ram54288 0:a2cb7295a1f7 239 _value++;
ram54288 0:a2cb7295a1f7 240
ram54288 0:a2cb7295a1f7 241 inst->create_static_resource("Static",
ram54288 0:a2cb7295a1f7 242 "ResourceTest",
ram54288 0:a2cb7295a1f7 243 M2MResourceInstance::STRING,
ram54288 0:a2cb7295a1f7 244 STATIC_VALUE,
ram54288 0:a2cb7295a1f7 245 sizeof(STATIC_VALUE)-1);
ram54288 0:a2cb7295a1f7 246 }
ram54288 0:a2cb7295a1f7 247 }
ram54288 0:a2cb7295a1f7 248 return _object;
ram54288 0:a2cb7295a1f7 249 }
ram54288 0:a2cb7295a1f7 250
ram54288 0:a2cb7295a1f7 251 void MbedClient::update_resource() {
ram54288 0:a2cb7295a1f7 252 if(_object) {
ram54288 0:a2cb7295a1f7 253 M2MObjectInstance* inst = _object->object_instance();
ram54288 0:a2cb7295a1f7 254 if(inst) {
ram54288 0:a2cb7295a1f7 255 M2MResource* res = inst->resource("Dynamic");
ram54288 0:a2cb7295a1f7 256 if( res ){
ram54288 0:a2cb7295a1f7 257 char buffer[20];
ram54288 0:a2cb7295a1f7 258 int size = sprintf(buffer,"%d",_value);
ram54288 0:a2cb7295a1f7 259 res->set_value((const uint8_t*)buffer,
ram54288 0:a2cb7295a1f7 260 (const uint32_t)size);
ram54288 0:a2cb7295a1f7 261 _value++;
ram54288 0:a2cb7295a1f7 262 }
ram54288 0:a2cb7295a1f7 263 }
ram54288 0:a2cb7295a1f7 264 }
ram54288 0:a2cb7295a1f7 265 }
ram54288 0:a2cb7295a1f7 266
ram54288 0:a2cb7295a1f7 267 void MbedClient::test_register(M2MObjectList object_list){
ram54288 0:a2cb7295a1f7 268 if(_interface) {
ram54288 0:a2cb7295a1f7 269 _interface->register_object(_register_security, object_list);
ram54288 0:a2cb7295a1f7 270 }
ram54288 0:a2cb7295a1f7 271 }
ram54288 0:a2cb7295a1f7 272
ram54288 0:a2cb7295a1f7 273 void MbedClient::set_register_object(M2MSecurity *&register_object){
ram54288 0:a2cb7295a1f7 274 if(_register_security) {
ram54288 0:a2cb7295a1f7 275 delete _register_security;
ram54288 0:a2cb7295a1f7 276 _register_security = NULL;
ram54288 0:a2cb7295a1f7 277 }
ram54288 0:a2cb7295a1f7 278 _register_security = register_object;
ram54288 0:a2cb7295a1f7 279
ram54288 0:a2cb7295a1f7 280 }
ram54288 0:a2cb7295a1f7 281
ram54288 0:a2cb7295a1f7 282 void MbedClient::test_update_register() {
ram54288 0:a2cb7295a1f7 283 uint32_t updated_lifetime = 20;
ram54288 0:a2cb7295a1f7 284 _registered = false;
ram54288 0:a2cb7295a1f7 285 _unregistered = false;
ram54288 0:a2cb7295a1f7 286 if(_interface){
ram54288 0:a2cb7295a1f7 287 _interface->update_registration(_register_security,updated_lifetime);
ram54288 0:a2cb7295a1f7 288 }
ram54288 0:a2cb7295a1f7 289 }
ram54288 0:a2cb7295a1f7 290
ram54288 0:a2cb7295a1f7 291 void MbedClient::test_unregister() {
ram54288 0:a2cb7295a1f7 292 if(_interface) {
ram54288 0:a2cb7295a1f7 293 _interface->unregister_object(NULL);
ram54288 0:a2cb7295a1f7 294 }
ram54288 0:a2cb7295a1f7 295 }
ram54288 0:a2cb7295a1f7 296
ram54288 0:a2cb7295a1f7 297 void MbedClient::bootstrap_done(M2MSecurity *server_object){
ram54288 0:a2cb7295a1f7 298 if(server_object) {
ram54288 0:a2cb7295a1f7 299 set_register_object(server_object);
ram54288 0:a2cb7295a1f7 300 _bootstrapped = true;
ram54288 0:a2cb7295a1f7 301 _error = false;
ram54288 0:a2cb7295a1f7 302 printf("\nBootstrapped\n");
ram54288 0:a2cb7295a1f7 303 }
ram54288 0:a2cb7295a1f7 304 }
ram54288 0:a2cb7295a1f7 305
ram54288 0:a2cb7295a1f7 306 void MbedClient::object_registered(M2MSecurity */*security_object*/, const M2MServer &/*server_object*/){
ram54288 0:a2cb7295a1f7 307 _registered = true;
ram54288 0:a2cb7295a1f7 308 _unregistered = false;
ram54288 0:a2cb7295a1f7 309 printf("\nRegistered\n");
ram54288 0:a2cb7295a1f7 310 }
ram54288 0:a2cb7295a1f7 311
ram54288 0:a2cb7295a1f7 312 void MbedClient::object_unregistered(M2MSecurity */*server_object*/){
ram54288 0:a2cb7295a1f7 313 _unregistered = true;
ram54288 0:a2cb7295a1f7 314 _registered = false;
ram54288 0:a2cb7295a1f7 315
ram54288 0:a2cb7295a1f7 316 #ifdef TARGET_LIKE_MBED
ram54288 0:a2cb7295a1f7 317 notify_completion(_unregistered);
ram54288 0:a2cb7295a1f7 318 minar::Scheduler::stop();
ram54288 0:a2cb7295a1f7 319 #endif
ram54288 0:a2cb7295a1f7 320 printf("\nUnregistered\n");
ram54288 0:a2cb7295a1f7 321 }
ram54288 0:a2cb7295a1f7 322
ram54288 0:a2cb7295a1f7 323 void MbedClient::registration_updated(M2MSecurity */*security_object*/, const M2MServer & /*server_object*/){
ram54288 0:a2cb7295a1f7 324 _registration_updated = true;
ram54288 0:a2cb7295a1f7 325 printf("\nregistration updated\n");
ram54288 0:a2cb7295a1f7 326 }
ram54288 0:a2cb7295a1f7 327
ram54288 0:a2cb7295a1f7 328 void MbedClient::error(M2MInterface::Error error){
ram54288 0:a2cb7295a1f7 329 _error = true;
ram54288 0:a2cb7295a1f7 330 printf("\nError occured Error code %d\n", (int)error);
ram54288 0:a2cb7295a1f7 331 }
ram54288 0:a2cb7295a1f7 332
ram54288 0:a2cb7295a1f7 333 void MbedClient::value_updated(M2MBase *base, M2MBase::BaseType type) {
ram54288 0:a2cb7295a1f7 334 printf("\nValue updated of Object name %s and Type %d\n",
ram54288 0:a2cb7295a1f7 335 base->name(), type);
ram54288 0:a2cb7295a1f7 336 }