leo hendrickson / Mbed OS example-Ethernet-mbed-Cloud-connect
Committer:
leothedragon
Date:
Tue May 04 08:55:12 2021 +0000
Revision:
0:8f0bb79ddd48
nmn

Who changed what in which revision?

UserRevisionLine numberNew contents of line
leothedragon 0:8f0bb79ddd48 1 /*
leothedragon 0:8f0bb79ddd48 2 * Copyright (c) 2015 ARM Limited. All rights reserved.
leothedragon 0:8f0bb79ddd48 3 * SPDX-License-Identifier: Apache-2.0
leothedragon 0:8f0bb79ddd48 4 * Licensed under the Apache License, Version 2.0 (the License); you may
leothedragon 0:8f0bb79ddd48 5 * not use this file except in compliance with the License.
leothedragon 0:8f0bb79ddd48 6 * You may obtain a copy of the License at
leothedragon 0:8f0bb79ddd48 7 *
leothedragon 0:8f0bb79ddd48 8 * http://www.apache.org/licenses/LICENSE-2.0
leothedragon 0:8f0bb79ddd48 9 *
leothedragon 0:8f0bb79ddd48 10 * Unless required by applicable law or agreed to in writing, software
leothedragon 0:8f0bb79ddd48 11 * distributed under the License is distributed on an AS IS BASIS, WITHOUT
leothedragon 0:8f0bb79ddd48 12 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
leothedragon 0:8f0bb79ddd48 13 * See the License for the specific language governing permissions and
leothedragon 0:8f0bb79ddd48 14 * limitations under the License.
leothedragon 0:8f0bb79ddd48 15 */
leothedragon 0:8f0bb79ddd48 16 #ifndef M2M_NSDL_OBSERVER_H
leothedragon 0:8f0bb79ddd48 17 #define M2M_NSDL_OBSERVER_H
leothedragon 0:8f0bb79ddd48 18
leothedragon 0:8f0bb79ddd48 19 #include "include/nsdllinker.h"
leothedragon 0:8f0bb79ddd48 20
leothedragon 0:8f0bb79ddd48 21 //FORWARD DECLARATION
leothedragon 0:8f0bb79ddd48 22 class M2MSecurity;
leothedragon 0:8f0bb79ddd48 23 class M2MServer;
leothedragon 0:8f0bb79ddd48 24
leothedragon 0:8f0bb79ddd48 25 /**
leothedragon 0:8f0bb79ddd48 26 * @brief Observer class for informing NSDL callback to the state machine
leothedragon 0:8f0bb79ddd48 27 */
leothedragon 0:8f0bb79ddd48 28
leothedragon 0:8f0bb79ddd48 29 class M2MNsdlObserver
leothedragon 0:8f0bb79ddd48 30 {
leothedragon 0:8f0bb79ddd48 31
leothedragon 0:8f0bb79ddd48 32 public :
leothedragon 0:8f0bb79ddd48 33
leothedragon 0:8f0bb79ddd48 34 /**
leothedragon 0:8f0bb79ddd48 35 * @brief Informs that coap message is ready.
leothedragon 0:8f0bb79ddd48 36 * @param data_ptr, Data object of coap message.
leothedragon 0:8f0bb79ddd48 37 * @param data_len, Length of the data object.
leothedragon 0:8f0bb79ddd48 38 * @param address_ptr, Address structure of the server.
leothedragon 0:8f0bb79ddd48 39 */
leothedragon 0:8f0bb79ddd48 40 virtual void coap_message_ready(uint8_t *data_ptr,
leothedragon 0:8f0bb79ddd48 41 uint16_t data_len,
leothedragon 0:8f0bb79ddd48 42 sn_nsdl_addr_s *address_ptr) = 0;
leothedragon 0:8f0bb79ddd48 43
leothedragon 0:8f0bb79ddd48 44 /**
leothedragon 0:8f0bb79ddd48 45 * @brief Informs that client is registered successfully.
leothedragon 0:8f0bb79ddd48 46 * @param server_object, Server object associated with
leothedragon 0:8f0bb79ddd48 47 * registered server.
leothedragon 0:8f0bb79ddd48 48 */
leothedragon 0:8f0bb79ddd48 49 virtual void client_registered(M2MServer *server_object) = 0;
leothedragon 0:8f0bb79ddd48 50
leothedragon 0:8f0bb79ddd48 51 /**
leothedragon 0:8f0bb79ddd48 52 * @brief Informs that client registration is updated successfully.
leothedragon 0:8f0bb79ddd48 53 * @param server_object, Server object associated with
leothedragon 0:8f0bb79ddd48 54 * registered server.
leothedragon 0:8f0bb79ddd48 55 */
leothedragon 0:8f0bb79ddd48 56 virtual void registration_updated(const M2MServer &server_object) = 0;
leothedragon 0:8f0bb79ddd48 57
leothedragon 0:8f0bb79ddd48 58 /**
leothedragon 0:8f0bb79ddd48 59 * @brief Informs that some error occured during
leothedragon 0:8f0bb79ddd48 60 * registration.
leothedragon 0:8f0bb79ddd48 61 * @param error_code, Error code for registration error
leothedragon 0:8f0bb79ddd48 62 * @param retry, Indicates state machine to re-establish connection
leothedragon 0:8f0bb79ddd48 63 * @param full_registration, Indicates that after DTLS handshake continue with a full registration
leothedragon 0:8f0bb79ddd48 64 */
leothedragon 0:8f0bb79ddd48 65 virtual void registration_error(uint8_t error_code, bool retry = false, bool full_registration = false) = 0;
leothedragon 0:8f0bb79ddd48 66
leothedragon 0:8f0bb79ddd48 67 /**
leothedragon 0:8f0bb79ddd48 68 * @brief Informs that client is unregistered successfully.
leothedragon 0:8f0bb79ddd48 69 */
leothedragon 0:8f0bb79ddd48 70 virtual void client_unregistered() = 0;
leothedragon 0:8f0bb79ddd48 71
leothedragon 0:8f0bb79ddd48 72 /**
leothedragon 0:8f0bb79ddd48 73 * @brief Informs that client bootstrapping is done.
leothedragon 0:8f0bb79ddd48 74 * @param security_object, M2MSecurity Object which contains information about
leothedragon 0:8f0bb79ddd48 75 * LWM2M server fetched from bootstrap server.
leothedragon 0:8f0bb79ddd48 76 */
leothedragon 0:8f0bb79ddd48 77 virtual void bootstrap_done() = 0;
leothedragon 0:8f0bb79ddd48 78
leothedragon 0:8f0bb79ddd48 79 /**
leothedragon 0:8f0bb79ddd48 80 * @brief Informs that client bootstrap data has been received and final bootstrap
leothedragon 0:8f0bb79ddd48 81 * finish message has been handled.
leothedragon 0:8f0bb79ddd48 82 */
leothedragon 0:8f0bb79ddd48 83 virtual void bootstrap_finish() = 0;
leothedragon 0:8f0bb79ddd48 84
leothedragon 0:8f0bb79ddd48 85 /**
leothedragon 0:8f0bb79ddd48 86 * @brief Informs that client bootstrapping is waiting for message to be sent.
leothedragon 0:8f0bb79ddd48 87 * @param security_object, M2MSecurity Object which contains information about
leothedragon 0:8f0bb79ddd48 88 * LWM2M server fetched from bootstrap server.
leothedragon 0:8f0bb79ddd48 89 */
leothedragon 0:8f0bb79ddd48 90 virtual void bootstrap_wait() = 0;
leothedragon 0:8f0bb79ddd48 91
leothedragon 0:8f0bb79ddd48 92 /**
leothedragon 0:8f0bb79ddd48 93 * @brief Informs that client bootstrapping is waiting for error message to be sent.
leothedragon 0:8f0bb79ddd48 94 * @param reason, Error description.
leothedragon 0:8f0bb79ddd48 95 */
leothedragon 0:8f0bb79ddd48 96 virtual void bootstrap_error_wait(const char *reason) = 0;
leothedragon 0:8f0bb79ddd48 97
leothedragon 0:8f0bb79ddd48 98 /**
leothedragon 0:8f0bb79ddd48 99 * @brief Informs that some error occured during
leothedragon 0:8f0bb79ddd48 100 * bootstrapping.
leothedragon 0:8f0bb79ddd48 101 * @param reason, Error string explaining the failure reason
leothedragon 0:8f0bb79ddd48 102 */
leothedragon 0:8f0bb79ddd48 103 virtual void bootstrap_error(const char *reason) = 0;
leothedragon 0:8f0bb79ddd48 104
leothedragon 0:8f0bb79ddd48 105 /**
leothedragon 0:8f0bb79ddd48 106 * @brief Informs that received data has been processed.
leothedragon 0:8f0bb79ddd48 107 */
leothedragon 0:8f0bb79ddd48 108 virtual void coap_data_processed() = 0;
leothedragon 0:8f0bb79ddd48 109
leothedragon 0:8f0bb79ddd48 110 /**
leothedragon 0:8f0bb79ddd48 111 * @brief Callback informing that the value of the resource object is updated by server.
leothedragon 0:8f0bb79ddd48 112 * @param base Object whose value is updated.
leothedragon 0:8f0bb79ddd48 113 */
leothedragon 0:8f0bb79ddd48 114 virtual void value_updated(M2MBase *base) = 0;
leothedragon 0:8f0bb79ddd48 115 };
leothedragon 0:8f0bb79ddd48 116 #endif // M2M_NSDL_OBSERVER_H