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 65 virtual void value_updated(M2MBase *base, M2MBase::BaseType type) = 0;
101 ConnectErrorNone = M2MInterface::ErrorNone,
104 ConnectAlreadyExists = M2MInterface::AlreadyExists,
108 ConnectBootstrapFailed = M2MInterface::BootstrapFailed,
112 ConnectInvalidParameters = M2MInterface::InvalidParameters,
116 ConnectNotRegistered = M2MInterface::NotRegistered,
120 ConnectTimeout = M2MInterface::Timeout,
124 ConnectNetworkError = M2MInterface::NetworkError,
128 ConnectResponseParseFailed = M2MInterface::ResponseParseFailed,
132 ConnectUnknownError = M2MInterface::UnknownError,
136 ConnectMemoryConnectFail = M2MInterface::MemoryFail,
140 ConnectNotAllowed = M2MInterface::NotAllowed,
144 ConnectSecureConnectionFailed = M2MInterface::SecureConnectionFailed,
148 ConnectDnsResolvingFailed = M2MInterface::DnsResolvingFailed,
151 ConnectorFailedToStoreCredentials = M2MInterface::FailedToStoreCredentials,
155 ConnectorFailedToReadCredentials = M2MInterface::FailedToReadCredentials,
158 ConnectorInvalidCredentials = M2MInterface::InvalidCertificates,
162 ConnectorUnregistrationFailed = M2MInterface::UnregistrationFailed,
164 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 165 UpdateWarningNoActionRequired = UpdateClient::WarningBase,
166 UpdateWarningCertificateNotFound = UpdateClient::WarningCertificateNotFound,
167 UpdateWarningIdentityNotFound = UpdateClient::WarningIdentityNotFound,
168 UpdateWarningVendorMismatch = UpdateClient::WarningVendorMismatch,
169 UpdateWarningClassMismatch = UpdateClient::WarningClassMismatch,
170 UpdateWarningDeviceMismatch = UpdateClient::WarningDeviceMismatch,
171 UpdateWarningCertificateInvalid = UpdateClient::WarningCertificateInvalid,
172 UpdateWarningSignatureInvalid = UpdateClient::WarningSignatureInvalid,
173 UpdateWarningBadKeytable = UpdateClient::WarningBadKeytable,
174 UpdateWarningURINotFound = UpdateClient::WarningURINotFound,
175 UpdateWarningRollbackProtection = UpdateClient::WarningRollbackProtection,
176 UpdateWarningAuthorizationRejected = UpdateClient::WarningAuthorizationRejected,
177 UpdateWarningAuthorizationUnavailable = UpdateClient::WarningAuthorizationUnavailable,
178 UpdateWarningUnknown = UpdateClient::WarningUnknown,
179 UpdateCertificateInsertion = UpdateClient::WarningCertificateInsertion,
180 UpdateErrorUserActionRequired = UpdateClient::ErrorBase,
181 UpdateErrorWriteToStorage = UpdateClient::ErrorWriteToStorage,
182 UpdateErrorInvalidHash = UpdateClient::ErrorInvalidHash,
183 UpdateErrorConnection = UpdateClient::ErrorConnection,
184 UpdateFatalRebootRequired,
186 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 187 EnrollmentErrorBase = CE_STATUS_RANGE_BASE,
190 EnrollmentErrorEnd = CE_STATUS_RANGE_END,
191 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 192 #ifdef MBED_CONF_MBED_CLOUD_CLIENT_ENABLE_DEVICE_SENTRY 193 DeviceSentryErrorBase = DS_STATUS_RANGE_BASE,
196 DeviceSentryErrorEnd = DS_STATUS_RANGE_END,
197 #endif // MBED_CONF_MBED_CLOUD_CLIENT_ENABLE_DEVICE_SENTRY 198 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 199 MulticastErrorBase = MULTICAST_STATUS_RANGE_BASE,
201 MulticastErrorEnd = MULTICAST_STATUS_RANGE_END
202 #endif // MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 206 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 211 UpdateRequestInvalid = UpdateClient::RequestInvalid,
212 UpdateRequestDownload = UpdateClient::RequestDownload,
213 UpdateRequestInstall = UpdateClient::RequestInstall
249 void(*on_unregistered_cb)(
void),
250 void(*on_error_cb)(
int)
251 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
252 ,
void(*update_authorize_cb)(int32_t request) = NULL,
253 void(*update_progress_cb)(uint32_t progress, uint32_t total) = NULL
267 void(*on_error_cb)(
int)
268 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE
269 ,
void(*update_authorize_cb)(int32_t request) = NULL,
270 void(*update_progress_cb)(uint32_t progress, uint32_t total) = NULL
287 void add_objects(
const M2MObjectList &object_list);
297 void add_objects(
const M2MBaseList &base_list);
299 void remove_object(M2MBase *
object);
341 bool setup(
void *iface,
bool full_register =
false);
350 void on_registered(
void(*fn)(
void)) m2m_deprecated;
360 void on_registered(T *
object,
void (T::*member)(
void)) m2m_deprecated;
369 void on_error(
void(*fn)(
int));
379 void on_error(T *
object,
void (T::*member)(
int));
387 void on_status_changed(
void(*fn)(
int));
397 void on_status_changed(T *
object,
void (T::*member)(
int));
406 void on_unregistered(
void(*fn)(
void)) m2m_deprecated;
416 void on_unregistered(T *
object,
void (T::*member)(
void)) m2m_deprecated;
425 void on_registration_updated(
void(*fn)(
void)) m2m_deprecated;
436 void on_registration_updated(T *
object,
void (T::*member)(
void)) m2m_deprecated;
445 void keep_alive() m2m_deprecated;
453 void register_update();
465 const ConnectorClientEndpointInfo *endpoint_info()
const;
471 M2MInterface *get_m2m_interface();
479 void set_queue_sleep_handler(callback_handler handler) m2m_deprecated;
488 void set_random_number_callback(random_number_cb callback);
499 void set_entropy_callback(entropy_cb callback);
501 #ifdef MBED_CLOUD_CLIENT_SUPPORT_UPDATE 506 void set_update_authorize_handler(
void (*handler)(int32_t request)) __attribute__((deprecated(
"Use set_update_authorize_priority_handler instead")));
512 void set_update_authorize_priority_handler(
void (*handler)(int32_t request, uint64_t priority));
518 void update_authorize(int32_t request);
525 void update_reject(int32_t request, int32_t reason);
531 void set_update_progress_handler(
void (*handler)(uint32_t progress, uint32_t total));
534 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 541 void on_external_update(
void(*fn)(uint32_t start_address, uint32_t firmware_size));
548 const char *error_description()
const;
559 void send_get_request(DownloadType type,
563 get_data_error_cb error_cb,
566 #ifndef MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 576 ce_status_e certificate_renew(
const char *cert_name);
583 void on_certificate_renewal(cert_renewal_cb_f user_cb);
584 #endif // MBED_CONF_MBED_CLOUD_CLIENT_DISABLE_CERTIFICATE_ENROLLMENT 586 #ifdef MBED_CLOUD_CLIENT_EDGE_EXTENSION 592 const M2MBaseList *get_object_list()
const;
593 #endif // MBED_CLOUD_CLIENT_EDGE_EXTENSION 612 void resume(
void *iface);
622 #if defined (MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE) && (MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE > 0) 629 void set_dynamic_logging_state(
bool state,
bool stopped_by_update);
630 #endif // MBED_CLIENT_DYNAMIC_LOGGING_BUFFER_SIZE 632 #ifndef MBED_CLIENT_DISABLE_EST_FEATURE 643 est_status_e est_request_enrollment(
const char *cert_name,
644 const size_t cert_name_length,
646 const size_t csr_length,
648 void *context)
const;
657 #endif // !MBED_CLIENT_DISABLE_EST_FEATURE 666 virtual void complete(ServiceClientCallbackStatus status);
673 virtual void error(
int error,
const char *reason);
681 virtual void value_updated(M2MBase *base, M2MBase::BaseType type);
683 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 689 virtual void external_update(uint32_t start_address, uint32_t firmware_size);
694 ServiceClient _client;
696 M2MBaseList _object_list;
697 FP0<void> _on_registered;
698 FP0<void> _on_unregistered;
699 FP0<void> _on_registration_updated;
700 FP1<void, int> _on_error;
701 FP1<void, int> _on_status_changed;
702 const char *_error_description;
704 #ifdef MBED_CLOUD_CLIENT_SUPPORT_MULTICAST_UPDATE 705 FP2<void, uint32_t, uint32_t> _on_external_update;
713 FP0<void> fp(
object, member);
720 FP1<void, int> fp(
object, member);
727 FP0<void> fp(
object, member);
728 _on_unregistered = fp;
734 FP0<void> fp(
object, member);
735 _on_registration_updated = fp;
741 FP1<void, int> fp(
object, member);
742 _on_status_changed = fp;
744 #endif // __MBED_CLOUD_CLIENT_H__ void on_unregistered(void(*fn)(void)) m2m_deprecated
Set the callback function that is called when Device Management Client is unregistered successfully f...
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
virtual void value_updated(M2MBase *base, M2MBase::BaseType type)=0
A callback indicating that the value of the Resource Object is updated by the LwM2M Device Management...
void on_status_changed(void(*fn)(int))
Set the callback function that is called when the client status change. The status code can be mapped...
Error
An enum defining different kinds of errors that can occur during various client operations.
Definition: MbedCloudClient.h:99
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:55
Definition: MbedCloudClient.h:89
Definition: est_defs.h:51
void on_registration_updated(void(*fn)(void)) m2m_deprecated
Set the callback function that is called when Device Management Client registration is updated succes...
void on_registered(void(*fn)(void)) m2m_deprecated
Set the callback function that is called when Device Management Client is registered successfully to ...
Status
An enum defining different statuses that can occur during various client operations.
Definition: MbedCloudClient.h:221