Toyomasa Watarai
/
Mbed-example-WS-W27
simple-mbed-cloud-client/mbed-cloud-client/source/include/ConnectorClient.h@0:119624335925, 2018-06-30 (annotated)
- Committer:
- MACRUM
- Date:
- Sat Jun 30 01:40:30 2018 +0000
- Revision:
- 0:119624335925
Initial commit
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
MACRUM | 0:119624335925 | 1 | // ---------------------------------------------------------------------------- |
MACRUM | 0:119624335925 | 2 | // Copyright 2016-2017 ARM Ltd. |
MACRUM | 0:119624335925 | 3 | // |
MACRUM | 0:119624335925 | 4 | // SPDX-License-Identifier: Apache-2.0 |
MACRUM | 0:119624335925 | 5 | // |
MACRUM | 0:119624335925 | 6 | // Licensed under the Apache License, Version 2.0 (the "License"); |
MACRUM | 0:119624335925 | 7 | // you may not use this file except in compliance with the License. |
MACRUM | 0:119624335925 | 8 | // You may obtain a copy of the License at |
MACRUM | 0:119624335925 | 9 | // |
MACRUM | 0:119624335925 | 10 | // http://www.apache.org/licenses/LICENSE-2.0 |
MACRUM | 0:119624335925 | 11 | // |
MACRUM | 0:119624335925 | 12 | // Unless required by applicable law or agreed to in writing, software |
MACRUM | 0:119624335925 | 13 | // distributed under the License is distributed on an "AS IS" BASIS, |
MACRUM | 0:119624335925 | 14 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
MACRUM | 0:119624335925 | 15 | // See the License for the specific language governing permissions and |
MACRUM | 0:119624335925 | 16 | // limitations under the License. |
MACRUM | 0:119624335925 | 17 | // ---------------------------------------------------------------------------- |
MACRUM | 0:119624335925 | 18 | |
MACRUM | 0:119624335925 | 19 | #ifndef __CONNECTOR_CLIENT_H__ |
MACRUM | 0:119624335925 | 20 | #define __CONNECTOR_CLIENT_H__ |
MACRUM | 0:119624335925 | 21 | |
MACRUM | 0:119624335925 | 22 | #include "mbed-client/functionpointer.h" |
MACRUM | 0:119624335925 | 23 | #include "mbed-client/m2minterfacefactory.h" |
MACRUM | 0:119624335925 | 24 | #include "mbed-client/m2mdevice.h" |
MACRUM | 0:119624335925 | 25 | #include "mbed-client/m2minterfaceobserver.h" |
MACRUM | 0:119624335925 | 26 | #include "mbed-client/m2minterface.h" |
MACRUM | 0:119624335925 | 27 | #include "mbed-client/m2mobjectinstance.h" |
MACRUM | 0:119624335925 | 28 | #include "mbed-client/m2mresource.h" |
MACRUM | 0:119624335925 | 29 | #include "mbed-client/m2mtimerobserver.h" |
MACRUM | 0:119624335925 | 30 | #include "mbed-client/m2mtimer.h" |
MACRUM | 0:119624335925 | 31 | #include "include/CloudClientStorage.h" |
MACRUM | 0:119624335925 | 32 | |
MACRUM | 0:119624335925 | 33 | class ConnectorClientCallback; |
MACRUM | 0:119624335925 | 34 | |
MACRUM | 0:119624335925 | 35 | using namespace std; |
MACRUM | 0:119624335925 | 36 | |
MACRUM | 0:119624335925 | 37 | |
MACRUM | 0:119624335925 | 38 | /** |
MACRUM | 0:119624335925 | 39 | * \brief ConnectorClientEndpointInfo |
MACRUM | 0:119624335925 | 40 | * A structure that contains the needed endpoint information to register with the Cloud service. |
MACRUM | 0:119624335925 | 41 | * Note: this should be changed to a class instead of struct and/or members changed to "const char*". |
MACRUM | 0:119624335925 | 42 | */ |
MACRUM | 0:119624335925 | 43 | struct ConnectorClientEndpointInfo { |
MACRUM | 0:119624335925 | 44 | |
MACRUM | 0:119624335925 | 45 | public: |
MACRUM | 0:119624335925 | 46 | ConnectorClientEndpointInfo(M2MSecurity::SecurityModeType m) : mode(m) {}; |
MACRUM | 0:119624335925 | 47 | ~ConnectorClientEndpointInfo() {}; |
MACRUM | 0:119624335925 | 48 | |
MACRUM | 0:119624335925 | 49 | public: |
MACRUM | 0:119624335925 | 50 | |
MACRUM | 0:119624335925 | 51 | String endpoint_name; |
MACRUM | 0:119624335925 | 52 | String account_id; |
MACRUM | 0:119624335925 | 53 | String internal_endpoint_name; |
MACRUM | 0:119624335925 | 54 | M2MSecurity::SecurityModeType mode; |
MACRUM | 0:119624335925 | 55 | }; |
MACRUM | 0:119624335925 | 56 | |
MACRUM | 0:119624335925 | 57 | /** |
MACRUM | 0:119624335925 | 58 | * \brief ConnectorClient |
MACRUM | 0:119624335925 | 59 | * This class is an interface towards the M2MInterface client to handle all |
MACRUM | 0:119624335925 | 60 | * data flow towards Connector through this client. |
MACRUM | 0:119624335925 | 61 | * This class is intended to be used via ServiceClient, not directly. |
MACRUM | 0:119624335925 | 62 | * This class contains also the bootstrap functionality. |
MACRUM | 0:119624335925 | 63 | */ |
MACRUM | 0:119624335925 | 64 | class ConnectorClient : public M2MInterfaceObserver, public M2MTimerObserver { |
MACRUM | 0:119624335925 | 65 | |
MACRUM | 0:119624335925 | 66 | public: |
MACRUM | 0:119624335925 | 67 | /** |
MACRUM | 0:119624335925 | 68 | * \brief An enum defining the different states of |
MACRUM | 0:119624335925 | 69 | * ConnectorClient during the client flow. |
MACRUM | 0:119624335925 | 70 | */ |
MACRUM | 0:119624335925 | 71 | enum StartupSubStateRegistration { |
MACRUM | 0:119624335925 | 72 | State_Bootstrap_Start, |
MACRUM | 0:119624335925 | 73 | State_Bootstrap_Started, |
MACRUM | 0:119624335925 | 74 | State_Bootstrap_Success, |
MACRUM | 0:119624335925 | 75 | State_Bootstrap_Failure, |
MACRUM | 0:119624335925 | 76 | State_Registration_Start, |
MACRUM | 0:119624335925 | 77 | State_Registration_Started, |
MACRUM | 0:119624335925 | 78 | State_Registration_Success, |
MACRUM | 0:119624335925 | 79 | State_Registration_Failure, |
MACRUM | 0:119624335925 | 80 | State_Registration_Updated, |
MACRUM | 0:119624335925 | 81 | State_Unregistered |
MACRUM | 0:119624335925 | 82 | }; |
MACRUM | 0:119624335925 | 83 | |
MACRUM | 0:119624335925 | 84 | public: |
MACRUM | 0:119624335925 | 85 | |
MACRUM | 0:119624335925 | 86 | /** |
MACRUM | 0:119624335925 | 87 | * \brief Constructor. |
MACRUM | 0:119624335925 | 88 | * \param callback, A callback for the status from ConnectorClient. |
MACRUM | 0:119624335925 | 89 | */ |
MACRUM | 0:119624335925 | 90 | ConnectorClient(ConnectorClientCallback* callback); |
MACRUM | 0:119624335925 | 91 | |
MACRUM | 0:119624335925 | 92 | /** |
MACRUM | 0:119624335925 | 93 | * \brief Destructor. |
MACRUM | 0:119624335925 | 94 | */ |
MACRUM | 0:119624335925 | 95 | ~ConnectorClient(); |
MACRUM | 0:119624335925 | 96 | |
MACRUM | 0:119624335925 | 97 | /** |
MACRUM | 0:119624335925 | 98 | * \brief Starts the bootstrap sequence from the Service Client. |
MACRUM | 0:119624335925 | 99 | */ |
MACRUM | 0:119624335925 | 100 | void start_bootstrap(); |
MACRUM | 0:119624335925 | 101 | |
MACRUM | 0:119624335925 | 102 | /** |
MACRUM | 0:119624335925 | 103 | * \brief Starts the registration sequence from the Service Client. |
MACRUM | 0:119624335925 | 104 | * \param client_objs, A list of objects to be registered with Cloud. |
MACRUM | 0:119624335925 | 105 | */ |
MACRUM | 0:119624335925 | 106 | void start_registration(M2MObjectList* client_objs); |
MACRUM | 0:119624335925 | 107 | |
MACRUM | 0:119624335925 | 108 | /** |
MACRUM | 0:119624335925 | 109 | * \brief Sends an update registration message to the LWM2M server. |
MACRUM | 0:119624335925 | 110 | */ |
MACRUM | 0:119624335925 | 111 | void update_registration(); |
MACRUM | 0:119624335925 | 112 | |
MACRUM | 0:119624335925 | 113 | /** |
MACRUM | 0:119624335925 | 114 | * \brief Returns the M2MInterface handler. |
MACRUM | 0:119624335925 | 115 | * \return M2MInterface, Handled for M2MInterface. |
MACRUM | 0:119624335925 | 116 | */ |
MACRUM | 0:119624335925 | 117 | M2MInterface * m2m_interface(); |
MACRUM | 0:119624335925 | 118 | |
MACRUM | 0:119624335925 | 119 | /** |
MACRUM | 0:119624335925 | 120 | * \brief Checks whether to use Bootstrap or direct Connector mode. |
MACRUM | 0:119624335925 | 121 | * \return True if bootstrap mode, False if direct Connector flow |
MACRUM | 0:119624335925 | 122 | */ |
MACRUM | 0:119624335925 | 123 | bool use_bootstrap(); |
MACRUM | 0:119624335925 | 124 | |
MACRUM | 0:119624335925 | 125 | /** |
MACRUM | 0:119624335925 | 126 | * \brief Checks whether to go connector registration flow |
MACRUM | 0:119624335925 | 127 | * \return True if connector credentials available otherwise false. |
MACRUM | 0:119624335925 | 128 | */ |
MACRUM | 0:119624335925 | 129 | bool connector_credentials_available(); |
MACRUM | 0:119624335925 | 130 | |
MACRUM | 0:119624335925 | 131 | /** |
MACRUM | 0:119624335925 | 132 | * \brief A utility function to generate the key name. |
MACRUM | 0:119624335925 | 133 | * \param key, The key to get the value for. |
MACRUM | 0:119624335925 | 134 | * \param endpoint, The name of the endpoint to be appended |
MACRUM | 0:119624335925 | 135 | * to the key. |
MACRUM | 0:119624335925 | 136 | * \param key_name, The [OUT] final key name. |
MACRUM | 0:119624335925 | 137 | * \return True if available, else false. |
MACRUM | 0:119624335925 | 138 | */ |
MACRUM | 0:119624335925 | 139 | bool get_key(const char *key, const char *endpoint, char *&key_name); |
MACRUM | 0:119624335925 | 140 | |
MACRUM | 0:119624335925 | 141 | /** |
MACRUM | 0:119624335925 | 142 | * \brief Returns pointer to the ConnectorClientEndpointInfo object. |
MACRUM | 0:119624335925 | 143 | * \return ConnectorClientEndpointInfo pointer. |
MACRUM | 0:119624335925 | 144 | */ |
MACRUM | 0:119624335925 | 145 | const ConnectorClientEndpointInfo *endpoint_info() const; |
MACRUM | 0:119624335925 | 146 | |
MACRUM | 0:119624335925 | 147 | public: |
MACRUM | 0:119624335925 | 148 | // implementation of M2MInterfaceObserver: |
MACRUM | 0:119624335925 | 149 | |
MACRUM | 0:119624335925 | 150 | /** |
MACRUM | 0:119624335925 | 151 | * \brief A callback indicating that the bootstap has been performed successfully. |
MACRUM | 0:119624335925 | 152 | * \param server_object, The server object that contains the information fetched |
MACRUM | 0:119624335925 | 153 | * about the LWM2M server from the bootstrap server. This object can be used |
MACRUM | 0:119624335925 | 154 | * to register with the LWM2M server. The object ownership is passed. |
MACRUM | 0:119624335925 | 155 | */ |
MACRUM | 0:119624335925 | 156 | virtual void bootstrap_done(M2MSecurity *server_object); |
MACRUM | 0:119624335925 | 157 | |
MACRUM | 0:119624335925 | 158 | /** |
MACRUM | 0:119624335925 | 159 | * \brief A callback indicating that the device object has been registered |
MACRUM | 0:119624335925 | 160 | * successfully with the LWM2M server. |
MACRUM | 0:119624335925 | 161 | * \param security_object, The server object on which the device object is |
MACRUM | 0:119624335925 | 162 | * registered. The object ownership is passed. |
MACRUM | 0:119624335925 | 163 | * \param server_object, An object containing information about the LWM2M server. |
MACRUM | 0:119624335925 | 164 | * The client maintains the object. |
MACRUM | 0:119624335925 | 165 | */ |
MACRUM | 0:119624335925 | 166 | virtual void object_registered(M2MSecurity *security_object, const M2MServer &server_object); |
MACRUM | 0:119624335925 | 167 | |
MACRUM | 0:119624335925 | 168 | /** |
MACRUM | 0:119624335925 | 169 | * \brief A callback indicating that the device object has been successfully unregistered |
MACRUM | 0:119624335925 | 170 | * from the LWM2M server. |
MACRUM | 0:119624335925 | 171 | * \param server_object, The server object from which the device object is |
MACRUM | 0:119624335925 | 172 | * unregistered. The object ownership is passed. |
MACRUM | 0:119624335925 | 173 | */ |
MACRUM | 0:119624335925 | 174 | virtual void object_unregistered(M2MSecurity *server_object); |
MACRUM | 0:119624335925 | 175 | |
MACRUM | 0:119624335925 | 176 | /** |
MACRUM | 0:119624335925 | 177 | * \brief A callback indicating that the device object registration has been successfully |
MACRUM | 0:119624335925 | 178 | * updated on the LWM2M server. |
MACRUM | 0:119624335925 | 179 | * \param security_object, The server object on which the device object registration is |
MACRUM | 0:119624335925 | 180 | * updated. The object ownership is passed. |
MACRUM | 0:119624335925 | 181 | * \param server_object, An object containing information about the LWM2M server. |
MACRUM | 0:119624335925 | 182 | * The client maintains the object. |
MACRUM | 0:119624335925 | 183 | */ |
MACRUM | 0:119624335925 | 184 | virtual void registration_updated(M2MSecurity *security_object, const M2MServer & server_object); |
MACRUM | 0:119624335925 | 185 | |
MACRUM | 0:119624335925 | 186 | /** |
MACRUM | 0:119624335925 | 187 | * \brief A callback indicating that there was an error during the operation. |
MACRUM | 0:119624335925 | 188 | * \param error, An error code for the occurred error. |
MACRUM | 0:119624335925 | 189 | */ |
MACRUM | 0:119624335925 | 190 | virtual void error(M2MInterface::Error error); |
MACRUM | 0:119624335925 | 191 | |
MACRUM | 0:119624335925 | 192 | /** |
MACRUM | 0:119624335925 | 193 | * \brief A callback indicating that the value of the resource object is updated by the server. |
MACRUM | 0:119624335925 | 194 | * \param base, The object whose value is updated. |
MACRUM | 0:119624335925 | 195 | * \param type, The type of the object. |
MACRUM | 0:119624335925 | 196 | */ |
MACRUM | 0:119624335925 | 197 | virtual void value_updated(M2MBase *base, M2MBase::BaseType type); |
MACRUM | 0:119624335925 | 198 | |
MACRUM | 0:119624335925 | 199 | protected: // from M2MTimerObserver |
MACRUM | 0:119624335925 | 200 | |
MACRUM | 0:119624335925 | 201 | virtual void timer_expired(M2MTimerObserver::Type type); |
MACRUM | 0:119624335925 | 202 | |
MACRUM | 0:119624335925 | 203 | private: |
MACRUM | 0:119624335925 | 204 | /** |
MACRUM | 0:119624335925 | 205 | * \brief Redirects the state machine to right function. |
MACRUM | 0:119624335925 | 206 | * \param current_state, The current state to be set. |
MACRUM | 0:119624335925 | 207 | * \param data, The data to be passed to the state function. |
MACRUM | 0:119624335925 | 208 | */ |
MACRUM | 0:119624335925 | 209 | void state_function(StartupSubStateRegistration current_state); |
MACRUM | 0:119624335925 | 210 | |
MACRUM | 0:119624335925 | 211 | /** |
MACRUM | 0:119624335925 | 212 | * \brief The state engine maintaining the state machine logic. |
MACRUM | 0:119624335925 | 213 | */ |
MACRUM | 0:119624335925 | 214 | void state_engine(void); |
MACRUM | 0:119624335925 | 215 | |
MACRUM | 0:119624335925 | 216 | /** |
MACRUM | 0:119624335925 | 217 | * \brief An internal event generated by the state machine. |
MACRUM | 0:119624335925 | 218 | * \param new_state, The new state to which the state machine should go. |
MACRUM | 0:119624335925 | 219 | * \param data, The data to be passed to the state machine. |
MACRUM | 0:119624335925 | 220 | */ |
MACRUM | 0:119624335925 | 221 | void internal_event(StartupSubStateRegistration new_state); |
MACRUM | 0:119624335925 | 222 | |
MACRUM | 0:119624335925 | 223 | /** |
MACRUM | 0:119624335925 | 224 | * When the bootstrap starts. |
MACRUM | 0:119624335925 | 225 | */ |
MACRUM | 0:119624335925 | 226 | void state_bootstrap_start(); |
MACRUM | 0:119624335925 | 227 | |
MACRUM | 0:119624335925 | 228 | /** |
MACRUM | 0:119624335925 | 229 | * When the bootstrap is started. |
MACRUM | 0:119624335925 | 230 | */ |
MACRUM | 0:119624335925 | 231 | void state_bootstrap_started(); |
MACRUM | 0:119624335925 | 232 | |
MACRUM | 0:119624335925 | 233 | /** |
MACRUM | 0:119624335925 | 234 | * When the bootstrap is successful. |
MACRUM | 0:119624335925 | 235 | */ |
MACRUM | 0:119624335925 | 236 | void state_bootstrap_success(); |
MACRUM | 0:119624335925 | 237 | |
MACRUM | 0:119624335925 | 238 | /** |
MACRUM | 0:119624335925 | 239 | * When the bootstrap failed. |
MACRUM | 0:119624335925 | 240 | */ |
MACRUM | 0:119624335925 | 241 | void state_bootstrap_failure(); |
MACRUM | 0:119624335925 | 242 | |
MACRUM | 0:119624335925 | 243 | /** |
MACRUM | 0:119624335925 | 244 | * When the registration starts. |
MACRUM | 0:119624335925 | 245 | */ |
MACRUM | 0:119624335925 | 246 | void state_registration_start(); |
MACRUM | 0:119624335925 | 247 | |
MACRUM | 0:119624335925 | 248 | /** |
MACRUM | 0:119624335925 | 249 | * When the registration started. |
MACRUM | 0:119624335925 | 250 | */ |
MACRUM | 0:119624335925 | 251 | void state_registration_started(); |
MACRUM | 0:119624335925 | 252 | |
MACRUM | 0:119624335925 | 253 | /** |
MACRUM | 0:119624335925 | 254 | * When the registration is successful. |
MACRUM | 0:119624335925 | 255 | */ |
MACRUM | 0:119624335925 | 256 | void state_registration_success(); |
MACRUM | 0:119624335925 | 257 | |
MACRUM | 0:119624335925 | 258 | /** |
MACRUM | 0:119624335925 | 259 | * When the registration failed. |
MACRUM | 0:119624335925 | 260 | */ |
MACRUM | 0:119624335925 | 261 | void state_registration_failure(); |
MACRUM | 0:119624335925 | 262 | |
MACRUM | 0:119624335925 | 263 | /** |
MACRUM | 0:119624335925 | 264 | * When the client is unregistered. |
MACRUM | 0:119624335925 | 265 | */ |
MACRUM | 0:119624335925 | 266 | void state_unregistered(); |
MACRUM | 0:119624335925 | 267 | |
MACRUM | 0:119624335925 | 268 | /** |
MACRUM | 0:119624335925 | 269 | * \brief A utility function to create an M2MSecurity object |
MACRUM | 0:119624335925 | 270 | * for registration. |
MACRUM | 0:119624335925 | 271 | */ |
MACRUM | 0:119624335925 | 272 | void create_register_object(); |
MACRUM | 0:119624335925 | 273 | |
MACRUM | 0:119624335925 | 274 | /** |
MACRUM | 0:119624335925 | 275 | * \brief A utility function to create an M2MSecurity object |
MACRUM | 0:119624335925 | 276 | * for bootstrap. |
MACRUM | 0:119624335925 | 277 | */ |
MACRUM | 0:119624335925 | 278 | bool create_bootstrap_object(); |
MACRUM | 0:119624335925 | 279 | |
MACRUM | 0:119624335925 | 280 | /** |
MACRUM | 0:119624335925 | 281 | * \brief A utility function to set the connector credentials |
MACRUM | 0:119624335925 | 282 | * in storage. This includes endpoint, domain, connector URI |
MACRUM | 0:119624335925 | 283 | * and certificates. |
MACRUM | 0:119624335925 | 284 | * \param security, The Connector certificates. |
MACRUM | 0:119624335925 | 285 | */ |
MACRUM | 0:119624335925 | 286 | ccs_status_e set_connector_credentials(M2MSecurity *security); |
MACRUM | 0:119624335925 | 287 | |
MACRUM | 0:119624335925 | 288 | /** |
MACRUM | 0:119624335925 | 289 | * \brief A utility function to set the bootstrap credentials |
MACRUM | 0:119624335925 | 290 | * in storage. This includes Bootstrap URI and certificates. |
MACRUM | 0:119624335925 | 291 | * \param security, The Bootstrap certificates. |
MACRUM | 0:119624335925 | 292 | */ |
MACRUM | 0:119624335925 | 293 | ccs_status_e set_bootstrap_credentials(M2MSecurity *security); |
MACRUM | 0:119624335925 | 294 | |
MACRUM | 0:119624335925 | 295 | /** |
MACRUM | 0:119624335925 | 296 | * \brief A utility function to set the bootstrap address in storage. |
MACRUM | 0:119624335925 | 297 | * \param security, The bootstrap security object containing the address. |
MACRUM | 0:119624335925 | 298 | */ |
MACRUM | 0:119624335925 | 299 | ccs_status_e store_bootstrap_address(M2MSecurity *security); |
MACRUM | 0:119624335925 | 300 | |
MACRUM | 0:119624335925 | 301 | /** |
MACRUM | 0:119624335925 | 302 | * \brief A utility function to check whether bootstrap credentials are stored in KCM. |
MACRUM | 0:119624335925 | 303 | */ |
MACRUM | 0:119624335925 | 304 | bool bootstrap_credentials_stored_in_kcm(); |
MACRUM | 0:119624335925 | 305 | |
MACRUM | 0:119624335925 | 306 | /** |
MACRUM | 0:119624335925 | 307 | * \brief A utility function to check whether first to claim feature is configured. |
MACRUM | 0:119624335925 | 308 | */ |
MACRUM | 0:119624335925 | 309 | bool is_first_to_claim(); |
MACRUM | 0:119624335925 | 310 | |
MACRUM | 0:119624335925 | 311 | /** |
MACRUM | 0:119624335925 | 312 | * \brief A utility function to clear the first to claim parameter in storage. |
MACRUM | 0:119624335925 | 313 | */ |
MACRUM | 0:119624335925 | 314 | ccs_status_e clear_first_to_claim(); |
MACRUM | 0:119624335925 | 315 | |
MACRUM | 0:119624335925 | 316 | /** |
MACRUM | 0:119624335925 | 317 | * \brief Returns the binding mode selected by the client |
MACRUM | 0:119624335925 | 318 | * through the configuration. |
MACRUM | 0:119624335925 | 319 | * \return Binding mode of the client. |
MACRUM | 0:119624335925 | 320 | */ |
MACRUM | 0:119624335925 | 321 | static M2MInterface::BindingMode transport_mode(); |
MACRUM | 0:119624335925 | 322 | |
MACRUM | 0:119624335925 | 323 | private: |
MACRUM | 0:119624335925 | 324 | // A callback to be called after the sequence is complete. |
MACRUM | 0:119624335925 | 325 | ConnectorClientCallback* _callback; |
MACRUM | 0:119624335925 | 326 | StartupSubStateRegistration _current_state; |
MACRUM | 0:119624335925 | 327 | bool _event_generated; |
MACRUM | 0:119624335925 | 328 | bool _state_engine_running; |
MACRUM | 0:119624335925 | 329 | M2MInterface *_interface; |
MACRUM | 0:119624335925 | 330 | M2MSecurity *_security; |
MACRUM | 0:119624335925 | 331 | ConnectorClientEndpointInfo _endpoint_info; |
MACRUM | 0:119624335925 | 332 | M2MObjectList *_client_objs; |
MACRUM | 0:119624335925 | 333 | M2MTimer _rebootstrap_timer; |
MACRUM | 0:119624335925 | 334 | uint16_t _bootstrap_security_instance; |
MACRUM | 0:119624335925 | 335 | uint16_t _lwm2m_security_instance; |
MACRUM | 0:119624335925 | 336 | }; |
MACRUM | 0:119624335925 | 337 | |
MACRUM | 0:119624335925 | 338 | /** |
MACRUM | 0:119624335925 | 339 | * \brief ConnectorClientCallback |
MACRUM | 0:119624335925 | 340 | * A callback class for passing the client progress and error condition to the |
MACRUM | 0:119624335925 | 341 | * ServiceClient class object. |
MACRUM | 0:119624335925 | 342 | */ |
MACRUM | 0:119624335925 | 343 | class ConnectorClientCallback { |
MACRUM | 0:119624335925 | 344 | public: |
MACRUM | 0:119624335925 | 345 | |
MACRUM | 0:119624335925 | 346 | /** |
MACRUM | 0:119624335925 | 347 | * \brief Indicates that the registration or unregistration operation is complete |
MACRUM | 0:119624335925 | 348 | * with success or failure. |
MACRUM | 0:119624335925 | 349 | * \param status, Indicates success or failure in terms of status code. |
MACRUM | 0:119624335925 | 350 | */ |
MACRUM | 0:119624335925 | 351 | virtual void registration_process_result(ConnectorClient::StartupSubStateRegistration status) = 0; |
MACRUM | 0:119624335925 | 352 | |
MACRUM | 0:119624335925 | 353 | /** |
MACRUM | 0:119624335925 | 354 | * \brief Indicates the Connector error condition of an underlying M2MInterface client. |
MACRUM | 0:119624335925 | 355 | * \param error, Indicates an error code translated from M2MInterface::Error. |
MACRUM | 0:119624335925 | 356 | * \param reason, Indicates human readable text for error description. |
MACRUM | 0:119624335925 | 357 | */ |
MACRUM | 0:119624335925 | 358 | virtual void connector_error(M2MInterface::Error error, const char *reason) = 0; |
MACRUM | 0:119624335925 | 359 | |
MACRUM | 0:119624335925 | 360 | /** |
MACRUM | 0:119624335925 | 361 | * \brief A callback indicating that the value of the resource object is updated |
MACRUM | 0:119624335925 | 362 | * by the LWM2M Cloud server. |
MACRUM | 0:119624335925 | 363 | * \param base, The object whose value is updated. |
MACRUM | 0:119624335925 | 364 | * \param type, The type of the object. |
MACRUM | 0:119624335925 | 365 | */ |
MACRUM | 0:119624335925 | 366 | virtual void value_updated(M2MBase *base, M2MBase::BaseType type) = 0; |
MACRUM | 0:119624335925 | 367 | }; |
MACRUM | 0:119624335925 | 368 | |
MACRUM | 0:119624335925 | 369 | #endif // !__CONNECTOR_CLIENT_H__ |