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 #ifndef __MBED_CLIENT_H__
ram54288 0:a2cb7295a1f7 17 #define __MBED_CLIENT_H__
ram54288 0:a2cb7295a1f7 18
ram54288 0:a2cb7295a1f7 19 #undef SIXLOWPAN_INTERFACE
ram54288 0:a2cb7295a1f7 20
ram54288 0:a2cb7295a1f7 21 #include "mbed-client/m2minterfaceobserver.h"
ram54288 0:a2cb7295a1f7 22
ram54288 0:a2cb7295a1f7 23 #ifndef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 24 #include "mbed/DigitalOut.h"
ram54288 0:a2cb7295a1f7 25 #endif
ram54288 0:a2cb7295a1f7 26
ram54288 0:a2cb7295a1f7 27
ram54288 0:a2cb7295a1f7 28 //#define BOOTSTRAP_ENABLED
ram54288 0:a2cb7295a1f7 29
ram54288 0:a2cb7295a1f7 30 class M2MDevice;
ram54288 0:a2cb7295a1f7 31 class M2MSecurity;
ram54288 0:a2cb7295a1f7 32 class M2MObject;
ram54288 0:a2cb7295a1f7 33
ram54288 0:a2cb7295a1f7 34 class MbedClient: public M2MInterfaceObserver {
ram54288 0:a2cb7295a1f7 35 public:
ram54288 0:a2cb7295a1f7 36 MbedClient();
ram54288 0:a2cb7295a1f7 37
ram54288 0:a2cb7295a1f7 38 ~MbedClient();
ram54288 0:a2cb7295a1f7 39
ram54288 0:a2cb7295a1f7 40 bool create_interface();
ram54288 0:a2cb7295a1f7 41
ram54288 0:a2cb7295a1f7 42 bool bootstrap_successful();
ram54288 0:a2cb7295a1f7 43
ram54288 0:a2cb7295a1f7 44 bool register_successful();
ram54288 0:a2cb7295a1f7 45
ram54288 0:a2cb7295a1f7 46 bool unregister_successful();
ram54288 0:a2cb7295a1f7 47
ram54288 0:a2cb7295a1f7 48 bool registration_update_successful();
ram54288 0:a2cb7295a1f7 49
ram54288 0:a2cb7295a1f7 50 M2MSecurity* create_bootstrap_object(bool useSecureConnection);
ram54288 0:a2cb7295a1f7 51
ram54288 0:a2cb7295a1f7 52 M2MSecurity* create_register_object(bool useSecureConnection);
ram54288 0:a2cb7295a1f7 53
ram54288 0:a2cb7295a1f7 54 void test_bootstrap(M2MSecurity *security);
ram54288 0:a2cb7295a1f7 55
ram54288 0:a2cb7295a1f7 56 M2MDevice* create_device_object();
ram54288 0:a2cb7295a1f7 57
ram54288 0:a2cb7295a1f7 58 void execute_function(void *argument);
ram54288 0:a2cb7295a1f7 59
ram54288 0:a2cb7295a1f7 60 M2MObject* create_generic_object();
ram54288 0:a2cb7295a1f7 61
ram54288 0:a2cb7295a1f7 62 void update_resource();
ram54288 0:a2cb7295a1f7 63
ram54288 0:a2cb7295a1f7 64 void test_register(M2MObjectList object_list);
ram54288 0:a2cb7295a1f7 65
ram54288 0:a2cb7295a1f7 66 void set_register_object(M2MSecurity *&register_object);
ram54288 0:a2cb7295a1f7 67
ram54288 0:a2cb7295a1f7 68 void test_update_register();
ram54288 0:a2cb7295a1f7 69
ram54288 0:a2cb7295a1f7 70 void test_unregister();
ram54288 0:a2cb7295a1f7 71
ram54288 0:a2cb7295a1f7 72 //Callback from mbed client stack when the bootstrap
ram54288 0:a2cb7295a1f7 73 // is successful, it returns the mbed Device Server object
ram54288 0:a2cb7295a1f7 74 // which will be used for registering the resources to
ram54288 0:a2cb7295a1f7 75 // mbed Device server.
ram54288 0:a2cb7295a1f7 76 void bootstrap_done(M2MSecurity *server_object);
ram54288 0:a2cb7295a1f7 77
ram54288 0:a2cb7295a1f7 78 //Callback from mbed client stack when the registration
ram54288 0:a2cb7295a1f7 79 // is successful, it returns the mbed Device Server object
ram54288 0:a2cb7295a1f7 80 // to which the resources are registered and registered objects.
ram54288 0:a2cb7295a1f7 81 void object_registered(M2MSecurity */*security_object*/, const M2MServer &/*server_object*/);
ram54288 0:a2cb7295a1f7 82
ram54288 0:a2cb7295a1f7 83 //Callback from mbed client stack when the unregistration
ram54288 0:a2cb7295a1f7 84 // is successful, it returns the mbed Device Server object
ram54288 0:a2cb7295a1f7 85 // to which the resources were unregistered.
ram54288 0:a2cb7295a1f7 86 void object_unregistered(M2MSecurity */*server_object*/);
ram54288 0:a2cb7295a1f7 87
ram54288 0:a2cb7295a1f7 88 void registration_updated(M2MSecurity */*security_object*/, const M2MServer & /*server_object*/);
ram54288 0:a2cb7295a1f7 89
ram54288 0:a2cb7295a1f7 90 //Callback from mbed client stack if any error is encountered
ram54288 0:a2cb7295a1f7 91 // during any of the LWM2M operations. Error type is passed in
ram54288 0:a2cb7295a1f7 92 // the callback.
ram54288 0:a2cb7295a1f7 93 void error(M2MInterface::Error error);
ram54288 0:a2cb7295a1f7 94
ram54288 0:a2cb7295a1f7 95 //Callback from mbed client stack if any value has changed
ram54288 0:a2cb7295a1f7 96 // during PUT operation. Object and its type is passed in
ram54288 0:a2cb7295a1f7 97 // the callback.
ram54288 0:a2cb7295a1f7 98 void value_updated(M2MBase *base, M2MBase::BaseType type);
ram54288 0:a2cb7295a1f7 99
ram54288 0:a2cb7295a1f7 100 private:
ram54288 0:a2cb7295a1f7 101
ram54288 0:a2cb7295a1f7 102 #ifndef TARGET_LIKE_LINUX
ram54288 0:a2cb7295a1f7 103 mbed::DigitalOut _led;
ram54288 0:a2cb7295a1f7 104 #endif
ram54288 0:a2cb7295a1f7 105 M2MInterface *_interface;
ram54288 0:a2cb7295a1f7 106 M2MSecurity *_security;
ram54288 0:a2cb7295a1f7 107 M2MSecurity *_register_security;
ram54288 0:a2cb7295a1f7 108 M2MDevice *_device;
ram54288 0:a2cb7295a1f7 109 M2MObject *_object;
ram54288 0:a2cb7295a1f7 110 bool _bootstrapped;
ram54288 0:a2cb7295a1f7 111 bool _error;
ram54288 0:a2cb7295a1f7 112 bool _registered;
ram54288 0:a2cb7295a1f7 113 bool _unregistered;
ram54288 0:a2cb7295a1f7 114 bool _registration_updated;
ram54288 0:a2cb7295a1f7 115 int _value;
ram54288 0:a2cb7295a1f7 116 };
ram54288 0:a2cb7295a1f7 117
ram54288 0:a2cb7295a1f7 118
ram54288 0:a2cb7295a1f7 119
ram54288 0:a2cb7295a1f7 120 #endif //__MBED_CLIENT_H__