Commit e88fc649 authored by Bhargava C S's avatar Bhargava C S

eSIM Easysetup Verified with CTT

- Updated the Interface for Get/Post operations
- Updated LPA Stub as per Test Spec
- Updated App as per Test Spec
- Return the PS status to App as pain text string
- Added oc_ees_set_confirmation_code_required API
Signed-off-by: Bhargava C S's avatarBhargava C S <cs.bhargava@samsung.com>
parent 6e5ed509
Pipeline #1007 failed with stage
in 4 minutes and 29 seconds
......@@ -98,10 +98,8 @@ extern "C" {
#define OC_RSRVD_EES_DEVICEINFO "deviceinfo"
// Esim Easysetup procedure status
#define EES_PS_NONE ""
#define EES_PS_INITIATED "Initiated"
#define EES_PS_INITIATED ""
#define EES_PS_USER_CONF_PENDING "User confirmation pending"
#define EES_PS_CONFIRM_RECEIVED "User confirmation received"
#define EES_PS_DOWNLOADED "Downloaded"
#define EES_PS_INSTALLED "Installed"
#define EES_PS_ERROR "Error"
......
......@@ -625,6 +625,14 @@ oc_esim_enrollee_t
return &esim_enrollee[device];
}
oc_es_result_t
oc_ees_set_confirmation_code_required(size_t device, bool ccr)
{
oc_esim_enrollee_t *dev_cxt = get_device_esim_enrollee(device);
dev_cxt->rsp.data.confirm_code_required = ccr;
return OC_ES_OK;
}
oc_es_result_t
oc_ees_set_device_info(size_t device, char *euicc_info, char *device_info)
{
......@@ -658,12 +666,12 @@ oc_ees_set_state(size_t device, char *es_status)
return OC_ES_OK;
}
oc_string_t
char *
oc_ees_get_state(size_t device)
{
oc_esim_enrollee_t *dev_cxt = get_device_esim_enrollee(device);
return dev_cxt->ees.data.rsp_status;
return oc_string(dev_cxt->ees.data.rsp_status);
}
oc_es_result_t
......@@ -729,23 +737,14 @@ rspcap_post_handler(oc_request_t *request, oc_interface_mask_t interface,
}
static void
get_rspcap_properties(oc_resource_t *resource, oc_interface_mask_t interface,
void *user_data)
get_rspcap_properties(oc_resource_t *resource, void *user_data)
{
(void)user_data;
oc_esim_enrollee_t *dev_cxt = get_device_esim_enrollee(resource->device);
OC_DBG("get_rspcap_properties\n");
switch (interface) {
case OC_IF_BASELINE:
case OC_IF_R:
oc_rep_set_text_string(root, euiccinfo, oc_string(dev_cxt->rsp_cap.data.euicc_info));
oc_rep_set_text_string(root, deviceinfo, oc_string(dev_cxt->rsp_cap.data.device_info));
break;
default:
break;
}
oc_rep_set_text_string(root, euiccinfo, oc_string(dev_cxt->rsp_cap.data.euicc_info));
oc_rep_set_text_string(root, deviceinfo, oc_string(dev_cxt->rsp_cap.data.device_info));
}
static void
......@@ -760,7 +759,7 @@ rspcap_get_handler(oc_request_t *request, oc_interface_mask_t interface,
return;
}
oc_rep_start_root_object();
get_rspcap_properties((oc_resource_t *)request->resource, interface, user_data);
get_rspcap_properties((oc_resource_t *)request->resource, user_data);
oc_rep_end_root_object();
oc_send_response(request, OC_STATUS_OK);
}
......@@ -771,7 +770,6 @@ set_rspconf_properties(oc_resource_t *resource, oc_rep_t *rep, void *user_data)
bool res_changed = false;
char *str_val = NULL;
size_t str_len = 0;
bool ccr = true;
oc_esim_enrollee_t *dev_cxt = get_device_esim_enrollee(resource->device);
OC_DBG("set_rspconf_properties\n");
......@@ -795,12 +793,14 @@ set_rspconf_properties(oc_resource_t *resource, oc_rep_t *rep, void *user_data)
res_changed = true;
}
break;
/*
case OC_REP_BOOL:
if (oc_rep_get_bool(rep, OC_RSRVD_EES_CONFIRMATIONCODEREQUIRED, &ccr)) {
dev_cxt->rsp.data.confirm_code_required = ccr;
res_changed = true;
}
break;
*/
default:
break;
}
......@@ -829,26 +829,16 @@ rspconf_post_handler(oc_request_t *request, oc_interface_mask_t interface,
}
static void
get_rspconf_properties(oc_resource_t *resource, oc_interface_mask_t interface,
void *user_data)
get_rspconf_properties(oc_resource_t *resource, void *user_data)
{
(void)user_data;
oc_esim_enrollee_t *dev_cxt = get_device_esim_enrollee(resource->device);
OC_DBG("get_rspconf_properties\n");
switch (interface) {
case OC_IF_BASELINE:
case OC_IF_RW:
oc_rep_set_text_string(root, ac, oc_string(dev_cxt->rsp.data.activation_code));
oc_rep_set_text_string(root, pm, oc_string(dev_cxt->rsp.data.profile_metadata));
oc_rep_set_text_string(root, cc, oc_string(dev_cxt->rsp.data.confirm_code));
oc_rep_set_boolean(root, ccr, dev_cxt->rsp.data.confirm_code_required);
break;
default:
break;
}
oc_rep_set_text_string(root, ac, oc_string(dev_cxt->rsp.data.activation_code));
oc_rep_set_text_string(root, pm, oc_string(dev_cxt->rsp.data.profile_metadata));
oc_rep_set_text_string(root, cc, oc_string(dev_cxt->rsp.data.confirm_code));
oc_rep_set_boolean(root, ccr, dev_cxt->rsp.data.confirm_code_required);
}
static void
......@@ -863,7 +853,7 @@ rspconf_get_handler(oc_request_t *request, oc_interface_mask_t interface,
return;
}
oc_rep_start_root_object();
get_rspconf_properties((oc_resource_t *)request->resource, interface, user_data);
get_rspconf_properties((oc_resource_t *)request->resource, user_data);
oc_rep_end_root_object();
oc_send_response(request, OC_STATUS_OK);
}
......@@ -884,7 +874,7 @@ set_ees_properties(oc_resource_t *resource, oc_rep_t *rep, void *user_data)
case OC_REP_STRING:
if (oc_rep_get_string(rep, OC_RSRVD_EES_PROVSTATUS,
&str_val, &str_len)) {
oc_new_string(&(dev_cxt->ees.data.rsp_status), str_val ,str_len);
oc_ees_set_state(ees->device, str_val);
res_changed = true;
}
if (oc_rep_get_string(rep, OC_RSRVD_EES_LASTERRORREASON,
......@@ -904,7 +894,7 @@ set_ees_properties(oc_resource_t *resource, oc_rep_t *rep, void *user_data)
}
if (oc_rep_get_string(rep, OC_RSRVD_EES_ENDUSERCONFIRMATION,
&str_val, &str_len)) {
oc_new_string(&(dev_cxt->ees.data.end_user_conf), str_val ,str_len);
oc_new_string(&(dev_cxt->ees.data.end_user_consent), str_val ,str_len);
res_changed = true;
}
break;
......@@ -952,7 +942,7 @@ get_ees_properties(oc_resource_t *resource, oc_interface_mask_t interface,
oc_rep_set_text_string(root, ler, oc_string(dev_cxt->ees.data.last_err_reason));
oc_rep_set_text_string(root, lec, oc_string(dev_cxt->ees.data.last_err_code));
oc_rep_set_text_string(root, led, oc_string(dev_cxt->ees.data.last_err_desc));
oc_rep_set_text_string(root, euc, oc_string(dev_cxt->ees.data.end_user_conf));
oc_rep_set_text_string(root, euc, oc_string(dev_cxt->ees.data.end_user_consent));
}
static void
......@@ -993,11 +983,11 @@ oc_create_esim_easysetup_resource(size_t device, void *user_data)
}
// Initiatize EES Resource state
oc_new_string(&(dev_cxt->ees.data.rsp_status), EES_PS_NONE, 0);
oc_new_string(&(dev_cxt->ees.data.last_err_reason), EES_PS_NONE, 0);
oc_new_string(&(dev_cxt->ees.data.last_err_code), EES_PS_NONE, 0);
oc_new_string(&(dev_cxt->ees.data.last_err_desc), EES_PS_NONE, 0);
oc_new_string(&(dev_cxt->ees.data.end_user_conf), EES_PS_NONE, 0);
oc_new_string(&(dev_cxt->ees.data.rsp_status), EES_PS_INITIATED, 0);
oc_new_string(&(dev_cxt->ees.data.last_err_reason), EES_PS_INITIATED, 0);
oc_new_string(&(dev_cxt->ees.data.last_err_code), EES_PS_INITIATED, 0);
oc_new_string(&(dev_cxt->ees.data.last_err_desc), EES_PS_INITIATED, 0);
oc_new_string(&(dev_cxt->ees.data.end_user_consent), EES_PS_INITIATED, 0);
// Esim Easy Setup Resource
oc_core_populate_collection(
......@@ -1044,7 +1034,7 @@ oc_create_esim_easysetup_resource(size_t device, void *user_data)
oc_link_t *l1 = oc_new_link(dev_cxt->rsp.handle);
oc_collection_add_link((oc_resource_t *)dev_cxt->ees.handle, l1);
// Initialize Confrmation Code Required to True
dev_cxt->rsp.data.confirm_code_required = true;
//dev_cxt->rsp.data.confirm_code_required = true;
// RSP Capability Conf Resource
oc_core_populate_resource(
......@@ -1092,7 +1082,7 @@ oc_delete_esim_easysetup_resource(size_t device)
oc_free_string(&dev_cxt->ees.data.last_err_reason);
oc_free_string(&dev_cxt->ees.data.last_err_code);
oc_free_string(&dev_cxt->ees.data.last_err_desc);
oc_free_string(&dev_cxt->ees.data.end_user_conf);
oc_free_string(&dev_cxt->ees.data.end_user_consent);
dev_cxt->ees.prov_cb = NULL;
esim_device_count--;
......
......@@ -659,12 +659,10 @@ oc_core_get_resource_by_uri(const char *uri, size_t device)
else if ((strlen(uri) - skip) == 9 &&
memcmp(uri + skip, "easysetup", 9) == 0) {
type = OCF_WES;
}
else if ((strlen(uri) - skip) == 8 &&
} else if ((strlen(uri) - skip) == 8 &&
memcmp(uri + skip, "wificonf", 8) == 0) {
type = OCF_WES_WIFI;
}
else if ((strlen(uri) - skip) == 7 &&
} else if ((strlen(uri) - skip) == 7 &&
memcmp(uri + skip, "devconf", 7) == 0) {
type = OCF_WES_DEVICE;
}
......@@ -673,12 +671,10 @@ oc_core_get_resource_by_uri(const char *uri, size_t device)
else if ((strlen(uri) - skip) == 13 &&
memcmp(uri + skip, "esimeasysetup", 13) == 0) {
type = OCF_EES;
}
else if ((strlen(uri) - skip) == 7 &&
} else if ((strlen(uri) - skip) == 7 &&
memcmp(uri + skip, "rspconf", 7) == 0) {
type = OCF_EES_RSP;
}
else if ((strlen(uri) - skip) == 13 &&
} else if ((strlen(uri) - skip) == 13 &&
memcmp(uri + skip, "rspcapability", 13) == 0) {
type = OCF_EES_RSPCAP;
}
......
......@@ -55,7 +55,6 @@ ees_profile_download_cb1(int status)
{
if(status == 0) {
oc_ees_set_state(0, EES_PS_DOWNLOADED);
lpa_install_profile(&ees_profile_install_cb1);
} else {
oc_ees_set_state(0, EES_PS_ERROR);
}
......@@ -70,31 +69,20 @@ ees_prov_cb1(oc_ees_data_t *ees_prov_data, void *user_data)
PRINT("ees_prov_data is NULL\n");
return;
}
if(oc_string(ees_prov_data->rsp_status)) {
PRINT("RSP Status : %s\n", oc_string(ees_prov_data->rsp_status));
if(!strncmp(oc_string(ees_prov_data->rsp_status), EES_PS_INITIATED, strlen(EES_PS_INITIATED) )) {
oc_ees_set_state(0, EES_PS_USER_CONF_PENDING);
}
}
if(oc_string(ees_prov_data->last_err_reason))
PRINT("Last Error Reason : %s\n", oc_string(ees_prov_data->last_err_reason));
if(oc_string(ees_prov_data->last_err_code))
PRINT("Last Error Code : %s\n", oc_string(ees_prov_data->last_err_code));
if(oc_string(ees_prov_data->last_err_desc))
PRINT("Last Error Description : %s\n", oc_string(ees_prov_data->last_err_desc));
if(oc_string(ees_prov_data->end_user_conf)) {
PRINT("End User Confirmation\n : %s\n", oc_string(ees_prov_data->end_user_conf));
if((!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_OK, strlen(EES_EUC_DOWNLOAD_OK)) )||
(!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_ENABLE_OK, strlen(EES_EUC_DOWNLOAD_ENABLE_OK))) )
{
oc_ees_set_state(0, EES_PS_CONFIRM_RECEIVED);
}
if((!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_TIMEOUT, strlen(EES_EUC_TIMEOUT))) ||
(!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_REJECT, strlen(EES_EUC_DOWNLOAD_REJECT))) ||
(!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_POSTPONED, strlen(EES_EUC_DOWNLOAD_POSTPONED))))
{
oc_ees_set_state(0, EES_PS_ERROR);
if(oc_string(ees_prov_data->end_user_consent)) {
PRINT("End User Confirmation\n : %s\n", oc_string(ees_prov_data->end_user_consent));
}
if(!strncmp(oc_ees_get_state(0), EES_PS_USER_CONF_PENDING, strlen(EES_PS_USER_CONF_PENDING))) {
if((!strncmp(oc_string(ees_prov_data->end_user_consent), EES_EUC_DOWNLOAD_OK, strlen(EES_EUC_DOWNLOAD_OK))) ||
(!strncmp(oc_string(ees_prov_data->end_user_consent), EES_EUC_DOWNLOAD_ENABLE_OK, strlen(EES_EUC_DOWNLOAD_ENABLE_OK)))) {
lpa_download_profile(&ees_profile_download_cb1);
lpa_install_profile(&ees_profile_install_cb1);
}
}
}
......@@ -105,22 +93,27 @@ rsp_prov_cb1(oc_ees_rsp_data_t *rsp_prov_data, void *user_data)
(void)user_data;
PRINT("rsp_prov_cb1\n");
if (rsp_prov_data == NULL) {
PRINT("rsp_prov_data is NULL\n");
return;
PRINT("rsp_prov_data is NULL\n");
return;
}
//Write Access code to LPA
int cc_exists = 0;
if (oc_string(rsp_prov_data->confirm_code))
cc_exists = 1;
lpa_write_activation_code(oc_string(rsp_prov_data->activation_code), cc_exists, &ees_profile_download_cb1);
if(!strncmp(oc_ees_get_state(0), EES_PS_INITIATED, strlen(EES_PS_INITIATED))) {
if(oc_string(rsp_prov_data->activation_code)) {
PRINT("Actiation Code : %s\n", rsp_prov_data->activation_code);
}
if(oc_string(rsp_prov_data->profile_metadata)) {
PRINT("Profile Metadata Code : %s\n", rsp_prov_data->profile_metadata);
}
if(oc_string(rsp_prov_data->profile_metadata)) {
PRINT("Confirmation Code Required : %d\n", rsp_prov_data->confirm_code_required);
}
if(oc_string(rsp_prov_data->profile_metadata))
PRINT("Profile Meta Data : %s\n", oc_string(rsp_prov_data->profile_metadata));
if(oc_string(rsp_prov_data->confirm_code))
PRINT("Confirmation Code : %s\n", oc_string(rsp_prov_data->confirm_code));
PRINT("Confirmation Code Required : %d\n", rsp_prov_data->confirm_code_required);
//Write Access code to LPA
lpa_write_activation_code(oc_string(rsp_prov_data->activation_code));
oc_ees_set_state(0, EES_PS_USER_CONF_PENDING);
} else if(!strncmp(oc_ees_get_state(0), EES_PS_USER_CONF_PENDING, strlen(EES_PS_USER_CONF_PENDING))) {
if(oc_string(rsp_prov_data->confirm_code))
PRINT("Confirmation Code : %s\n", oc_string(rsp_prov_data->confirm_code));
}
}
static void
......@@ -177,7 +170,6 @@ ees_profile_download_cb2(int status)
{
if(status == 0) {
oc_ees_set_state(1, EES_PS_DOWNLOADED);
lpa_install_profile(&ees_profile_install_cb2);
} else {
oc_ees_set_state(1, EES_PS_ERROR);
}
......@@ -187,36 +179,25 @@ static void
ees_prov_cb2(oc_ees_data_t *ees_prov_data, void *user_data)
{
(void)user_data;
PRINT("ees_prov_cb1\n");
PRINT("ees_prov_cb2\n");
if (ees_prov_data == NULL) {
PRINT("ees_prov_data is NULL\n");
return;
}
if(oc_string(ees_prov_data->rsp_status)) {
PRINT("RSP Status : %s\n", oc_string(ees_prov_data->rsp_status));
if(!strncmp(oc_string(ees_prov_data->rsp_status), EES_PS_INITIATED, strlen(EES_PS_INITIATED) )) {
oc_ees_set_state(1, EES_PS_USER_CONF_PENDING);
}
}
if(oc_string(ees_prov_data->last_err_reason))
PRINT("Last Error Reason : %s\n", oc_string(ees_prov_data->last_err_reason));
if(oc_string(ees_prov_data->last_err_code))
PRINT("Last Error Code : %s\n", oc_string(ees_prov_data->last_err_code));
if(oc_string(ees_prov_data->last_err_desc))
PRINT("Last Error Description : %s\n", oc_string(ees_prov_data->last_err_desc));
if(oc_string(ees_prov_data->end_user_conf)) {
PRINT("End User Confirmation\n : %s\n", oc_string(ees_prov_data->end_user_conf));
if((!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_OK, strlen(EES_EUC_DOWNLOAD_OK)) )||
(!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_ENABLE_OK, strlen(EES_EUC_DOWNLOAD_ENABLE_OK))) )
{
oc_ees_set_state(1, EES_PS_CONFIRM_RECEIVED);
}
if((!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_TIMEOUT, strlen(EES_EUC_TIMEOUT))) ||
(!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_REJECT, strlen(EES_EUC_DOWNLOAD_REJECT))) ||
(!strncmp(oc_string(ees_prov_data->end_user_conf), EES_EUC_DOWNLOAD_POSTPONED, strlen(EES_EUC_DOWNLOAD_POSTPONED))))
{
oc_ees_set_state(1, EES_PS_ERROR);
if(oc_string(ees_prov_data->end_user_consent)) {
PRINT("End User Confirmation\n : %s\n", oc_string(ees_prov_data->end_user_consent));
}
if(!strncmp(oc_ees_get_state(1), EES_PS_USER_CONF_PENDING, strlen(EES_PS_USER_CONF_PENDING))) {
if((!strncmp(oc_string(ees_prov_data->end_user_consent), EES_EUC_DOWNLOAD_OK, strlen(EES_EUC_DOWNLOAD_OK))) ||
(!strncmp(oc_string(ees_prov_data->end_user_consent), EES_EUC_DOWNLOAD_ENABLE_OK, strlen(EES_EUC_DOWNLOAD_ENABLE_OK)))) {
lpa_download_profile(&ees_profile_download_cb2);
lpa_install_profile(&ees_profile_install_cb2);
}
}
}
......@@ -227,20 +208,25 @@ rsp_prov_cb2(oc_ees_rsp_data_t *rsp_prov_data, void *user_data)
(void)user_data;
PRINT("rsp_prov_cb2\n");
if (rsp_prov_data == NULL) {
PRINT("rsp_prov_data is NULL\n");
return;
PRINT("rsp_prov_data is NULL\n");
return;
}
if(!strncmp(oc_ees_get_state(1), EES_PS_INITIATED, strlen(EES_PS_INITIATED))) {
if(oc_string(rsp_prov_data->activation_code)) {
PRINT("Actiation Code : %s\n", rsp_prov_data->activation_code);
}
if(oc_string(rsp_prov_data->profile_metadata)) {
PRINT("Profile Metadata Code : %s\n", rsp_prov_data->profile_metadata);
}
PRINT("Confirmation Code Required : %d\n", rsp_prov_data->confirm_code_required);
//Write Access code to LPA
lpa_write_activation_code(oc_string(rsp_prov_data->activation_code));
oc_ees_set_state(1, EES_PS_USER_CONF_PENDING);
} else if(!strncmp(oc_ees_get_state(1), EES_PS_USER_CONF_PENDING, strlen(EES_PS_USER_CONF_PENDING))) {
if(oc_string(rsp_prov_data->confirm_code))
PRINT("Confirmation Code : %s\n", oc_string(rsp_prov_data->confirm_code));
}
//Write Access code to LPA
int cc_exists = 0;
if (oc_string(rsp_prov_data->confirm_code))
cc_exists = 1;
lpa_write_activation_code(oc_string(rsp_prov_data->activation_code), cc_exists, &ees_profile_download_cb2);
if(oc_string(rsp_prov_data->profile_metadata))
PRINT("Profile Meta Data : %s\n", oc_string(rsp_prov_data->profile_metadata));
if(oc_string(rsp_prov_data->confirm_code))
PRINT("Confirmation Code : %s\n", oc_string(rsp_prov_data->confirm_code));
PRINT("Confirmation Code Required : %d\n", rsp_prov_data->confirm_code_required);
}
static void
......@@ -280,7 +266,6 @@ ees_wifi_prov_cb2(oc_wes_wifi_data_t *wifi_prov_data, void *user_data)
//1 Start DHCP client
wifi_start_dhcp_client();
}
// resource provisioning callbacks for 2 devices
ees_device_callbacks_s g_rsc_cbks[] = {
{
......@@ -288,7 +273,8 @@ ees_device_callbacks_s g_rsc_cbks[] = {
.oc_ees_rsp_prov_cb_t = &rsp_prov_cb1,
.oc_ees_rspcap_prov_cb_t = &rspcap_prov_cb1,
.oc_wes_wifi_prov_cb_t = &ees_wifi_prov_cb1,
},
}
,
{
.oc_ees_prov_cb_t = &ees_prov_cb2,
.oc_ees_rsp_prov_cb_t = &rsp_prov_cb2,
......@@ -356,6 +342,9 @@ register_resources(void)
lpa_read_euicc_info(euicc_info);
lpa_read_device_info(device_info);
if (oc_ees_set_confirmation_code_required(dev_index, lpa_is_user_confirmation_required()) == OC_ES_ERROR)
PRINT("oc_ees_set_confirmation_code_required error!\n");
if (oc_ees_set_device_info(dev_index, euicc_info, device_info) == OC_ES_ERROR)
PRINT("oc_es_set_device_info error!\n");
}
......
......@@ -418,7 +418,7 @@ typedef struct
oc_string_t last_err_reason;
oc_string_t last_err_code;
oc_string_t last_err_desc;
oc_string_t end_user_conf;
oc_string_t end_user_consent;
} oc_ees_data_t;
/**
......@@ -642,6 +642,16 @@ void oc_delete_esim_easysetup_resource(size_t device);
*/
oc_es_result_t oc_ees_set_device_info(size_t device, char *euicc_info, char *device_info);
/**
* This function Sets User Confirmation required for profile dwnload.
*
* @param device Index of the the device application created
* @param ccr User Confirmation Code required
*
* @return ::OC_ES_OK on success, some other value upon failure.
*/
oc_es_result_t oc_ees_set_confirmation_code_required(size_t device, bool ccr);
/**
* This function Sets Enrollee's Error Code.
*
......@@ -669,7 +679,7 @@ oc_es_result_t oc_ees_set_state(size_t device, char *es_state);
*
* @return :: string representing esim enrollee status
*/
oc_string_t oc_ees_get_state(size_t device);
char *oc_ees_get_state(size_t device);
/**
* A set of functions pointers for callback functions which are called after
......
......@@ -27,6 +27,11 @@ int lpa_init(int reset)
return 0;
}
int lpa_is_user_confirmation_required(void)
{
// User Conformation needed for Downloading eSIM profile
return 1;
}
/*
SAMPLE EUICC INFO
......@@ -109,25 +114,29 @@ lpa_read_device_info(char *di_response)
return 0;
}
char g_activation_code[] = "1$SMDP.GSMA.COM$04386-AGYFT-A74Y8-3F815$1.3.6.1.4.1.31746$1";
int g_cc_exists = 0;
// activation_code : Input
void lpa_write_activation_code(char *activation_code, int cc_exists, ees_download_cb_t cbk)
void lpa_write_activation_code(char *activation_code)
{
(void)activation_code;
// Verify Activation code with eUICC, String comparision added just to emulate the case
if(strncmp(g_activation_code, activation_code, strlen(activation_code))) {
// Activaiton code did not match, return error
// Initiate Profile DOwbload from SMDP+
(*cbk)(1); // Failure
}
//Activation code matches, check if user confirmation is done
else if (cc_exists)
// Initiate Profile DOwbload from SMDP+
(*cbk)(0); // Success
}
int lpa_download_profile(ees_download_cb_t cbk)
{
for (int i = 0; i < 10; i++)
printf("Downloading......\n");
(*cbk)(0); // Success
return 1;
}
int lpa_install_profile(ees_install_cb_t cbk)
{
for (int i = 0; i < 10; i++)
printf("Installing......\n");
(*cbk)(0); // Success
return 1;
}
......@@ -38,6 +38,8 @@ typedef void (*ees_install_cb_t)(int);
// Initialize local profie assistant
int lpa_init(int reset);
int lpa_is_user_confirmation_required(void);
// Use GetEUICCInfo of SGP.22 RSP Technical specification
// euicc_info : Output
int lpa_read_euicc_info(char *euicc_info);
......@@ -48,7 +50,10 @@ int lpa_read_device_info(char *di_response);
// Use CtxParamsForCommonAuthentication Request to get signed by eUICC
// activation_code : Input
void lpa_write_activation_code(char *activation_code, int cc_exists, ees_download_cb_t cbk);
void lpa_write_activation_code(char *activation_code);
// Download eUICC Profile
int lpa_download_profile(ees_download_cb_t cbk);
// Install eUICC profile to eUICC module
int lpa_install_profile(ees_install_cb_t cbk);
......
......@@ -600,7 +600,6 @@ wifi_start_dhcp_server()
if (wifi_fetch_pid("dnsmasq")) {
OC_DBG("Dnsmasq is already running");
return 0;
}
if (remove(DNSMASQ_LEASES_FILE) < 0) {
OC_ERR("failed to remove %s", DNSMASQ_LEASES_FILE);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment