Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Dependencies: mbed Socket lwip-eth lwip-sys lwip
Fork of 6_songs-from-the-cloud by
m2minterface.h
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 #ifndef M2M_INTERFACE_H 00017 #define M2M_INTERFACE_H 00018 00019 #include <stdint.h> 00020 #include "mbed-client/m2mvector.h" 00021 #include "mbed-client/m2mconfig.h" 00022 #include "mbed-client/functionpointer.h" 00023 00024 //FORWARD DECLARATION 00025 class M2MSecurity; 00026 class M2MObject; 00027 class M2MInterfaceObserver; 00028 00029 typedef Vector<M2MObject *> M2MObjectList; 00030 typedef FP callback_handler; 00031 00032 /** 00033 * @brief M2MInterface. 00034 * This class provides an interface for handling all the mbed Client Interface operations 00035 * defined in the OMA LWM2M specifications. 00036 * This includes Bootstrapping, Client Registration, Device Management & 00037 * Service Enablement and Information Reporting. 00038 */ 00039 00040 class M2MInterface { 00041 00042 public: 00043 00044 /** 00045 * @brief Enum defining different kinds of errors 00046 * that can occur during various client operations. 00047 */ 00048 typedef enum { 00049 ErrorNone = 0, 00050 AlreadyExists, 00051 BootstrapFailed, 00052 InvalidParameters, 00053 NotRegistered, 00054 Timeout, 00055 NetworkError, 00056 ResponseParseFailed, 00057 UnknownError, 00058 MemoryFail, 00059 NotAllowed 00060 }Error; 00061 00062 /** 00063 * @brief Enum defining different kinds of binding 00064 * modes handled for client operations. 00065 */ 00066 typedef enum { 00067 NOT_SET = 0, 00068 UDP = 0x01, 00069 UDP_QUEUE = 0x03, 00070 SMS = 0x04, 00071 SMS_QUEUE =0x06, 00072 UDP_SMS_QUEUE = 0x07, 00073 TCP = 0x08, //not real value, spec does not have one! 00074 TCP_QUEUE = 0x09 //not real value, spec does not have one! 00075 }BindingMode; 00076 00077 /** 00078 * @brief Enum defining different kinds of network 00079 * stacks that can be used by the mbed Client. 00080 */ 00081 typedef enum { 00082 Uninitialized = 0, 00083 LwIP_IPv4, 00084 LwIP_IPv6, 00085 Reserved, 00086 Nanostack_IPv6, 00087 Unknown 00088 }NetworkStack; 00089 00090 public: 00091 00092 virtual ~M2MInterface(){} 00093 00094 /** 00095 * @brief Initiates bootstrapping of the client with the provided Bootstrap 00096 * server information. 00097 * NOTE: This API is not supported for developers!! 00098 * @param security_object, Security object that contains information 00099 * required for successful bootstrapping of the client. 00100 */ 00101 virtual void bootstrap(M2MSecurity *security_object) = 0; 00102 00103 /** 00104 * @brief Cancels the ongoing bootstrapping operation of the client. If the client has 00105 * already successfully bootstrapped this function deletes the existing 00106 * bootstrap information from the client. 00107 * NOTE: This API is not supported for developers!! 00108 */ 00109 virtual void cancel_bootstrap() = 0; 00110 00111 /** 00112 * @brief Initiates the registration of the provided Security object to the 00113 * corresponding LWM2M server. 00114 * @param security_object, Security object that contains information 00115 * required for registering to the LWM2M server. 00116 * If the client wants to register to multiple LWM2M servers it must call 00117 * this function once for each of the LWM2M server objects separately. 00118 * @param object_list, Objects that contain information about the 00119 * client attempting to register to the LWM2M server. 00120 */ 00121 virtual void register_object(M2MSecurity *security_object, const M2MObjectList &object_list) = 0; 00122 00123 /** 00124 * @brief Updates or refreshes the client's registration on the LWM2M 00125 * server. 00126 * @param security_object, Security object from which the device object 00127 * needs to update registration. If there is only one LWM2M server registered 00128 * this parameter can be NULL. 00129 * @param lifetime, Lifetime for the endpoint client in seconds. If the same value 00130 * has to be passed then put the default value as 0. 00131 */ 00132 virtual void update_registration(M2MSecurity *security_object, const uint32_t lifetime = 0) = 0; 00133 00134 /** 00135 * @brief Unregisters the registered object from the LWM2M server. 00136 * @param security_object, Security object from which the device object 00137 * needs to be unregistered. If there is only one LWM2M server registered 00138 * this parameter can be NULL. 00139 */ 00140 virtual void unregister_object(M2MSecurity* security_object = NULL) = 0; 00141 00142 /** 00143 * @brief Sets the function that will be called for indicating that the client 00144 * is going to sleep when the Binding mode is selected with Queue mode. 00145 * @param callback, Function pointer that will be called when the client 00146 * goes to sleep. 00147 */ 00148 virtual void set_queue_sleep_handler(callback_handler handler) = 0; 00149 00150 }; 00151 00152 #endif // M2M_INTERFACE_H
Generated on Tue Jul 12 2022 12:47:47 by
