20 #ifndef __MBED_CLOUD_CLIENT_H__ 21 #define __MBED_CLOUD_CLIENT_H__ 23 #include "include/ServiceClient.h" 24 #ifndef MBED_CLIENT_DISABLE_EST_FEATURE 26 #endif // !MBED_CLIENT_DISABLE_EST_FEATURE 29 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 36 #include "certificate-enrollment-client/certificate-enrollment-client/ce_defs.h" 37 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 39 #if MBED_CLOUD_CLIENT_STL_API 45 #if MBED_CLOUD_CLIENT_STD_NAMESPACE_POLLUTION 53 class SimpleM2MResourceBase;
71 virtual void value_updated(M2MBase *base, M2MBase::BaseType type) = 0;
95 ConnectErrorNone = M2MInterface::ErrorNone,
98 ConnectAlreadyExists = M2MInterface::AlreadyExists,
102 ConnectBootstrapFailed = M2MInterface::BootstrapFailed,
106 ConnectInvalidParameters = M2MInterface::InvalidParameters,
110 ConnectNotRegistered = M2MInterface::NotRegistered,
114 ConnectTimeout = M2MInterface::Timeout,
118 ConnectNetworkError = M2MInterface::NetworkError,
122 ConnectResponseParseFailed = M2MInterface::ResponseParseFailed,
126 ConnectUnknownError = M2MInterface::UnknownError,
130 ConnectMemoryConnectFail = M2MInterface::MemoryFail,
134 ConnectNotAllowed = M2MInterface::NotAllowed,
138 ConnectSecureConnectionFailed = M2MInterface::SecureConnectionFailed,
142 ConnectDnsResolvingFailed = M2MInterface::DnsResolvingFailed,
145 ConnectorFailedToStoreCredentials = M2MInterface::FailedToStoreCredentials,
149 ConnectorFailedToReadCredentials = M2MInterface::FailedToReadCredentials,
152 ConnectorInvalidCredentials,
153 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 154 UpdateWarningNoActionRequired = UpdateClient::WarningBase,
155 UpdateWarningCertificateNotFound = UpdateClient::WarningCertificateNotFound,
156 UpdateWarningIdentityNotFound = UpdateClient::WarningIdentityNotFound,
157 UpdateWarningVendorMismatch = UpdateClient::WarningVendorMismatch,
158 UpdateWarningClassMismatch = UpdateClient::WarningClassMismatch,
159 UpdateWarningDeviceMismatch = UpdateClient::WarningDeviceMismatch,
160 UpdateWarningCertificateInvalid = UpdateClient::WarningCertificateInvalid,
161 UpdateWarningSignatureInvalid = UpdateClient::WarningSignatureInvalid,
162 UpdateWarningBadKeytable = UpdateClient::WarningBadKeytable,
163 UpdateWarningURINotFound = UpdateClient::WarningURINotFound,
164 UpdateWarningRollbackProtection = UpdateClient::WarningRollbackProtection,
165 UpdateWarningAuthorizationRejected = UpdateClient::WarningAuthorizationRejected,
166 UpdateWarningAuthorizationUnavailable = UpdateClient::WarningAuthorizationUnavailable,
167 UpdateWarningUnknown = UpdateClient::WarningUnknown,
168 UpdateCertificateInsertion = UpdateClient::WarningCertificateInsertion,
169 UpdateErrorUserActionRequired = UpdateClient::ErrorBase,
170 UpdateErrorWriteToStorage = UpdateClient::ErrorWriteToStorage,
171 UpdateErrorInvalidHash = UpdateClient::ErrorInvalidHash,
172 UpdateErrorConnection = UpdateClient::ErrorConnection,
173 UpdateFatalRebootRequired,
175 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 177 EnrollmentErrorBase = CE_STATUS_RANGE_BASE,
178 EnrollmentErrorEnd = CE_STATUS_RANGE_END
179 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 182 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 187 UpdateRequestInvalid = UpdateClient::RequestInvalid,
188 UpdateRequestDownload = UpdateClient::RequestDownload,
189 UpdateRequestInstall = UpdateClient::RequestInstall
211 void(*on_unregistered_cb)(
void),
212 void(*on_error_cb)(
int)
213 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
214 ,
void(*update_authorize_cb)(int32_t request) = NULL,
215 void(*update_progress_cb)(uint32_t progress, uint32_t total) = NULL
232 void add_objects(
const M2MObjectList& object_list);
242 void add_objects(
const M2MBaseList& base_list);
244 void remove_object(M2MBase *
object);
283 bool setup(
void* iface);
291 void on_registered(
void(*fn)(
void));
300 void on_registered(T *
object,
void (T::*member)(
void));
309 void on_error(
void(*fn)(
int));
319 void on_error(T *
object,
void (T::*member)(
int));
327 void on_unregistered(
void(*fn)(
void));
336 void on_unregistered(T *
object,
void (T::*member)(
void));
344 void on_registration_updated(
void(*fn)(
void));
354 void on_registration_updated(T *
object,
void (T::*member)(
void));
363 void keep_alive() m2m_deprecated;
371 void register_update();
383 const ConnectorClientEndpointInfo *endpoint_info()
const;
391 void set_queue_sleep_handler(callback_handler handler);
400 void set_random_number_callback(random_number_cb callback);
411 void set_entropy_callback(entropy_cb callback);
413 #if MBED_CLOUD_CLIENT_STL_API 424 bool set_device_resource_value(M2MDevice::DeviceResource resource,
425 const std::string &value) m2m_deprecated;
428 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 433 void set_update_authorize_handler(
void (*handler)(int32_t request));
439 void set_update_authorize_priority_handler(
void (*handler)(int32_t request, uint64_t priority));
445 void update_authorize(int32_t request);
452 void update_reject(int32_t request, int32_t reason);
458 void set_update_progress_handler(
void (*handler)(uint32_t progress, uint32_t total));
465 const char *error_description()
const;
476 void send_get_request(DownloadType type,
480 get_data_error_cb error_cb,
483 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 493 ce_status_e certificate_renew(
const char *cert_name);
500 void on_certificate_renewal(cert_renewal_cb_f user_cb);
501 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 503 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 509 const M2MBaseList *get_object_list()
const;
510 #endif // MBED_CLOUD_CLIENT_EDGE_EXTENSION 529 void resume(
void *iface);
531 #ifndef MBED_CLIENT_DISABLE_EST_FEATURE 542 est_status_e est_request_enrollment(
const char *cert_name,
543 const size_t cert_name_length,
545 const size_t csr_length,
546 est_enrollment_result_cb result_cb,
547 void *context)
const;
556 #endif // !MBED_CLIENT_DISABLE_EST_FEATURE 565 virtual void complete(ServiceClientCallbackStatus status);
572 virtual void error(
int error,
const char *reason);
580 virtual void value_updated(M2MBase *base, M2MBase::BaseType type);
590 #if MBED_CLOUD_CLIENT_STL_API 591 void register_update_callback(
string route, SimpleM2MResourceBase* resource) m2m_deprecated;
596 ServiceClient _client;
598 M2MBaseList _object_list;
599 FP0<void> _on_registered;
600 FP0<void> _on_unregistered;
601 FP0<void> _on_registration_updated;
602 FP1<void,int> _on_error;
603 const char *_error_description;
606 #if MBED_CLOUD_CLIENT_STL_API 609 map<string, M2MObject*> _objects;
610 map<string, M2MResource*> _resources;
611 map<string, SimpleM2MResourceBase*> _update_values;
613 friend class SimpleM2MResourceBase;
615 #endif // MBED_CLOUD_CLIENT_STL_API 621 FP0<void> fp(
object, member);
628 FP1<void, int> fp(
object, member);
635 FP0<void> fp(
object, member);
636 _on_unregistered = fp;
642 FP0<void> fp(
object, member);
643 _on_registration_updated = fp;
645 #endif // __MBED_CLOUD_CLIENT_H__ Configuration options (set of defines and values).
Error
An enum defining different kinds of errors that can occur during various client operations.
Definition: MbedCloudClient.h:93
void on_registration_updated(void(*fn)(void))
Set the callback function that is called when Device Management Client registration is updated succes...
void on_error(void(*fn)(int))
Set the callback function that is called when there is any error occuring in the client functionality...
MbedCloudClientCallback A callback class for informing updated Object and Resource value from the LwM...
Definition: MbedCloudClient.h:61
Definition: MbedCloudClient.h:85
Definition: est_defs.h:46
void on_unregistered(void(*fn)(void))
Set the callback function that is called when Device Management Client is unregistered successfully f...
void on_registered(void(*fn)(void))
Set the callback function that is called when Device Management Client is registered successfully to ...