Mayank Gupta / Mbed OS pelion-example-frdm

Dependencies:   FXAS21002 FXOS8700Q

Embed: (wiki syntax)

« Back to documentation index

Show/hide line numbers CertificateEnrollmentClientCommon.cpp Source File

CertificateEnrollmentClientCommon.cpp

00001 // ----------------------------------------------------------------------------
00002 // Copyright 2018 ARM Ltd.
00003 //  
00004 // Licensed under the Apache License, Version 2.0 (the "License");
00005 // you may not use this file except in compliance with the License.
00006 // You may obtain a copy of the License at
00007 //  
00008 //     http://www.apache.org/licenses/LICENSE-2.0
00009 //  
00010 // Unless required by applicable law or agreed to in writing, software
00011 // distributed under the License is distributed on an "AS IS" BASIS,
00012 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
00013 // See the License for the specific language governing permissions and
00014 // limitations under the License.
00015 // ----------------------------------------------------------------------------
00016 
00017 #include "CertificateEnrollmentClientCommon.h"
00018 
00019 namespace CertificateEnrollmentClient {
00020 
00021     // User callback to be invoked when server POSTs g_cert_enroll_lwm2m_resource
00022     // Important: Do not call directly, always call call_user_cert_renewal_cb() instead
00023     static cert_renewal_cb_f cert_renewal_cb = NULL;
00024 
00025     // Certificate Renewal LWM2M Resource - save the pointer for easy access to the resource
00026     M2MResource* g_cert_enroll_lwm2m_resource = NULL;
00027 
00028     // Pointer to object containing an instance containing the g_cert_enroll_lwm2m_resource resource.
00029     // CertificateEnrollmentClient is owner of the pointer and must release it when module is destroyed
00030     M2MObject *g_cert_enroll_lwm2m_obj = NULL;
00031 
00032     const CERT_ENROLLMENT_EST_CLIENT *g_est_client;
00033 
00034     void call_user_cert_renewal_cb(const char *cert_name, ce_status_e  status, ce_initiator_e initiator)
00035     {
00036         if (cert_renewal_cb) {
00037             cert_renewal_cb(cert_name, status, initiator);
00038         }
00039     }
00040 
00041     void set_user_cert_renewal_cb(cert_renewal_cb_f user_cb)
00042     {
00043         cert_renewal_cb = user_cb;
00044     }
00045 }
00046