20 #ifndef __MBED_CLOUD_CLIENT_H__ 21 #define __MBED_CLOUD_CLIENT_H__ 25 #include "include/ServiceClient.h" 26 #ifndef MBED_CLIENT_DISABLE_EST_FEATURE 28 #endif // !MBED_CLIENT_DISABLE_EST_FEATURE 31 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 38 #include "certificate-enrollment-client/certificate-enrollment-client/ce_defs.h" 39 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 41 #ifdef MBED_CONF_MBED_CLOUD_CLIENT_ENABLE_DEVICE_SENTRY 42 #include "ds_status.h" 43 #endif // MBED_CONF_MBED_CLOUD_CLIENT_ENABLE_DEVICE_SENTRY 45 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 46 #include "multicast.h" 47 #endif // MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 49 #if MBED_CLOUD_CLIENT_STL_API 55 #if MBED_CLOUD_CLIENT_STD_NAMESPACE_POLLUTION 63 class SimpleM2MResourceBase;
81 virtual void value_updated(M2MBase *base, M2MBase::BaseType type) = 0;
117 ConnectErrorNone = M2MInterface::ErrorNone,
120 ConnectAlreadyExists = M2MInterface::AlreadyExists,
124 ConnectBootstrapFailed = M2MInterface::BootstrapFailed,
128 ConnectInvalidParameters = M2MInterface::InvalidParameters,
132 ConnectNotRegistered = M2MInterface::NotRegistered,
136 ConnectTimeout = M2MInterface::Timeout,
140 ConnectNetworkError = M2MInterface::NetworkError,
144 ConnectResponseParseFailed = M2MInterface::ResponseParseFailed,
148 ConnectUnknownError = M2MInterface::UnknownError,
152 ConnectMemoryConnectFail = M2MInterface::MemoryFail,
156 ConnectNotAllowed = M2MInterface::NotAllowed,
160 ConnectSecureConnectionFailed = M2MInterface::SecureConnectionFailed,
164 ConnectDnsResolvingFailed = M2MInterface::DnsResolvingFailed,
167 ConnectorFailedToStoreCredentials = M2MInterface::FailedToStoreCredentials,
171 ConnectorFailedToReadCredentials = M2MInterface::FailedToReadCredentials,
175 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 176 UpdateWarningNoActionRequired = UpdateClient::WarningBase,
177 UpdateWarningCertificateNotFound = UpdateClient::WarningCertificateNotFound,
178 UpdateWarningIdentityNotFound = UpdateClient::WarningIdentityNotFound,
179 UpdateWarningVendorMismatch = UpdateClient::WarningVendorMismatch,
180 UpdateWarningClassMismatch = UpdateClient::WarningClassMismatch,
181 UpdateWarningDeviceMismatch = UpdateClient::WarningDeviceMismatch,
182 UpdateWarningCertificateInvalid = UpdateClient::WarningCertificateInvalid,
183 UpdateWarningSignatureInvalid = UpdateClient::WarningSignatureInvalid,
184 UpdateWarningBadKeytable = UpdateClient::WarningBadKeytable,
185 UpdateWarningURINotFound = UpdateClient::WarningURINotFound,
186 UpdateWarningRollbackProtection = UpdateClient::WarningRollbackProtection,
187 UpdateWarningAuthorizationRejected = UpdateClient::WarningAuthorizationRejected,
188 UpdateWarningAuthorizationUnavailable = UpdateClient::WarningAuthorizationUnavailable,
189 UpdateWarningUnknown = UpdateClient::WarningUnknown,
190 UpdateCertificateInsertion = UpdateClient::WarningCertificateInsertion,
191 UpdateErrorUserActionRequired = UpdateClient::ErrorBase,
192 UpdateErrorWriteToStorage = UpdateClient::ErrorWriteToStorage,
193 UpdateErrorInvalidHash = UpdateClient::ErrorInvalidHash,
194 UpdateErrorConnection = UpdateClient::ErrorConnection,
195 UpdateFatalRebootRequired,
197 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 198 EnrollmentErrorBase = CE_STATUS_RANGE_BASE,
201 EnrollmentErrorEnd = CE_STATUS_RANGE_END,
202 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 203 #ifdef MBED_CONF_MBED_CLOUD_CLIENT_ENABLE_DEVICE_SENTRY 204 DeviceSentryErrorBase = DS_STATUS_RANGE_BASE,
207 DeviceSentryErrorEnd = DS_STATUS_RANGE_END,
208 #endif // MBED_CONF_MBED_CLOUD_CLIENT_ENABLE_DEVICE_SENTRY 209 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 210 MulticastErrorBase = MULTICAST_STATUS_RANGE_BASE,
212 MulticastErrorEnd = MULTICAST_STATUS_RANGE_END
213 #endif // MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 217 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 222 UpdateRequestInvalid = UpdateClient::RequestInvalid,
223 UpdateRequestDownload = UpdateClient::RequestDownload,
224 UpdateRequestInstall = UpdateClient::RequestInstall
246 void(*on_unregistered_cb)(
void),
247 void(*on_error_cb)(
int)
248 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
249 ,
void(*update_authorize_cb)(int32_t request) = NULL,
250 void(*update_progress_cb)(uint32_t progress, uint32_t total) = NULL
267 void add_objects(
const M2MObjectList& object_list);
277 void add_objects(
const M2MBaseList& base_list);
279 void remove_object(M2MBase *
object);
318 bool setup(
void* iface);
326 void on_registered(
void(*fn)(
void));
335 void on_registered(T *
object,
void (T::*member)(
void));
344 void on_error(
void(*fn)(
int));
354 void on_error(T *
object,
void (T::*member)(
int));
362 void on_unregistered(
void(*fn)(
void));
371 void on_unregistered(T *
object,
void (T::*member)(
void));
379 void on_registration_updated(
void(*fn)(
void));
389 void on_registration_updated(T *
object,
void (T::*member)(
void));
398 void keep_alive() m2m_deprecated;
406 void register_update();
418 const ConnectorClientEndpointInfo *endpoint_info()
const;
420 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 425 M2MInterface *get_m2m_interface();
434 void set_queue_sleep_handler(callback_handler handler);
443 void set_random_number_callback(random_number_cb callback);
454 void set_entropy_callback(entropy_cb callback);
456 #if MBED_CLOUD_CLIENT_STL_API 467 bool set_device_resource_value(M2MDevice::DeviceResource resource,
468 const std::string &value) m2m_deprecated;
471 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 476 void set_update_authorize_handler(
void (*handler)(int32_t request)) __attribute__((deprecated(
"Use set_update_authorize_priority_handler instead")));
482 void set_update_authorize_priority_handler(
void (*handler)(int32_t request, uint64_t priority));
488 void update_authorize(int32_t request);
495 void update_reject(int32_t request, int32_t reason);
501 void set_update_progress_handler(
void (*handler)(uint32_t progress, uint32_t total));
504 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 511 void on_external_update(
void(*fn)(uint32_t start_address, uint32_t firmware_size));
518 const char *error_description()
const;
529 void send_get_request(DownloadType type,
533 get_data_error_cb error_cb,
536 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 546 ce_status_e certificate_renew(
const char *cert_name);
553 void on_certificate_renewal(cert_renewal_cb_f user_cb);
554 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 556 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 562 const M2MBaseList *get_object_list()
const;
563 #endif // MBED_CLOUD_CLIENT_EDGE_EXTENSION 582 void resume(
void *iface);
584 #ifndef MBED_CLIENT_DISABLE_EST_FEATURE 595 est_status_e est_request_enrollment(
const char *cert_name,
596 const size_t cert_name_length,
598 const size_t csr_length,
600 void *context)
const;
609 #endif // !MBED_CLIENT_DISABLE_EST_FEATURE 618 virtual void complete(ServiceClientCallbackStatus status);
625 virtual void error(
int error,
const char *reason);
633 virtual void value_updated(M2MBase *base, M2MBase::BaseType type);
635 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 641 virtual void external_update(uint32_t start_address, uint32_t firmware_size);
652 #if MBED_CLOUD_CLIENT_STL_API 653 void register_update_callback(
string route, SimpleM2MResourceBase* resource) m2m_deprecated;
658 ServiceClient _client;
660 M2MBaseList _object_list;
661 FP0<void> _on_registered;
662 FP0<void> _on_unregistered;
663 FP0<void> _on_registration_updated;
664 FP1<void,int> _on_error;
665 const char *_error_description;
667 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 668 FP2<void, uint32_t, uint32_t> _on_external_update;
671 #if MBED_CLOUD_CLIENT_STL_API 674 map<string, M2MObject*> _objects;
675 map<string, M2MResource*> _resources;
676 map<string, SimpleM2MResourceBase*> _update_values;
678 friend class SimpleM2MResourceBase;
680 #endif // MBED_CLOUD_CLIENT_STL_API 686 FP0<void> fp(
object, member);
693 FP1<void, int> fp(
object, member);
700 FP0<void> fp(
object, member);
701 _on_unregistered = fp;
707 FP0<void> fp(
object, member);
708 _on_registration_updated = fp;
710 #endif // __MBED_CLOUD_CLIENT_H__ Configuration options (set of defines and values).
Definitions for certificate chain structures and Enrollment over Secure Transport (EST) callback...
void(* est_enrollment_result_cb)(est_enrollment_result_e result, struct cert_chain_context_s *cert_chain, void *context)
When the enrollment result has been handled by the callback, the free_cert_chain_context function mus...
Definition: est_defs.h:76
Error
An enum defining different kinds of errors that can occur during various client operations.
Definition: MbedCloudClient.h:115
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:71
Definition: MbedCloudClient.h:105
Definition: est_defs.h:51
void on_unregistered(void(*fn)(void))
Set the callback function that is called when Device Management Client is unregistered successfully f...
Not used.
Definition: MbedCloudClient.h:174
void on_registered(void(*fn)(void))
Set the callback function that is called when Device Management Client is registered successfully to ...