Example
Dependencies: FXAS21002 FXOS8700Q
simple-mbed-cloud-client/mbed-cloud-client/certificate-enrollment-client/source/CertificateEnrollmentClientCommon.cpp@0:11cc2b7889af, 2019-11-19 (annotated)
- Committer:
- maygup01
- Date:
- Tue Nov 19 09:49:38 2019 +0000
- Revision:
- 0:11cc2b7889af
Example
Who changed what in which revision?
User | Revision | Line number | New contents of line |
---|---|---|---|
maygup01 | 0:11cc2b7889af | 1 | // ---------------------------------------------------------------------------- |
maygup01 | 0:11cc2b7889af | 2 | // Copyright 2018 ARM Ltd. |
maygup01 | 0:11cc2b7889af | 3 | // |
maygup01 | 0:11cc2b7889af | 4 | // Licensed under the Apache License, Version 2.0 (the "License"); |
maygup01 | 0:11cc2b7889af | 5 | // you may not use this file except in compliance with the License. |
maygup01 | 0:11cc2b7889af | 6 | // You may obtain a copy of the License at |
maygup01 | 0:11cc2b7889af | 7 | // |
maygup01 | 0:11cc2b7889af | 8 | // http://www.apache.org/licenses/LICENSE-2.0 |
maygup01 | 0:11cc2b7889af | 9 | // |
maygup01 | 0:11cc2b7889af | 10 | // Unless required by applicable law or agreed to in writing, software |
maygup01 | 0:11cc2b7889af | 11 | // distributed under the License is distributed on an "AS IS" BASIS, |
maygup01 | 0:11cc2b7889af | 12 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
maygup01 | 0:11cc2b7889af | 13 | // See the License for the specific language governing permissions and |
maygup01 | 0:11cc2b7889af | 14 | // limitations under the License. |
maygup01 | 0:11cc2b7889af | 15 | // ---------------------------------------------------------------------------- |
maygup01 | 0:11cc2b7889af | 16 | |
maygup01 | 0:11cc2b7889af | 17 | #include "CertificateEnrollmentClientCommon.h" |
maygup01 | 0:11cc2b7889af | 18 | |
maygup01 | 0:11cc2b7889af | 19 | namespace CertificateEnrollmentClient { |
maygup01 | 0:11cc2b7889af | 20 | |
maygup01 | 0:11cc2b7889af | 21 | // User callback to be invoked when server POSTs g_cert_enroll_lwm2m_resource |
maygup01 | 0:11cc2b7889af | 22 | // Important: Do not call directly, always call call_user_cert_renewal_cb() instead |
maygup01 | 0:11cc2b7889af | 23 | static cert_renewal_cb_f cert_renewal_cb = NULL; |
maygup01 | 0:11cc2b7889af | 24 | |
maygup01 | 0:11cc2b7889af | 25 | // Certificate Renewal LWM2M Resource - save the pointer for easy access to the resource |
maygup01 | 0:11cc2b7889af | 26 | M2MResource* g_cert_enroll_lwm2m_resource = NULL; |
maygup01 | 0:11cc2b7889af | 27 | |
maygup01 | 0:11cc2b7889af | 28 | // Pointer to object containing an instance containing the g_cert_enroll_lwm2m_resource resource. |
maygup01 | 0:11cc2b7889af | 29 | // CertificateEnrollmentClient is owner of the pointer and must release it when module is destroyed |
maygup01 | 0:11cc2b7889af | 30 | M2MObject *g_cert_enroll_lwm2m_obj = NULL; |
maygup01 | 0:11cc2b7889af | 31 | |
maygup01 | 0:11cc2b7889af | 32 | const CERT_ENROLLMENT_EST_CLIENT *g_est_client; |
maygup01 | 0:11cc2b7889af | 33 | |
maygup01 | 0:11cc2b7889af | 34 | void call_user_cert_renewal_cb(const char *cert_name, ce_status_e status, ce_initiator_e initiator) |
maygup01 | 0:11cc2b7889af | 35 | { |
maygup01 | 0:11cc2b7889af | 36 | if (cert_renewal_cb) { |
maygup01 | 0:11cc2b7889af | 37 | cert_renewal_cb(cert_name, status, initiator); |
maygup01 | 0:11cc2b7889af | 38 | } |
maygup01 | 0:11cc2b7889af | 39 | } |
maygup01 | 0:11cc2b7889af | 40 | |
maygup01 | 0:11cc2b7889af | 41 | void set_user_cert_renewal_cb(cert_renewal_cb_f user_cb) |
maygup01 | 0:11cc2b7889af | 42 | { |
maygup01 | 0:11cc2b7889af | 43 | cert_renewal_cb = user_cb; |
maygup01 | 0:11cc2b7889af | 44 | } |
maygup01 | 0:11cc2b7889af | 45 | } |
maygup01 | 0:11cc2b7889af | 46 |