Commit 6227726b authored by Bhargava C S's avatar Bhargava C S

Fetch Profile Metadata from LPA and update the resource

Signed-off-by: Bhargava C S's avatarBhargava C S <cs.bhargava@samsung.com>
parent e88fc649
Pipeline #1024 failed with stage
in 5 minutes and 35 seconds
......@@ -35,6 +35,7 @@ extern "C" {
#define NUM_WIFIENCTYPE 6
// Length defined as per GSMA LS to OCF
#define PROFILE_METADATA_LEN 2048
#define EUICC_INFO_LEN 1024
#define DEVICE_INFO_LEN 128
......
......@@ -634,12 +634,14 @@ oc_ees_set_confirmation_code_required(size_t device, bool ccr)
}
oc_es_result_t
oc_ees_set_device_info(size_t device, char *euicc_info, char *device_info)
oc_ees_set_device_info(size_t device, char *euicc_info, char *device_info,
char *profile_metadata)
{
oc_esim_enrollee_t *dev_cxt = get_device_esim_enrollee(device);
oc_new_string(&(dev_cxt->rsp_cap.data.euicc_info), euicc_info, strlen(euicc_info));
oc_new_string(&(dev_cxt->rsp_cap.data.device_info), device_info, strlen(device_info));
oc_new_string(&(dev_cxt->rsp.data.profile_metadata), profile_metadata, strlen(profile_metadata));
return OC_ES_OK;
}
......@@ -782,11 +784,6 @@ set_rspconf_properties(oc_resource_t *resource, oc_rep_t *rep, void *user_data)
oc_new_string(&(dev_cxt->rsp.data.activation_code), str_val, str_len);
res_changed = true;
}
if (oc_rep_get_string(rep, OC_RSRVD_EES_PROFMETADATA,
&str_val, &str_len)) {
oc_new_string(&(dev_cxt->rsp.data.profile_metadata), str_val, str_len);
res_changed = true;
}
if (oc_rep_get_string(rep, OC_RSRVD_EES_CONFIRMATIONCODE,
&str_val, &str_len)) {
oc_new_string(&(dev_cxt->rsp.data.confirm_code), str_val, str_len);
......
......@@ -330,6 +330,7 @@ register_resources(void)
//Read these values from LPA
char euicc_info[EUICC_INFO_LEN];
char device_info[DEVICE_INFO_LEN];
char profile_metadata[PROFILE_METADATA_LEN];
PRINT("register_resources\n");
......@@ -341,12 +342,13 @@ register_resources(void)
// Read Device Info and eUICC Info from LPA
lpa_read_euicc_info(euicc_info);
lpa_read_device_info(device_info);
lpa_read_profile_metadata(profile_metadata);
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_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");
if (oc_ees_set_device_info(dev_index, euicc_info, device_info, profile_metadata) == OC_ES_ERROR)
PRINT("oc_es_set_device_info error!\n");
}
}
......
......@@ -635,12 +635,14 @@ void oc_delete_esim_easysetup_resource(size_t device);
*
* @param device Index of the the device application created
* @param euicc_info contains eSIM information as per GSMA EUICCInfo2 data structure
* @param device_info Contains device information composed of
* @param device_info Contains device information
* @param profile_metadata Contains eSIM Profile meatadata
* RspCapabilityConf Structure
*
* @return ::OC_ES_OK on success, some other value upon failure.
*/
oc_es_result_t oc_ees_set_device_info(size_t device, char *euicc_info, char *device_info);
oc_es_result_t oc_ees_set_device_info(size_t device, char *euicc_info, char *device_info,
char *profile_metadata);
/**
* This function Sets User Confirmation required for profile dwnload.
......
......@@ -32,6 +32,35 @@ int lpa_is_user_confirmation_required(void)
// User Conformation needed for Downloading eSIM profile
return 1;
}
/*
ProfileMetadataExample
# ASN.1 notation
storeMetadataRequet ::= [37] SEQUENCE
{
iccid '89010203040506070809'H,
serviceProviderName "ServiceProviderName",
profileName "ProfileName",
iconType jpg,
icon '0000'H,
profileClass operational
}
# ASN.1 DER encoding
BF25385A0A8901020304050607080991135365727669636550726F76696465724E616D65920B50726F66696C654E616D6593010094020000950102
*/
char g_profile_metadata[] = "BF25385A0A8901020304050607080991135365727669636550726F76696465724 \
E616D65920B50726F66696C654E616D6593010094020000950102";
int
lpa_read_profile_metadata(char *pm)
{
// provide dummy euicc info for testing
strncpy(pm, g_profile_metadata, sizeof(g_profile_metadata));
return 0;
}
/*
SAMPLE EUICC INFO
......
......@@ -40,6 +40,8 @@ int lpa_init(int reset);
int lpa_is_user_confirmation_required(void);
int lpa_read_profile_metadata(char *pm);
// Use GetEUICCInfo of SGP.22 RSP Technical specification
// euicc_info : Output
int lpa_read_euicc_info(char *euicc_info);
......
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