Merge branch 'Branch_S550_Fast_Emmc' of 192.168.6.216:linux-em-group/s530-ntk into S550_Base

This commit is contained in:
xiehongyan 2024-01-17 19:37:35 +08:00
commit a9da778b45
23 changed files with 229 additions and 157 deletions

View File

@ -55,9 +55,9 @@
#define SF_LPA_PROFILE_INFO_BACKUP_FILENEME (UINT8 *)"B:\\UDF\\profile_info_backup.txt" #define SF_LPA_PROFILE_INFO_BACKUP_FILENEME (UINT8 *)"B:\\UDF\\profile_info_backup.txt"
#else #else
// to do: save in flash // to do: save in flash
#define SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME "/tmp/download_ac.txt" #define SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME "/mnt/sd/THUMB/download_ac.txt"
#define SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME "/tmp/download_enable_ac.txt" #define SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME "/mnt/sd/THUMB/download_enable_ac.txt"
#define SF_LPA_PROFILE_INFO_FILENEME "/tmp/profile_info.txt" #define SF_LPA_PROFILE_INFO_FILENEME "/mnt/sd/THUMB/profile_info.txt"
#define SF_LPA_PROFILE_INFO_BACKUP_FILENEME "/mnt/sd/profile_info.txt" #define SF_LPA_PROFILE_INFO_BACKUP_FILENEME "/mnt/sd/profile_info.txt"
#define SF_LPA_LOG_FILE_PATH "/mnt/sd/" #define SF_LPA_LOG_FILE_PATH "/mnt/sd/"

View File

@ -39,6 +39,7 @@
#define SF_LPA_FOLDER SF_SD_DISK #define SF_LPA_FOLDER SF_SD_DISK
#define SF_LPA_SDK 1 #define SF_LPA_SDK 1
#define SIFAR_PLATFORM_ICATCH 0
void sf_sample_lpa_init(void); void sf_sample_lpa_init(void);
void sf_lpa_profile_info_refresh(void); void sf_lpa_profile_info_refresh(void);
@ -75,8 +76,8 @@ SINT32 sf_network_select(UINT8 profileId, UINT8 ctlType); //SF_CONTROL_TYPE_e ct
SINT32 sf_4g_operator_scan(UINT8 mode, UINT8 ctlType); //SF_CONTROL_TYPE_e ctlType SINT32 sf_4g_operator_scan(UINT8 mode, UINT8 ctlType); //SF_CONTROL_TYPE_e ctlType
SINT32 sf_lpa_get_esim_iccid(SF_CHAR iccid[][22]); SINT32 sf_lpa_get_esim_iccid(SF_CHAR iccid[][22]);
void sf_set_esim_card(INT8 flag); void sf_set_esim_card(INT8 flag);
uint32_t sf_fgets(char **src, char *dst);
UINT32 sf_get_profile_active_index(UINT8 *index);
//UINT32 sf_sample_lpa_init(UINT8 refreshNetworkFlg); //UINT32 sf_sample_lpa_init(UINT8 refreshNetworkFlg);

View File

@ -31,6 +31,8 @@ SINT32 sf_share_mem_customer_deinit(void);
SINT32 sf_share_mem_hd_update(void); SINT32 sf_share_mem_hd_update(void);
SINT32 sf_share_mem_hd_down(UINT32 to); SINT32 sf_share_mem_hd_down(UINT32 to);
SINT32 sf_share_mem_wifi_update(void);
SINT32 sf_share_mem_wifi_down(UINT32 to);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus

View File

@ -331,6 +331,11 @@ SINT32 sf_4g_test_esim(void);
SINT32 eg915q_set_usbnet(SF_FN_PARAM_S *pfnParam); SINT32 eg915q_set_usbnet(SF_FN_PARAM_S *pfnParam);
void sf_set_lpa_switch_flag(int flag);
int sf_get_lpa_switch_flag(void);
int sf_get_module_reset_flag(void);
void sf_clear_operatorname(void);
void sf_set_simcard_ready(UINT8 readyFlag);
#ifdef __cplusplus #ifdef __cplusplus
#if __cplusplus #if __cplusplus
} }

View File

@ -84,7 +84,7 @@ SF_BOOL app_disconnect_4g_module(void);
SINT32 app_ttyusb_IsOpen(void); SINT32 app_ttyusb_IsOpen(void);
SINT32 sf_ttyusb_restart(void); SINT32 sf_ttyusb_restart(void);
SINT32 app_file_subscrible_check(SF_REPORT_FILE_ATTR_S *pDtsReportFileAttr,SF_REPORT_FILE_ATTR_S *pSrcReportFileAttr); SINT32 app_file_subscrible_check(SF_REPORT_FILE_ATTR_S *pDtsReportFileAttr,SF_REPORT_FILE_ATTR_S *pSrcReportFileAttr);
SINT32 sf_USB_net_init(void);
SINT32 app_RegisterNet_start(void); SINT32 app_RegisterNet_start(void);
void app_FileSend_start(void); void app_FileSend_start(void);
SINT32 app_t110(void); SINT32 app_t110(void);

View File

@ -272,5 +272,7 @@ UINT8 sf_set_send_log(UINT8 value);
SINT32 sf_power_off_statistics(void); SINT32 sf_power_off_statistics(void);
UINT8 sf_get_send_gps_txt(void); UINT8 sf_get_send_gps_txt(void);
UINT8 sf_set_send_gps_txt(UINT8 value); UINT8 sf_set_send_gps_txt(UINT8 value);
UINT8 sf_poweroff_check_lpa_excute_cmd(void);
UINT8 sf_poweroff_check_lpa_enable_profile(void);
#endif /*_SF_SMS_H_*/ #endif /*_SF_SMS_H_*/

View File

@ -237,9 +237,9 @@ UINT32 sf_save_file(UINT8* filename, UINT8* filebuff, UINT32 len)
printf("\nsave %s %d\n", filename, len); printf("\nsave %s %d\n", filename, len);
remove(filename); remove((char*)filename);
fd = open(filename, O_WRONLY | O_CREAT, 0777); fd = open((char*)filename, O_WRONLY | O_CREAT, 0777);
if (fd==0) if (fd==0)
{ {
@ -745,14 +745,14 @@ void sf_write_log_content(int fd, SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsig
//append log concent in the file end //append log concent in the file end
SF_SEEK(fd, 0, SEEK_END); SF_SEEK(fd, 0, SEEK_END);
sf_lpa_get_times_stamp(tmpStr); sf_lpa_get_times_stamp((SINT8*)tmpStr);
SF_WRITE(fd, tmpStr, strlen(tmpStr)); SF_WRITE(fd, tmpStr, strlen(tmpStr));
SF_WRITE(fd, ",", 1); SF_WRITE(fd, ",", 1);
SLOGD("%s", tmpStr); SLOGD("%s", tmpStr);
printf(","); printf(",");
memset(tmpStr, '\0', sizeof(tmpStr)); memset(tmpStr, '\0', sizeof(tmpStr));
sf_lpa_get_all_iccid(tmpStr); sf_lpa_get_all_iccid((SINT8*)tmpStr);
SF_WRITE(fd, tmpStr, strlen(tmpStr)); SF_WRITE(fd, tmpStr, strlen(tmpStr));
SF_WRITE(fd, ",", 1); SF_WRITE(fd, ",", 1);
printf("%s", tmpStr); printf("%s", tmpStr);
@ -766,14 +766,14 @@ void sf_write_log_content(int fd, SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsig
printf(","); printf(",");
SF_MEMSET(tmpStr, '\0', sizeof(tmpStr)); SF_MEMSET(tmpStr, '\0', sizeof(tmpStr));
sf_lpa_get_cmd_str(pLpaCmd, tmpStr); sf_lpa_get_cmd_str(pLpaCmd, (SINT8*)tmpStr);
SF_WRITE(fd, tmpStr, strlen(tmpStr)); SF_WRITE(fd, tmpStr, strlen(tmpStr));
SF_WRITE(fd, ",", 1); SF_WRITE(fd, ",", 1);
printf("%s", tmpStr); printf("%s", tmpStr);
printf(","); printf(",");
memset(tmpStr, '\0', sizeof(tmpStr)); memset(tmpStr, '\0', sizeof(tmpStr));
sf_lpa_get_status_str(status, tmpStr); sf_lpa_get_status_str(status, (SINT8*)tmpStr);
SF_WRITE(fd, tmpStr, strlen(tmpStr)); SF_WRITE(fd, tmpStr, strlen(tmpStr));
SF_WRITE(fd, ",", 1); SF_WRITE(fd, ",", 1);
printf("%s", tmpStr); printf("%s", tmpStr);
@ -791,7 +791,7 @@ void sf_write_log_content(int fd, SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsig
printf(","); printf(",");
memset(tmpStr, '\0', sizeof(tmpStr)); memset(tmpStr, '\0', sizeof(tmpStr));
sf_lpa_get_source_str(Source, tmpStr); sf_lpa_get_source_str(Source, (SINT8*)tmpStr);
SF_WRITE(fd, tmpStr, strlen(tmpStr)); SF_WRITE(fd, tmpStr, strlen(tmpStr));
SF_WRITE(fd, "\r\n", 2); SF_WRITE(fd, "\r\n", 2);
printf("%s\r\n", tmpStr); printf("%s\r\n", tmpStr);
@ -886,12 +886,12 @@ int sf_sms_lpa_command_log(SF_SMS_LPA_CMD_T* pLpaCmd, SINT8 status, unsigned sho
void sf_sms_lpa_delete_lpa_log(void) void sf_sms_lpa_delete_lpa_log(void)
{ {
UINT8 fileName[64] = { 0 }; char fileName[64] = { 0 };
char *strg_path = sf_get_root_path(); char *strg_path = sf_get_root_path();
if(strg_path == NULL) if(strg_path == NULL)
{ {
free(strg_path); free(strg_path);
return SF_FAILURE; return ;
} }
SF_SPRINTF(fileName, "%s%s", strg_path, sf_sms_lpa_log_file_name_get()); SF_SPRINTF(fileName, "%s%s", strg_path, sf_sms_lpa_log_file_name_get());
@ -903,6 +903,7 @@ void sf_sms_lpa_delete_lpa_log(void)
SF_SYNC(); SF_SYNC();
} }
free(strg_path); free(strg_path);
return;
} }
SINT32 sf_sms_lpa_command_recombination(SF_SMS_LPA_CMD_T *pLpaCmd) SINT32 sf_sms_lpa_command_recombination(SF_SMS_LPA_CMD_T *pLpaCmd)
@ -984,7 +985,7 @@ SINT32 sf_sms_lpa_hash_signature(const SINT8 *eid, const SINT8 *secret, SINT8 *s
// SF_SPRINTF(buf, "%s", "860322065282227,89033023425110000000024642328469,Tact^$werew"); // SF_SPRINTF(buf, "%s", "860322065282227,89033023425110000000024642328469,Tact^$werew");
SLOGD("buf:%s\n", buf); SLOGD("buf:%s\n", buf);
sha256(buf, SF_STRLEN(buf), hash, &lenOut); sha256((char*)buf, SF_STRLEN(buf), (char*)hash, &lenOut);
for (i = 0; i < SF_SMS_LPA_CMD_HASH_KEY_LENGTH; i++) { for (i = 0; i < SF_SMS_LPA_CMD_HASH_KEY_LENGTH; i++) {
SF_SPRINTF(signature + i * 2, "%02x", hash[i]); SF_SPRINTF(signature + i * 2, "%02x", hash[i]);
@ -1030,11 +1031,11 @@ SINT32 sf_sms_lpa_save_download_profile_activation_code(UINT16 cmdVal, const SIN
if(cmdVal == SF_SMS_LPA_CMD_DOWNLOAD_PROFILE_1) if(cmdVal == SF_SMS_LPA_CMD_DOWNLOAD_PROFILE_1)
{ {
sprintf(fileName, "%s", SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME);
} }
else else
{ {
sprintf(fileName, "%s", SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME);
} }
if(sf_save_file(fileName, (UINT8*)activationCodeStr, SF_STRLEN(activationCodeStr)) == FAIL) if(sf_save_file(fileName, (UINT8*)activationCodeStr, SF_STRLEN(activationCodeStr)) == FAIL)
@ -1068,11 +1069,11 @@ SINT32 sf_sms_lpa_load_download_profile_activation_code(UINT16 cmdVal, SINT8* ac
if(cmdVal == SF_SMS_LPA_CMD_DOWNLOAD_PROFILE_1) if(cmdVal == SF_SMS_LPA_CMD_DOWNLOAD_PROFILE_1)
{ {
sprintf(fileName, "%s", SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME);
} }
else else
{ {
sprintf(fileName, "%s", SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME);
} }
fSize = sf_get_file_size(fileName); fSize = sf_get_file_size(fileName);
@ -1099,11 +1100,11 @@ void sf_sms_lpa_delete_download_profile_activation_code(UINT16 cmdVal)
if(cmdVal == SF_SMS_LPA_CMD_DOWNLOAD_PROFILE_1) if(cmdVal == SF_SMS_LPA_CMD_DOWNLOAD_PROFILE_1)
{ {
sprintf(fileName, "%s", SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_DOWNLOAD_PROFILE_AC_FILENEME);
} }
else else
{ {
sprintf(fileName, "%s", SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_DOWNLOAD_ENABLE_PROFILE_AC_FILENEME);
} }
SLOGD("Delete %s\n", fileName); SLOGD("Delete %s\n", fileName);
@ -1191,8 +1192,8 @@ SINT32 sf_sms_lpa_save_profile_info_item(const SINT8* iccid, const SINT8* apn, c
SF_DELETE(file_path); SF_DELETE(file_path);
free(file_path); free(file_path);
memset(buff, '\0', sizeof(buff)); memset(buff, '\0', sizeof(buff));
sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME); sprintf((char*)buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME);
system(buff); system((char*)buff);
SF_SYNC(); SF_SYNC();
SLOGD("Add Success\n"); SLOGD("Add Success\n");
@ -1226,7 +1227,7 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
SLOGD("Delete %s to %s\n", iccid, SF_LPA_PROFILE_INFO_FILENEME); SLOGD("Delete %s to %s\n", iccid, SF_LPA_PROFILE_INFO_FILENEME);
fSize = sf_get_file_size(SF_LPA_PROFILE_INFO_FILENEME); fSize = sf_get_file_size((UINT8*)SF_LPA_PROFILE_INFO_FILENEME);
if(fSize != 0) if(fSize != 0)
{ {
@ -1239,7 +1240,7 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
memset(fileBuff, '\0', fSize + 1); memset(fileBuff, '\0', fSize + 1);
if(sf_read_file(SF_LPA_PROFILE_INFO_FILENEME, fileBuff, fSize) == FAIL) if(sf_read_file((UINT8*)SF_LPA_PROFILE_INFO_FILENEME, fileBuff, fSize) == FAIL)
{ {
free(fileBuff); free(fileBuff);
@ -1296,11 +1297,11 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
len = fSize - abs(pStrEnd - pStrStart); len = fSize - abs(pStrEnd - pStrStart);
if(sf_save_file(SF_LPA_PROFILE_INFO_FILENEME, tmpFileBuff, len) == FAIL) if(sf_save_file((UINT8*)SF_LPA_PROFILE_INFO_FILENEME, tmpFileBuff, len) == FAIL)
{ {
memset(buff, '\0', sizeof(buff)); memset(buff, '\0', sizeof(buff));
sprintf(buff, "cp %s /appfs/ -f", file_path); sprintf((char*)buff, "cp %s /appfs/ -f", file_path);
system(buff); system((char*)buff);
SF_SYNC(); SF_SYNC();
SLOGD("refresh error\n"); SLOGD("refresh error\n");
@ -1311,8 +1312,8 @@ SINT32 sf_sms_lpa_delete_profile_info_item(const SINT8* iccid)
SF_DELETE(file_path); SF_DELETE(file_path);
memset(buff, '\0', sizeof(buff)); memset(buff, '\0', sizeof(buff));
sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME); sprintf((char*)buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME);
system(buff); system((char*)buff);
SF_SYNC(); SF_SYNC();
free(file_path); free(file_path);
@ -1353,27 +1354,27 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a
if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) != SUCCESS) && (sf_file_exsit(file_path) == SUCCESS)) if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) != SUCCESS) && (sf_file_exsit(file_path) == SUCCESS))
{ {
memset(buff, '\0', sizeof(buff)); memset(buff, '\0', sizeof(buff));
sprintf(buff, "cp %s /appfs/ -f", file_path); sprintf((char*)buff, "cp %s /appfs/ -f", file_path);
system(buff); system((char*)buff);
SF_SYNC(); SF_SYNC();
} }
else if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) == SUCCESS) && (sf_file_exsit(file_path) != SUCCESS)) else if((sf_file_exsit(SF_LPA_PROFILE_INFO_FILENEME) == SUCCESS) && (sf_file_exsit(file_path) != SUCCESS))
{ {
memset(buff, '\0', sizeof(buff)); memset(buff, '\0', sizeof(buff));
sprintf(buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME); sprintf((char*)buff, "cp %s /sdcard/mmcblk0p1/ -f", SF_LPA_PROFILE_INFO_FILENEME);
system(buff); system((char*)buff);
SF_SYNC(); SF_SYNC();
} }
} }
memset(buff, '\0', sizeof(buff)); memset(buff, '\0', sizeof(buff));
SLOGD("get Profile item:%s\n", iccid); SLOGD("get Profile item:%s\n", iccid);
sprintf(fileName, "%s", SF_LPA_PROFILE_INFO_FILENEME); sprintf((char*)fileName, "%s", SF_LPA_PROFILE_INFO_FILENEME);
fSize = sf_get_file_size(fileName); fSize = sf_get_file_size(fileName);
if(fSize == 0) if(fSize == 0)
{ {
sprintf(fileName, "%s", file_path); sprintf((char*)fileName, "%s", file_path);
fSize = sf_get_file_size(fileName); fSize = sf_get_file_size(fileName);
} }
free(file_path); free(file_path);
@ -1407,7 +1408,7 @@ SINT32 sf_sms_lpa_get_profile_info_item(const SINT8* iccid, SINT8* apn, SINT8* a
return SF_FAILURE; return SF_FAILURE;
} }
if(sf_fgets((SINT8 **)&pStr, (SINT8 *)buff) == 0) if(sf_fgets((char **)&pStr, (char *)buff) == 0)
{ {
SLOGD("file Fromt error\n"); SLOGD("file Fromt error\n");
free(fileBuff); free(fileBuff);

View File

@ -28,8 +28,11 @@
//#define SAMPLE__USE_MODEM_CONNECTIVITY //#define SAMPLE__USE_MODEM_CONNECTIVITY
#include "sf_fileMng.h"
#include "sf_param_enum.h" #include "sf_param_enum.h"
#include <glob.h>
#include <stdlib.h> #include <stdlib.h>
#include <stdio.h>
#include <signal.h> #include <signal.h>
#if !SIFAR_PLATFORM_ICATCH #if !SIFAR_PLATFORM_ICATCH
#include <dirent.h> #include <dirent.h>
@ -48,10 +51,9 @@
#include "sf_service.h" #include "sf_service.h"
#include "sf_ledmng.h" #include "sf_ledmng.h"
#include "sf_commu_mcu_reg.h" #include "sf_commu_mcu_reg.h"
#include "sf_message_queue.h"
#include "sf_system.h"
#include "sf_commMng.h"
#ifdef SAMPLE__GENERIC_MODEM #ifdef SAMPLE__GENERIC_MODEM
#if !SIFAR_PLATFORM_ICATCH #if !SIFAR_PLATFORM_ICATCH
@ -348,7 +350,7 @@ void sf_set_wifi_cmd(UINT8 cmd)
WifiCurrentCmd = cmd; WifiCurrentCmd = cmd;
} }
UINT8 sf_get_wifi_cmd() UINT8 sf_get_wifi_cmd(void)
{ {
return WifiCurrentCmd; return WifiCurrentCmd;
} }
@ -454,10 +456,10 @@ void SampleLPA_GetIccidStr(unsigned char* IccidStr, unsigned char* ProfileIdByte
IccidStr[2*indexByte]='\0'; IccidStr[2*indexByte]='\0';
} }
bool SampleLPA_Initialize() BOOL SampleLPA_Initialize(void)
{ {
char ExePath[100]; char ExePath[100];
bool res; BOOL res;
#if SIFAR_PLATFORM_ICATCH #if SIFAR_PLATFORM_ICATCH
sprintf(ExePath, "%s", SF_LPA_FOLDER); sprintf(ExePath, "%s", SF_LPA_FOLDER);
@ -469,7 +471,7 @@ bool SampleLPA_Initialize()
char OutputPath[100]; char OutputPath[100];
DIR *rep_in; DIR *rep_in;
DIR *rep_out; DIR *rep_out;
bool UseInitWithInOutFolders; BOOL UseInitWithInOutFolders;
if( getcwd(ExePath,100) == NULL ) if( getcwd(ExePath,100) == NULL )
{ {
@ -535,13 +537,13 @@ bool SampleLPA_Initialize()
return(res); return(res);
} }
void SampleLPA_GetAndSetReader() void SampleLPA_GetAndSetReader(void)
{ {
size_t index = 0; size_t index = 0;
size_t countReader = 0; size_t countReader = 0;
LPA_SE_MEDIA_READER_NAME_INFO readerInfo[16]; LPA_SE_MEDIA_READER_NAME_INFO readerInfo[16];
bool res = lpaGetReaderList( readerInfo, 16, &countReader); BOOL res = lpaGetReaderList( readerInfo, 16, &countReader);
printf("lpaGetReaderList API returned %s\n", (res ? "true" : "false")); printf("lpaGetReaderList API returned %s\n", (res ? "true" : "false"));
if (res) if (res)
{ {
@ -581,13 +583,13 @@ void SampleLPA_GetAndSetReader()
} }
bool SampleLPA_GetEID(UINT8 *eidStr) BOOL SampleLPA_GetEID(UINT8 *eidStr)
{ {
size_t index = 0; size_t index = 0;
LPA_GET_EID getEID; LPA_GET_EID getEID;
UINT8 str[4] = {0}; UINT8 str[4] = {0};
bool res = lpaGetEID(&getEID); BOOL res = lpaGetEID(&getEID);
printf("lpaGetEID API returned %s\n", (res ? "true" : "false")); printf("lpaGetEID API returned %s\n", (res ? "true" : "false"));
if(eidStr== NULL) if(eidStr== NULL)
@ -615,11 +617,11 @@ bool SampleLPA_GetEID(UINT8 *eidStr)
bool SampleLPA_GetEUICCInfo() BOOL SampleLPA_GetEUICCInfo(void)
{ {
size_t index = 0; size_t index = 0;
LPA_GET_EUICC_INFO getEUICCInfo; LPA_GET_EUICC_INFO getEUICCInfo;
bool res = lpaGetEUICCInfo(&getEUICCInfo); BOOL res = lpaGetEUICCInfo(&getEUICCInfo);
printf("lpaGetEUICCInfo API returned %s\n", (res ? "true" : "false")); printf("lpaGetEUICCInfo API returned %s\n", (res ? "true" : "false"));
if(res) if(res)
{ {
@ -638,11 +640,11 @@ bool SampleLPA_GetEUICCInfo()
} }
void SampleLPA_GetSMDPAddress() void SampleLPA_GetSMDPAddress(void)
{ {
size_t index = 0; size_t index = 0;
ADDRESS_DATA AddressData; ADDRESS_DATA AddressData;
bool res = lpaGetSMDPAddress(&AddressData); BOOL res = lpaGetSMDPAddress(&AddressData);
printf("lpaGetSMDPAddress API returned %s\n", (res ? "true" : "false")); printf("lpaGetSMDPAddress API returned %s\n", (res ? "true" : "false"));
if(res) if(res)
{ {
@ -663,11 +665,11 @@ void SampleLPA_GetSMDPAddress()
} }
void SampleLPA_GetSMDSAddress() void SampleLPA_GetSMDSAddress(void)
{ {
size_t index = 0; size_t index = 0;
ADDRESS_DATA AddressData; ADDRESS_DATA AddressData;
bool res = lpaGetSMDSAddress(&AddressData); BOOL res = lpaGetSMDSAddress(&AddressData);
printf("lpaGetSMDSAddress API returned %s\n", (res ? "true" : "false")); printf("lpaGetSMDSAddress API returned %s\n", (res ? "true" : "false"));
if(res) if(res)
{ {
@ -686,14 +688,14 @@ void SampleLPA_GetSMDSAddress()
} }
} }
void SampleLPA_DisplayUsedAddresse(bool requestedAddress) void SampleLPA_DisplayUsedAddresse(BOOL requestedAddress)
{ {
bool res1; BOOL res1;
bool res2; BOOL res2;
char deviceAddress[LPA_SMDP_ADDRESS_SIZE]; char deviceAddress[LPA_SMDP_ADDRESS_SIZE];
//char eUICCAddress[LPA_SMDP_ADDRESS_SIZE]; //char eUICCAddress[LPA_SMDP_ADDRESS_SIZE];
char usedAddress[LPA_SMDP_ADDRESS_SIZE]; char usedAddress[LPA_SMDP_ADDRESS_SIZE];
bool fromConfigParam; BOOL fromConfigParam;
ADDRESS_DATA AddressData; ADDRESS_DATA AddressData;
if(requestedAddress == REQUEST_SMDS_ADDRESS) if(requestedAddress == REQUEST_SMDS_ADDRESS)
@ -731,10 +733,10 @@ void SampleLPA_DisplayUsedAddresse(bool requestedAddress)
} }
} }
void SampleLPA_SetCurlParameters() void SampleLPA_SetCurlParameters(void)
{ {
bool res; BOOL res;
bool ParamValue=false; BOOL ParamValue=false;
printf("Setting CURL_SSL_VERIFYPEER to false (this operation is supposed to fail when SDK is not built with LPA_SDK__USING_EX_API option)...\n"); printf("Setting CURL_SSL_VERIFYPEER to false (this operation is supposed to fail when SDK is not built with LPA_SDK__USING_EX_API option)...\n");
res = lpaSetConfigParameter("CURL_SSL_VERIFYPEER",LPA_PARAMETER_TYPE_BOOL,&ParamValue); res = lpaSetConfigParameter("CURL_SSL_VERIFYPEER",LPA_PARAMETER_TYPE_BOOL,&ParamValue);
printf(" Operation %s \n", (res ? "is successful:" : "has failed.")); printf(" Operation %s \n", (res ? "is successful:" : "has failed."));
@ -753,7 +755,7 @@ void SampleLPA_SetParameter_CertPath(char *ParamValue)
printf("\t2.Executing update-ca-certificates -f\n\n"); printf("\t2.Executing update-ca-certificates -f\n\n");
bool res; BOOL res;
printf("Setting CertPath to %s...\n",ParamValue); printf("Setting CertPath to %s...\n",ParamValue);
res = lpaSetConfigParameter("CertPath",LPA_PARAMETER_TYPE_STRING,ParamValue); res = lpaSetConfigParameter("CertPath",LPA_PARAMETER_TYPE_STRING,ParamValue);
@ -767,9 +769,9 @@ void SampleLPA_SetParameter_CertPath(char *ParamValue)
void SampleLPA_SetParameter_deviceInfoTlv() void SampleLPA_SetParameter_deviceInfoTlv(void)
{ {
bool res; BOOL res;
char ParamValue[132] = { 0 }; char ParamValue[132] = { 0 };
strcpy(ParamValue,"A13F800411223344A12D800302000081030000008203000000830300000084030000008503000000860300000087030000008803020000820835374589362765F6"); strcpy(ParamValue,"A13F800411223344A12D800302000081030000008203000000830300000084030000008503000000860300000087030000008803020000820835374589362765F6");
printf("Setting deviceInfoTlv to %s...\n",ParamValue); printf("Setting deviceInfoTlv to %s...\n",ParamValue);
@ -781,8 +783,8 @@ void SampleLPA_SetParameter_deviceInfoTlv()
void SampleLPA_SetRefreshParameter(bool inputParamValue) void SampleLPA_SetRefreshParameter(bool inputParamValue)
{ {
bool res; BOOL res;
bool ParamValue; BOOL ParamValue;
res = lpaGetConfigParameter("profileRefreshFlag",LPA_PARAMETER_TYPE_BOOL,&ParamValue,1); res = lpaGetConfigParameter("profileRefreshFlag",LPA_PARAMETER_TYPE_BOOL,&ParamValue,1);
if(res) printf("profileRefreshFlag is currently set to %s\n", (ParamValue ? "true" : "false")); if(res) printf("profileRefreshFlag is currently set to %s\n", (ParamValue ? "true" : "false"));
printf("Setting profileRefreshFlag to %s...\n",(inputParamValue ? "true" : "false")); printf("Setting profileRefreshFlag to %s...\n",(inputParamValue ? "true" : "false"));
@ -833,7 +835,7 @@ void lpaEventExecutionErrorNotificationFunction(const void* ptrAppParameter, con
printf("\t Error Extra Info: %s\n",ptrEventExecutionErrorInfo->ptrErrorExtraInfo); printf("\t Error Extra Info: %s\n",ptrEventExecutionErrorInfo->ptrErrorExtraInfo);
} }
bool lpaEventRequestConfirmationCodeFunction(const void * ptrAppParameter, LPA_REQUEST_CONFIRMATION_CODE* ptrRequestConfirmationCode) BOOL lpaEventRequestConfirmationCodeFunction(const void * ptrAppParameter, LPA_REQUEST_CONFIRMATION_CODE* ptrRequestConfirmationCode)
{ {
printf("\n\tThis is the lpaEventCallback._lpaEventRequestConfirmationCode function!\n"); printf("\n\tThis is the lpaEventCallback._lpaEventRequestConfirmationCode function!\n");
printf("\tPlease enter confirmation code : "); printf("\tPlease enter confirmation code : ");
@ -852,7 +854,7 @@ bool lpaEventRequestConfirmationCodeFunction(const void * ptrAppParameter, LPA_R
return(true); return(true);
} }
bool lpaEventRequestUserConsentFunction(const void * ptrAppParameter, LPA_REQUEST_USER_CONSENT_FOR_LOADING_PROFILE* ptrRequestUserConsentForLoadingProfile) BOOL lpaEventRequestUserConsentFunction(const void * ptrAppParameter, LPA_REQUEST_USER_CONSENT_FOR_LOADING_PROFILE* ptrRequestUserConsentForLoadingProfile)
{ {
//int trials = 5; //int trials = 5;
char choice; char choice;
@ -953,7 +955,7 @@ bool lpaEventRequestUserConsentFunction(const void * ptrAppParameter, LPA_REQUES
void lpaEventDisplayIncomingProfileInformationFunction(const void * ptrAppParameter, size_t eventType, LPA_EVENT_INCOMING_PROFILE_INFORMATION* ptrIncomingProfileInformation) void lpaEventDisplayIncomingProfileInformationFunction(const void * ptrAppParameter, size_t eventType, LPA_EVENT_INCOMING_PROFILE_INFORMATION* ptrIncomingProfileInformation)
{ {
ssize_t indexIcon = 0; size_t indexIcon = 0;
unsigned char iccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0}; unsigned char iccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0};
printf("\nInformation from lpaEventCallback._lpaEventDisplayIncomingProfileInformation function:\n"); printf("\nInformation from lpaEventCallback._lpaEventDisplayIncomingProfileInformation function:\n");
@ -1008,13 +1010,13 @@ LPA_API_ERROR SampleLPA_DownloadProfile(const char* ActivationCodeStr)
lpaEventCallback._lpaEventProgressText = lpaEventTextNotificationFunction; lpaEventCallback._lpaEventProgressText = lpaEventTextNotificationFunction;
lpaEventCallback._lpaEventExecutionError = lpaEventExecutionErrorNotificationFunction; lpaEventCallback._lpaEventExecutionError = lpaEventExecutionErrorNotificationFunction;
lpaEventCallback._lpaEventRequestConfirmationCode = lpaEventRequestConfirmationCodeFunction; lpaEventCallback._lpaEventRequestConfirmationCode = lpaEventRequestConfirmationCodeFunction;
lpaEventCallback._lpaEventRequestUserConsentForLoadingProfile= lpaEventRequestUserConsentFunction; lpaEventCallback._lpaEventRequestUserConsentForLoadingProfile = (LPA_EVENT_REQUEST_USER_CONSENT_FOR_LOADING_PROFILE)lpaEventRequestUserConsentFunction;
lpaEventCallback._lpaEventDisplayIncomingProfileInformation = lpaEventDisplayIncomingProfileInformationFunction; lpaEventCallback._lpaEventDisplayIncomingProfileInformation = lpaEventDisplayIncomingProfileInformationFunction;
printf("\nStarting Profile Download\n"); printf("\nStarting Profile Download\n");
printf("ActivationCode = %s\n",ActivationCode); printf("ActivationCode = %s\n",ActivationCode);
//sp5kSystemCfgSet(SP5K_SYS_VFP_ENABLE, 1); //sp5kSystemCfgSet(SP5K_SYS_VFP_ENABLE, 1);
bool res = lpaDownloadProfile(ActivationCode, &lpaEventCallback, &downloadProfileResult); BOOL res = lpaDownloadProfile(ActivationCode, &lpaEventCallback, &downloadProfileResult);
//sp5kSystemCfgSet(SP5K_SYS_VFP_ENABLE, 0); //sp5kSystemCfgSet(SP5K_SYS_VFP_ENABLE, 0);
printf("lpaDownloadProfile API returned %s\n", (res ? "true" : "false")); printf("lpaDownloadProfile API returned %s\n", (res ? "true" : "false"));
@ -1030,7 +1032,7 @@ LPA_API_ERROR SampleLPA_DownloadProfile(const char* ActivationCodeStr)
} }
bool SampleLPA_DownloadProfile_SMDS() BOOL SampleLPA_DownloadProfile_SMDS(void)
{ {
LPA_DOWNLOAD_PROFILE_RESULT downloadProfileResult; LPA_DOWNLOAD_PROFILE_RESULT downloadProfileResult;
LPA_EventCallback lpaEventCallback; LPA_EventCallback lpaEventCallback;
@ -1040,12 +1042,12 @@ bool SampleLPA_DownloadProfile_SMDS()
lpaEventCallback._lpaEventProgressValue = lpaEventValueNotificationFunction; lpaEventCallback._lpaEventProgressValue = lpaEventValueNotificationFunction;
lpaEventCallback._lpaEventProgressText = lpaEventTextNotificationFunction; lpaEventCallback._lpaEventProgressText = lpaEventTextNotificationFunction;
lpaEventCallback._lpaEventExecutionError = lpaEventExecutionErrorNotificationFunction; lpaEventCallback._lpaEventExecutionError = lpaEventExecutionErrorNotificationFunction;
lpaEventCallback._lpaEventRequestConfirmationCode = (LPA_EVENT_REQUEST_CONFIRMATION_CODE)lpaEventRequestConfirmationCodeFunction; lpaEventCallback._lpaEventRequestConfirmationCode = lpaEventRequestConfirmationCodeFunction;
//lpaEventCallback._lpaEventRequestUserConsentForLoadingProfile= NULL; //lpaEventCallback._lpaEventRequestUserConsentForLoadingProfile= NULL;
lpaEventCallback._lpaEventDisplayIncomingProfileInformation = lpaEventDisplayIncomingProfileInformationFunction; lpaEventCallback._lpaEventDisplayIncomingProfileInformation = lpaEventDisplayIncomingProfileInformationFunction;
printf("\nStarting Profile Download using the discovery mechanism (SM-DS)\n"); printf("\nStarting Profile Download using the discovery mechanism (SM-DS)\n");
bool res = lpaDownloadProfileWithSMDSAddress(&lpaEventCallback, &downloadProfileResult); BOOL res = lpaDownloadProfileWithSMDSAddress(&lpaEventCallback, &downloadProfileResult);
printf("lpaDownloadProfileWithSMDSAddress API returned %s\n", (res ? "true" : "false")); printf("lpaDownloadProfileWithSMDSAddress API returned %s\n", (res ? "true" : "false"));
if(!res) if(!res)
@ -1058,7 +1060,7 @@ bool SampleLPA_DownloadProfile_SMDS()
return(res); return(res);
} }
bool SampleLPA_DownloadProfile_defaultSMDP() BOOL SampleLPA_DownloadProfile_defaultSMDP(void)
{ {
LPA_DOWNLOAD_PROFILE_RESULT downloadProfileResult; LPA_DOWNLOAD_PROFILE_RESULT downloadProfileResult;
LPA_EventCallback lpaEventCallback; LPA_EventCallback lpaEventCallback;
@ -1068,12 +1070,12 @@ bool SampleLPA_DownloadProfile_defaultSMDP()
lpaEventCallback._lpaEventProgressValue = lpaEventValueNotificationFunction; lpaEventCallback._lpaEventProgressValue = lpaEventValueNotificationFunction;
lpaEventCallback._lpaEventProgressText = lpaEventTextNotificationFunction; lpaEventCallback._lpaEventProgressText = lpaEventTextNotificationFunction;
lpaEventCallback._lpaEventExecutionError = lpaEventExecutionErrorNotificationFunction; lpaEventCallback._lpaEventExecutionError = lpaEventExecutionErrorNotificationFunction;
lpaEventCallback._lpaEventRequestConfirmationCode = (LPA_EVENT_REQUEST_CONFIRMATION_CODE)lpaEventRequestConfirmationCodeFunction; lpaEventCallback._lpaEventRequestConfirmationCode = lpaEventRequestConfirmationCodeFunction;
//lpaEventCallback._lpaEventRequestUserConsentForLoadingProfile= NULL; //lpaEventCallback._lpaEventRequestUserConsentForLoadingProfile= NULL;
lpaEventCallback._lpaEventDisplayIncomingProfileInformation = lpaEventDisplayIncomingProfileInformationFunction; lpaEventCallback._lpaEventDisplayIncomingProfileInformation = lpaEventDisplayIncomingProfileInformationFunction;
printf("\nStarting Profile Download using the default SM-DP+\n"); printf("\nStarting Profile Download using the default SM-DP+\n");
bool res = lpaDownloadProfileWithDefaultSMDPAddress(&lpaEventCallback, &downloadProfileResult); BOOL res = lpaDownloadProfileWithDefaultSMDPAddress(&lpaEventCallback, &downloadProfileResult);
printf("lpaDownloadProfileWithDefaultSMDPAddress API returned %s\n", (res ? "true" : "false")); printf("lpaDownloadProfileWithDefaultSMDPAddress API returned %s\n", (res ? "true" : "false"));
if(!res) if(!res)
@ -1086,12 +1088,12 @@ bool SampleLPA_DownloadProfile_defaultSMDP()
return(res); return(res);
} }
bool SampleLPA_GetProfilesInfo(LPA_GET_PROFILES_INFO* getProfilesInfo) BOOL SampleLPA_GetProfilesInfo(LPA_GET_PROFILES_INFO* getProfilesInfo)
{ {
size_t NbOfProfilesForMemAlloc; size_t NbOfProfilesForMemAlloc;
size_t ActualNbOfProfiles; size_t ActualNbOfProfiles;
bool res_1; BOOL res_1;
bool res_2; BOOL res_2;
res_1 = lpaGetProfilesNumber( &ActualNbOfProfiles ); res_1 = lpaGetProfilesNumber( &ActualNbOfProfiles );
printf("\nlpaGetProfilesNumber API returned %s\n", (res_1 ? "true" : "false")); printf("\nlpaGetProfilesNumber API returned %s\n", (res_1 ? "true" : "false"));
@ -1297,42 +1299,42 @@ void SampleLPA_DisplayProfilesInfoSimplified(LPA_GET_PROFILES_INFO getProfilesIn
printf("\n"); printf("\n");
} }
bool SampleLPA_EnableProfile(unsigned char* ProfileIdByteArray, size_t ProfileIdByteArraySize) BOOL SampleLPA_EnableProfile(unsigned char* ProfileIdByteArray, size_t ProfileIdByteArraySize)
{ {
unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0}; unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0};
SampleLPA_GetIccidStr(IccidStr,ProfileIdByteArray,ProfileIdByteArraySize); SampleLPA_GetIccidStr(IccidStr,ProfileIdByteArray,ProfileIdByteArraySize);
printf("\nEnabling Profile %s...\n",IccidStr); printf("\nEnabling Profile %s...\n",IccidStr);
bool res = lpaEnableProfileByIccid(ProfileIdByteArray,ProfileIdByteArraySize); BOOL res = lpaEnableProfileByIccid(ProfileIdByteArray,ProfileIdByteArraySize);
printf("Operation for enabling profile %s.\n", (res ? "is successful" : "has failed")); printf("Operation for enabling profile %s.\n", (res ? "is successful" : "has failed"));
if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode())); if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode()));
return(res); return(res);
} }
bool SampleLPA_DisableProfile(unsigned char* ProfileIdByteArray, size_t ProfileIdByteArraySize) BOOL SampleLPA_DisableProfile(unsigned char* ProfileIdByteArray, size_t ProfileIdByteArraySize)
{ {
unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0}; unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0};
SampleLPA_GetIccidStr(IccidStr,ProfileIdByteArray,ProfileIdByteArraySize); SampleLPA_GetIccidStr(IccidStr,ProfileIdByteArray,ProfileIdByteArraySize);
printf("\nDisabling Profile %s...\n",IccidStr); printf("\nDisabling Profile %s...\n",IccidStr);
bool res = lpaDisableProfileByIccid(ProfileIdByteArray,ProfileIdByteArraySize); BOOL res = lpaDisableProfileByIccid(ProfileIdByteArray,ProfileIdByteArraySize);
printf("Operation for disabling profile %s.\n", (res ? "is successful" : "has failed")); printf("Operation for disabling profile %s.\n", (res ? "is successful" : "has failed"));
if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode())); if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode()));
return(res); return(res);
} }
bool SampleLPA_DeleteProfile(unsigned char* ProfileIdByteArray, size_t ProfileIdByteArraySize) BOOL SampleLPA_DeleteProfile(unsigned char* ProfileIdByteArray, size_t ProfileIdByteArraySize)
{ {
unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0}; unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0};
SampleLPA_GetIccidStr(IccidStr,ProfileIdByteArray,ProfileIdByteArraySize); SampleLPA_GetIccidStr(IccidStr,ProfileIdByteArray,ProfileIdByteArraySize);
printf("\nDeleting Profile %s...\n",IccidStr); printf("\nDeleting Profile %s...\n",IccidStr);
bool res = lpaDeleteProfileByIccid(ProfileIdByteArray,ProfileIdByteArraySize); BOOL res = lpaDeleteProfileByIccid(ProfileIdByteArray,ProfileIdByteArraySize);
printf("Profile deletion %s.\n", (res ? "is successful" : "has failed")); printf("Profile deletion %s.\n", (res ? "is successful" : "has failed"));
if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode())); if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode()));
return(res); return(res);
@ -1353,10 +1355,10 @@ void SampleLPA_SetNickname(unsigned char* ProfileIdByteArray, size_t ProfileIdBy
#else #else
int c=0; int c=0;
while(c!='\n') c=getchar(); while(c!='\n') c=getchar();
fgets(Nickname,sizeof(Nickname),stdin); fgets((char*)Nickname,sizeof(Nickname),stdin);
if(strstr(Nickname,"\n") != NULL) if(strstr((char*)Nickname,"\n") != NULL)
{ {
*strstr(Nickname,"\n")='\0'; *strstr((char*)Nickname,"\n")='\0';
} }
else else
{ {
@ -1364,7 +1366,7 @@ void SampleLPA_SetNickname(unsigned char* ProfileIdByteArray, size_t ProfileIdBy
while(c!='\n') c=getchar(); while(c!='\n') c=getchar();
} }
#endif #endif
bool res = lpaSetNicknameByIccid(ProfileIdByteArray,ProfileIdByteArraySize,Nickname,strlen((const char *)Nickname)); BOOL res = lpaSetNicknameByIccid(ProfileIdByteArray,ProfileIdByteArraySize,Nickname,strlen((const char *)Nickname));
printf("Call to lpaSetNicknameByIccid() %s.\n", (res ? "was successful" : "has failed")); printf("Call to lpaSetNicknameByIccid() %s.\n", (res ? "was successful" : "has failed"));
if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode())); if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode()));
} }
@ -1389,7 +1391,7 @@ LPA_API_ERROR SampleLPA_SendPendingNotifications(void)
printf("\nStarting sending pending notifications\n"); printf("\nStarting sending pending notifications\n");
// system("date +%H:%M:%S:%N"); // system("date +%H:%M:%S:%N");
bool res = lpaSendPendingNotification(&lpaEventCallback, &sendingNotificationResult); BOOL res = lpaSendPendingNotification(&lpaEventCallback, &sendingNotificationResult);
// system("date +%H:%M:%S:%N"); // system("date +%H:%M:%S:%N");
printf("lpaSendPendingNotification API returned %s\n", (res ? "true" : "false")); printf("lpaSendPendingNotification API returned %s\n", (res ? "true" : "false"));
if(res) if(res)
@ -1411,12 +1413,12 @@ LPA_API_ERROR SampleLPA_SendPendingNotifications(void)
bool SampleLPA_MemoryReset() BOOL SampleLPA_MemoryReset(void)
{ {
const unsigned char memoryResetOptionParameter[] = {0x05,0xE0}; const unsigned char memoryResetOptionParameter[] = {0x05,0xE0};
printf("\nStarting Memory Reset\n"); printf("\nStarting Memory Reset\n");
bool res = lpaMemoryReset(memoryResetOptionParameter,sizeof(memoryResetOptionParameter)); BOOL res = lpaMemoryReset(memoryResetOptionParameter,sizeof(memoryResetOptionParameter));
printf("lpaMemoryReset API returned %s\n", (res ? "true" : "false")); printf("lpaMemoryReset API returned %s\n", (res ? "true" : "false"));
if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode())); if(!res) printf("=> Error code: %s\n", lpaGetErrorCodeDescription(lpaGetErrorCode()));
return(res); return(res);
@ -1552,7 +1554,7 @@ UINT32 sf_get_profile_active(LPA_GET_PROFILES_INFO getProfilesInfo, LPA_PROFILE_
UINT32 sf_profile_active_change(LPA_GET_PROFILES_INFO getProfilesInfo) UINT32 sf_profile_active_change(LPA_GET_PROFILES_INFO getProfilesInfo)
{ {
bool res = 0; BOOL res = 0;
size_t indexProfile = 0; size_t indexProfile = 0;
unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0}; unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1] = {0};
LPA_PROFILE_INFO *profileData = (LPA_PROFILE_INFO*) getProfilesInfo.profileInfoList; LPA_PROFILE_INFO *profileData = (LPA_PROFILE_INFO*) getProfilesInfo.profileInfoList;
@ -1676,7 +1678,7 @@ UINT32 sf_get_profile_active_index(UINT8 *index)
LPA_API_ERROR sf_enable_profile(UINT8 indexProfiles) LPA_API_ERROR sf_enable_profile(UINT8 indexProfiles)
{ {
unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1]; unsigned char IccidStr[2*LPA_PROFILE_ICCID_BUFFER_MAX_SIZE+1];
bool res = 0; BOOL res = 0;
LPA_API_ERROR errCode = LPA_NO_ERROR; LPA_API_ERROR errCode = LPA_NO_ERROR;
if(indexProfiles < getProfilesInfo.countProfileInfo) if(indexProfiles < getProfilesInfo.countProfileInfo)
@ -1711,7 +1713,7 @@ LPA_API_ERROR sf_lpa_enable_profile_from_iccid(const SINT8* iccid)
LPA_API_ERROR errCode = SF_LPA_CUSTOM_ERROR_INVALID_ICCID; LPA_API_ERROR errCode = SF_LPA_CUSTOM_ERROR_INVALID_ICCID;
UINT8 indexProfile = 0; UINT8 indexProfile = 0;
UINT8 retry = 6; UINT8 retry = 6;
bool res = 0; BOOL res = 0;
printf("enable profile from ICCID\n"); printf("enable profile from ICCID\n");
@ -1779,7 +1781,7 @@ LPA_API_ERROR sf_lpa_delete_profile_from_iccid(const SINT8* iccid)
UINT8 iccidStr[2 * LPA_PROFILE_ICCID_BUFFER_MAX_SIZE + 1] = {0}; UINT8 iccidStr[2 * LPA_PROFILE_ICCID_BUFFER_MAX_SIZE + 1] = {0};
LPA_API_ERROR errCode = SF_LPA_CUSTOM_ERROR_INVALID_ICCID; LPA_API_ERROR errCode = SF_LPA_CUSTOM_ERROR_INVALID_ICCID;
UINT8 indexProfile = 0; UINT8 indexProfile = 0;
bool res = 0; BOOL res = 0;
printf("delete profile from ICCID\n"); printf("delete profile from ICCID\n");
@ -1831,7 +1833,7 @@ LPA_API_ERROR sf_lpa_set_smdp_addr(const char* smdpAddr)
{ {
LPA_API_ERROR errCode = LPA_NO_ERROR; LPA_API_ERROR errCode = LPA_NO_ERROR;
bool res = lpaSetDefaultSMDPAddress(smdpAddr); BOOL res = lpaSetDefaultSMDPAddress(smdpAddr);
printf("lpaSetDefaultSMDPAddress API returned %s\n", (res ? "true" : "false")); printf("lpaSetDefaultSMDPAddress API returned %s\n", (res ? "true" : "false"));
if(res) if(res)
@ -1955,7 +1957,7 @@ UINT8 sf_is_esim_init_finish(void)
void sf_lpa_profile_info_refresh(void) void sf_lpa_profile_info_refresh(void)
{ {
bool ret = false; BOOL ret = false;
memset(&ProfileActive, 0, sizeof(LPA_PROFILE_INFO)); memset(&ProfileActive, 0, sizeof(LPA_PROFILE_INFO));
memset(&getProfilesInfo, 0, sizeof(LPA_GET_PROFILES_INFO)); memset(&getProfilesInfo, 0, sizeof(LPA_GET_PROFILES_INFO));
@ -1991,7 +1993,7 @@ void sf_lpa_profile_info_refresh(void)
void sf_sample_lpa_thread(void) void sf_sample_lpa_thread(void)
{ {
bool res; BOOL res;
const LPA_API_VERSION* lpaApiVersion; const LPA_API_VERSION* lpaApiVersion;
char* ActivationCodeStr_local_default="1$smdp-plus.test.gsma.com$default"; char* ActivationCodeStr_local_default="1$smdp-plus.test.gsma.com$default";
@ -2824,7 +2826,7 @@ struct ThreadArgs
UINT8 arg2; UINT8 arg2;
}; };
void sf_operator_scan_thread(void* args) void *sf_operator_scan_thread(void* args)
{ {
printf("scan network.\n"); printf("scan network.\n");
struct ThreadArgs* myArgs = (struct ThreadArgs*)args; struct ThreadArgs* myArgs = (struct ThreadArgs*)args;
@ -2903,7 +2905,7 @@ void sf_operator_scan_thread(void* args)
pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = 0xff; pMsgParse->msgBuf.rctrlNetworkScan.buff[1] = 0xff;
pOperatorInfo = (Operator_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[2]); pOperatorInfo = (Operator_Info_T *)&(pMsgParse->msgBuf.rctrlNetworkScan.buff[2]);
sf_get_operatorname(OperatorNameL); sf_get_operatorname((char*)OperatorNameL);
for(i = 0; i < totalOperator; i++) for(i = 0; i < totalOperator; i++)
{ {
@ -3100,7 +3102,7 @@ SF_BOOL sf_get_active_profile_next_index(UINT8 *index)
return TRUE; return TRUE;
} }
void sf_network_select_thread(void* args) void *sf_network_select_thread(void* args)
{ {
struct ThreadArgs* myArgs = (struct ThreadArgs*)args; struct ThreadArgs* myArgs = (struct ThreadArgs*)args;
printf("select network, PID:%d\n", myArgs->arg1); printf("select network, PID:%d\n", myArgs->arg1);
@ -3340,7 +3342,7 @@ void sf_network_select_thread(void* args)
sf_com_message_send_to_cardv(&stMessageBuf); sf_com_message_send_to_cardv(&stMessageBuf);
} }
#if ((!SF_IQ_DEBUG)&&(!SF_4G_TEST)) #if 1//((!SF_IQ_DEBUG)&&(!SF_4G_TEST))
if(errCode == CMD_SUCCESS) if(errCode == CMD_SUCCESS)
{ {
sf_clear_operatorname(); sf_clear_operatorname();
@ -3359,6 +3361,7 @@ void sf_network_select_thread(void* args)
} }
#endif #endif
printf("%s(%d) ret:%d\n",__FUNCTION__,__LINE__,ret);
NetSelectTskCfg.IsRun = 0; NetSelectTskCfg.IsRun = 0;
} }
@ -3385,7 +3388,7 @@ SINT32 sf_network_select(UINT8 profileId, UINT8 ctlType)
} }
void sf_network_switch_thread() void *sf_network_switch_thread(void* args)
{ {
SLOGD("switch network.\n"); SLOGD("switch network.\n");
UINT32 ret = SF_LPA_SUCCESS; UINT32 ret = SF_LPA_SUCCESS;
@ -3482,21 +3485,21 @@ void sf_network_switch_thread()
} }
if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY) if(lpaErrCode == LPA_ERROR_LOCAL_PROFILE_CAT_BUSY)
{ {
sf_sms_lpa_command_log(NULL, SF_SMS_LPA_CMD_FAIL, lpaErrCode, SF_SMS_LPA_CMD_ERROR_SOURCE_ESIM); sf_sms_lpa_command_log(NULL, SF_SMS_LPA_CMD_FAIL, lpaErrCode, SF_SMS_LPA_CMD_ERROR_SOURCE_ESIM);
ret = SF_LPA_ERROR_PROFILE_CAT_BUSY; ret = SF_LPA_ERROR_PROFILE_CAT_BUSY;
} }
else if(lpaErrCode == LPA_NO_ERROR) else if(lpaErrCode == LPA_NO_ERROR)
{ {
sf_lpa_profile_info_refresh(); sf_lpa_profile_info_refresh();
sf_sms_lpa_command_log(NULL, SF_SMS_LPA_CMD_SUCCESS, lpaErrCode, SF_SMS_LPA_CMD_ERROR_SOURCE_OTHER); sf_sms_lpa_command_log(NULL, SF_SMS_LPA_CMD_SUCCESS, lpaErrCode, SF_SMS_LPA_CMD_ERROR_SOURCE_OTHER);
ret = SF_LPA_SUCCESS; ret = SF_LPA_SUCCESS;
} }
else else
{ {
sf_sms_lpa_command_log(NULL, SF_SMS_LPA_CMD_FAIL, lpaErrCode, SF_SMS_LPA_CMD_ERROR_SOURCE_ESIM); sf_sms_lpa_command_log(NULL, SF_SMS_LPA_CMD_FAIL, lpaErrCode, SF_SMS_LPA_CMD_ERROR_SOURCE_ESIM);
ret = SF_LPA_FAIL; ret = SF_LPA_FAIL;
} }
//clear lpa switch flag. //clear lpa switch flag.
sf_set_lpa_switch_flag(0); sf_set_lpa_switch_flag(0);
@ -3545,6 +3548,7 @@ void sf_network_switch_thread()
sf_sys_status_led_set(SF_SIM_ERROR_SWITCH_PROFILE); sf_sys_status_led_set(SF_SIM_ERROR_SWITCH_PROFILE);
} }
printf("%s(%d) ret:%d\n",__FUNCTION__,__LINE__,ret);
} }
@ -3566,13 +3570,13 @@ SINT32 sf_lpa_get_esim_iccid(SF_CHAR iccid[][22])
for (indexProfile = 0; indexProfile < getProfilesInfo.countProfileInfo; indexProfile++) for (indexProfile = 0; indexProfile < getProfilesInfo.countProfileInfo; indexProfile++)
{ {
if(strstr(ProfileData[indexProfile].profileName, "ATT")) if(strstr((char*)ProfileData[indexProfile].profileName, "ATT"))
{ {
SampleLPA_GetIccidStr(iccidStr, ProfileData[indexProfile].iccid, ProfileData[indexProfile].iccidSize); SampleLPA_GetIccidStr(iccidStr, ProfileData[indexProfile].iccid, ProfileData[indexProfile].iccidSize);
SF_STRCPY(iccid[1], iccidStr); SF_STRCPY(iccid[1], iccidStr);
SLOGI("ATT-Iccid:%s\n", iccid[1]); SLOGI("ATT-Iccid:%s\n", iccid[1]);
} }
else if(strstr(ProfileData[indexProfile].profileName, "Verizon")) else if(strstr((char*)ProfileData[indexProfile].profileName, "Verizon"))
{ {
SampleLPA_GetIccidStr(iccidStr, ProfileData[indexProfile].iccid, ProfileData[indexProfile].iccidSize); SampleLPA_GetIccidStr(iccidStr, ProfileData[indexProfile].iccid, ProfileData[indexProfile].iccidSize);
SF_STRCPY(iccid[0], iccidStr); SF_STRCPY(iccid[0], iccidStr);

View File

@ -116,14 +116,14 @@ void sf_set_simcard_ready(UINT8 readyFlag)
gSIMCardReady = readyFlag; gSIMCardReady = readyFlag;
} }
UINT8 sf_get_simcard_ready() UINT8 sf_get_simcard_ready(void)
{ {
return gSIMCardReady; return gSIMCardReady;
} }
static int gModuleResetFlag = 0; static int gModuleResetFlag = 0;
int sf_get_module_reset_flag() int sf_get_module_reset_flag(void)
{ {
return gModuleResetFlag; return gModuleResetFlag;
} }
@ -134,7 +134,7 @@ void sf_set_module_reset_flag(int flag)
} }
void sf_module_reset() void sf_module_reset(void)
{ {
gModuleResetFlag = 1; gModuleResetFlag = 1;
sf_hal_ttyusb2_deinit(); sf_hal_ttyusb2_deinit();
@ -172,13 +172,13 @@ int sf_get_operatorname(char *strname)
} }
void sf_clear_operatorname() void sf_clear_operatorname(void)
{ {
memset(g_OperatorNameL, 0, sizeof(g_OperatorNameL)); memset(g_OperatorNameL, 0, sizeof(g_OperatorNameL));
} }
static int gLpaSwitchFlag=0; static int gLpaSwitchFlag=0;
int sf_get_lpa_switch_flag() int sf_get_lpa_switch_flag(void)
{ {
return gLpaSwitchFlag; return gLpaSwitchFlag;
} }

View File

@ -1045,7 +1045,7 @@ double sf_sys_s_time_get(time_t end_time)
} }
time_t sf_time (time_t *__timer) time_t sf_time (time_t *__timer)
{ {
time(__timer); return time(__timer);
} }
SINT32 sf_video_send_ftp(void) SINT32 sf_video_send_ftp(void)
{ {

View File

@ -1326,6 +1326,7 @@ UINT8 sf_poweroff_check_lpa_enable_profile(void)
return 0; return 0;
} }
} }
return 0;
} }
UINT8 sf_sms_content_parse(SF_CHAR *smsStr) UINT8 sf_sms_content_parse(SF_CHAR *smsStr)
@ -1335,7 +1336,7 @@ UINT8 sf_sms_content_parse(SF_CHAR *smsStr)
SF_CHAR *lpaCmdStr = NULL; SF_CHAR *lpaCmdStr = NULL;
UINT16 i = 0; UINT16 i = 0;
UINT16 smsCnt = 0; UINT16 smsCnt = 0;
UINT8 ret; UINT8 ret = 0;
SF_SMS_LPA_CMD_T *pLpaCmd = NULL; SF_SMS_LPA_CMD_T *pLpaCmd = NULL;
//UIMenuStoreInfo *sfParam = sf_app_ui_para_get(); //UIMenuStoreInfo *sfParam = sf_app_ui_para_get();
//SF_PDT_PARAM_STATISTICS_S *sfStat = sf_statistics_param_get(); //SF_PDT_PARAM_STATISTICS_S *sfStat = sf_statistics_param_get();

View File

@ -922,6 +922,10 @@ void sf_power_off(void)
} }
sf_power_off_statistics(); sf_power_off_statistics();
sf_poweroff_check_lpa_excute_cmd();
sf_poweroff_check_lpa_enable_profile();
sf_power_off_check_sms(); sf_power_off_check_sms();

View File

@ -69,7 +69,7 @@ SINT32 debug_cmd_parse(SF_CHAR *pString)
return SF_FAILURE; return SF_FAILURE;
} }
s32ret = stDebugCmdArray[index].pfn_debug_cmd_exe(argc,pargv); s32ret = stDebugCmdArray[index].pfn_debug_cmd_exe(argc,(char ***)pargv);
return s32ret; return s32ret;

View File

@ -255,11 +255,11 @@ static gboolean chr_get_value(const GDBusPropertyTable *property,
unsigned int len = chr->vlen; unsigned int len = chr->vlen;
unsigned char *resp = NULL; unsigned char *resp = NULL;
unsigned int resp_len = 0; unsigned int resp_len = 0;
int ret = -1; //int ret = -1;
if (NULL != gst_sf_write_cb) if (NULL != gst_sf_write_cb)
{ {
ret = gst_sf_write_cb(p, len, &resp, &resp_len); gst_sf_write_cb(p, len, &resp, &resp_len);
} }
if (access("/misc/debug1", F_OK) == 0) if (access("/misc/debug1", F_OK) == 0)
@ -285,7 +285,7 @@ static gboolean chr_get_value(const GDBusPropertyTable *property,
} }
printf("resp, len:%d.\n", resp_len); printf("resp, len:%d.\n", resp_len);
for (int i = 0; i < resp_len; i++) for (unsigned int i = 0; i < resp_len; i++)
printf("%02x ", resp[i]); printf("%02x ", resp[i]);
printf("\n"); printf("\n");

View File

@ -83,6 +83,7 @@ int sf_set_ble_name(char *name)
UIMenuStoreInfo *puiPara = sf_app_ui_para_get(); UIMenuStoreInfo *puiPara = sf_app_ui_para_get();
snprintf((char *)puiPara->BluSsid, sizeof(puiPara->BluSsid), "%s", (char *)name); snprintf((char *)puiPara->BluSsid, sizeof(puiPara->BluSsid), "%s", (char *)name);
BLU_SLOGI("BluSsid:%s\n", puiPara->BluSsid); BLU_SLOGI("BluSsid:%s\n", puiPara->BluSsid);
return 0;
} }
static UINT32 sf_set_pir_sensitivity(UINT8 pirs) static UINT32 sf_set_pir_sensitivity(UINT8 pirs)
{ {

View File

@ -338,8 +338,8 @@ static void * FwUpgradeTask(void * argv)
UINT16 len = 0; UINT16 len = 0;
UINT16 pkt_id = 0; UINT16 pkt_id = 0;
UINT16 ack_id = 0; UINT16 ack_id = 0;
SINT8 param[1] = {0}; //SINT8 param[1] = {0};
param[0] = 0; //param[0] = 0;
//char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE); //char *file_path = sf_root_path_strcat(UPGRADE_FIRMWARE_NANE);
char file_path[64] = {0}; char file_path[64] = {0};

View File

@ -23,6 +23,7 @@
#include "sf_log.h" #include "sf_log.h"
#include "sf_ledmng.h" #include "sf_ledmng.h"
#include "sf_fileMng.h" #include "sf_fileMng.h"
#include "sf_storeMng.h"
#include "sf_systemMng.h" #include "sf_systemMng.h"
#include "sf_commu_mcu_reg.h" #include "sf_commu_mcu_reg.h"

View File

@ -979,7 +979,7 @@
#define SF_TEST_OTA_FTP 0 #define SF_TEST_OTA_FTP 0
#define CUSTOM_TEST_OTA_FTP 0 #define CUSTOM_TEST_OTA_FTP 0
#define FASTBOOT_WAIT_FILESYS_TIMEOUT_MS 5000 #define FASTBOOT_WAIT_FILESYS_TIMEOUT_MS 10000
#define FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS 5000 #define FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS 5000
#define SF_BATTERY_TEST DISABLE #define SF_BATTERY_TEST DISABLE

View File

@ -921,6 +921,7 @@ INT32 MovieFast_Wait_FileSys(UINT32 timeout_ms)
if(gpio_getPin(GPIO_CARD_DETECT) == 0) if(gpio_getPin(GPIO_CARD_DETECT) == 0)
{ {
//DBG_WRN("BOOT_INIT_FILESYSOK\n");
ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, timeout_ms); ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, timeout_ms);
} }
@ -940,17 +941,27 @@ INT32 MovieFast_Wait_FileSys(UINT32 timeout_ms)
INT32 MovieFast_Wait_FileNaming(UINT32 timeout_ms) INT32 MovieFast_Wait_FileNaming(UINT32 timeout_ms)
{ {
DCF_HANDLE handle = MovieFast_Get_DCF_Handle(); //DCF_HANDLE handle = MovieFast_Get_DCF_Handle();
BOOT_INIT boot_init = BOOT_INIT_INVALID; BOOT_INIT boot_init = BOOT_INIT_INVALID;
if(handle == g_dcf_hdl){
boot_init = BOOT_INIT_FILENAMINGOK; SF_RTOS_ST_MMC_DEV *mmc_dev = SF_RtosStrgCheckWorkableDev();
if(mmc_dev ==NULL)
{
DBG_ERR("No MMC_Dev Can use!\n");
return E_SYS;
} }
if(MMC_DEV_SD == mmc_dev->dev_type)
{
boot_init = BOOT_INIT_FILENAMINGOK;
}
#if (FS_MULTI_STRG_FUNC) #if (FS_MULTI_STRG_FUNC)
else if(handle == g_dcf_hdl2){ else if(MMC_DEV_EMMC == mmc_dev->dev_type){
boot_init = BOOT_INIT_FILENAMINGOK_2; boot_init = BOOT_INIT_FILENAMINGOK_2;
} }
#endif #endif
//DBG_WRN("boot_init = %d\n",boot_init);
if(boot_init != BOOT_INIT_INVALID) if(boot_init != BOOT_INIT_INVALID)
{ {
return fastboot_wait_done_timeout(boot_init, timeout_ms); return fastboot_wait_done_timeout(boot_init, timeout_ms);
@ -959,6 +970,7 @@ INT32 MovieFast_Wait_FileNaming(UINT32 timeout_ms)
DBG_ERR("boot_init = BOOT_INIT_INVALID\n"); DBG_ERR("boot_init = BOOT_INIT_INVALID\n");
return E_SYS; return E_SYS;
} }
} }
static void MovieFast_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName) static void MovieFast_FileNamingCB(MOVIE_CFG_REC_ID id, char *pFileName)
@ -1210,6 +1222,7 @@ static void MovieFast_UserEventCb(UINT32 id, MOVIE_USER_CB_EVENT event_id, UINT3
//MOVIEMULTI_CLOSE_FILE_INFO *info = (MOVIEMULTI_CLOSE_FILE_INFO *)value; //MOVIEMULTI_CLOSE_FILE_INFO *info = (MOVIEMULTI_CLOSE_FILE_INFO *)value;
//DCF_AddDBfile(info->path); //DCF_AddDBfile(info->path);
//DBG_DUMP("%s added to DCF\r\n", info->path); //DBG_DUMP("%s added to DCF\r\n", info->path);
//DBG_WRN("MOVIE_USER_CB_EVENT_CLOSE_FILE_COMPLETED FLGMOVIEFAST_SHUTDOWN\n");
vos_flag_set(MOVIEFAST_FLG_ID, FLGMOVIEFAST_SHUTDOWN); vos_flag_set(MOVIEFAST_FLG_ID, FLGMOVIEFAST_SHUTDOWN);
} }
break; break;
@ -1309,7 +1322,7 @@ static void MovieFast_UserEventCb(UINT32 id, MOVIE_USER_CB_EVENT event_id, UINT3
case MOVIE_USER_CB_EVENT_FILENAMING_EMR_CB: { case MOVIE_USER_CB_EVENT_FILENAMING_EMR_CB: {
CHAR *pFileName = (CHAR *) value; CHAR *pFileName = (CHAR *) value;
if(MovieFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) == E_OK){ if(MovieFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) == E_OK && MovieFast_Wait_FileNaming(FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) == E_OK){
MovieFast_FileNamingCB(id, pFileName); MovieFast_FileNamingCB(id, pFileName);
} }
else{ else{
@ -1395,6 +1408,7 @@ THREAD_RETTYPE MovieFast_InitFileNamingThread(void *arg)
if(gpio_getPin(GPIO_CARD_DETECT) == 0) if(gpio_getPin(GPIO_CARD_DETECT) == 0)
{ {
//DBG_WRN("BOOT_INIT_FILESYSOK\n");
ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS); ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS);
} }
@ -1410,6 +1424,8 @@ THREAD_RETTYPE MovieFast_InitFileNamingThread(void *arg)
else{ else{
DBG_WRN("dcf handle1 is already opened\n"); DBG_WRN("dcf handle1 is already opened\n");
} }
SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl);
SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2);
fastboot_set_done(BOOT_INIT_FILENAMINGOK_2); fastboot_set_done(BOOT_INIT_FILENAMINGOK_2);
} }
else if((TRUE != sf_is_card_full()) && (ret == E_OK)) else if((TRUE != sf_is_card_full()) && (ret == E_OK))
@ -1422,6 +1438,8 @@ THREAD_RETTYPE MovieFast_InitFileNamingThread(void *arg)
else{ else{
DBG_WRN("dcf handle1 is already opened\n"); DBG_WRN("dcf handle1 is already opened\n");
} }
SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl);
SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2);
fastboot_set_done(BOOT_INIT_FILENAMINGOK); fastboot_set_done(BOOT_INIT_FILENAMINGOK);
} }
else else

View File

@ -985,11 +985,12 @@ INT32 PhotoFast_Wait_FileSys(UINT32 timeout_ms)
if(gpio_getPin(GPIO_CARD_DETECT) == 0) if(gpio_getPin(GPIO_CARD_DETECT) == 0)
{ {
//DBG_WRN("BOOT_INIT_FILESYSOK\n");
ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, timeout_ms); ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, timeout_ms);
} }
INT32 ret2 = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK_2, timeout_ms); INT32 ret2 = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK_2, timeout_ms);
// E_OK //DBG_WRN("ret1:%d, ret2:%d\n", ret, ret2);
if(ret == E_OK || ret2 == E_OK) if(ret == E_OK || ret2 == E_OK)
{ {
return E_OK; return E_OK;
@ -1009,20 +1010,31 @@ INT32 PhotoFast_Wait_FileSys(UINT32 timeout_ms)
INT32 PhotoFast_Wait_FileNaming(UINT32 timeout_ms) INT32 PhotoFast_Wait_FileNaming(UINT32 timeout_ms)
{ {
DCF_HANDLE handle = PhotoFast_Get_DCF_Handle(); //DCF_HANDLE handle = MovieFast_Get_DCF_Handle();
BOOT_INIT boot_init = BOOT_INIT_INVALID; BOOT_INIT boot_init = BOOT_INIT_INVALID;
if(handle == g_dcf_hdl){ SF_RTOS_ST_MMC_DEV *mmc_dev = SF_RtosStrgCheckWorkableDev();
boot_init = BOOT_INIT_FILENAMINGOK; if(mmc_dev ==NULL)
{
DBG_ERR("No MMC_Dev Can use!\n");
return E_SYS;
} }
if(MMC_DEV_SD == mmc_dev->dev_type)
{
boot_init = BOOT_INIT_FILENAMINGOK;
}
#if (FS_MULTI_STRG_FUNC) #if (FS_MULTI_STRG_FUNC)
else if(handle == g_dcf_hdl2){ else if(MMC_DEV_EMMC == mmc_dev->dev_type){
boot_init = BOOT_INIT_FILENAMINGOK_2; boot_init = BOOT_INIT_FILENAMINGOK_2;
} }
#endif #endif
//DBG_WRN("boot_init = %d\n",boot_init);
if(boot_init != BOOT_INIT_INVALID) if(boot_init != BOOT_INIT_INVALID)
{
return fastboot_wait_done_timeout(boot_init, timeout_ms); return fastboot_wait_done_timeout(boot_init, timeout_ms);
}
else{ else{
DBG_ERR("boot_init = BOOT_INIT_INVALID\n"); DBG_ERR("boot_init = BOOT_INIT_INVALID\n");
return E_SYS; return E_SYS;
@ -1613,6 +1625,7 @@ THREAD_RETTYPE PhotoFast_InitFileNamingThread(void *arg)
if(gpio_getPin(GPIO_CARD_DETECT) == 0) if(gpio_getPin(GPIO_CARD_DETECT) == 0)
{ {
//DBG_WRN("BOOT_INIT_FILESYSOK\n");
ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS); ret = fastboot_wait_done_timeout(BOOT_INIT_FILESYSOK, FASTBOOT_WAIT_FILESYS_TIMEOUT_MS);
} }
@ -1628,6 +1641,8 @@ THREAD_RETTYPE PhotoFast_InitFileNamingThread(void *arg)
else{ else{
DBG_WRN("dcf handle1 is already opened\n"); DBG_WRN("dcf handle1 is already opened\n");
} }
SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl);
SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2);
fastboot_set_done(BOOT_INIT_FILENAMINGOK_2); fastboot_set_done(BOOT_INIT_FILENAMINGOK_2);
} }
else if((TRUE != sf_is_card_full()) && (ret == E_OK)) else if((TRUE != sf_is_card_full()) && (ret == E_OK))
@ -1640,6 +1655,8 @@ THREAD_RETTYPE PhotoFast_InitFileNamingThread(void *arg)
else{ else{
DBG_WRN("dcf handle1 is already opened\n"); DBG_WRN("dcf handle1 is already opened\n");
} }
SF_RtosStrgSetDcfHandle(MMC_DEV_SD, g_dcf_hdl);
SF_RtosStrgSetDcfHandle(MMC_DEV_EMMC, g_dcf_hdl2);
fastboot_set_done(BOOT_INIT_FILENAMINGOK); fastboot_set_done(BOOT_INIT_FILENAMINGOK);
} }
else else

View File

@ -1776,7 +1776,7 @@ INT32 PhotoFast_SliceEncode(const HD_PATH_ID vproc_path_id, const HD_VIDEO_FRAME
goto EXIT; goto EXIT;
} }
if(PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){ if(PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) != E_OK){
goto EXIT; goto EXIT;
} }
@ -2367,10 +2367,25 @@ INT32 PhotoFast_SliceEncode_CB3(void* user_data)
* Output jpg file * Output jpg file
******************************************************************/ ******************************************************************/
extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path); extern INT32 PhotoFast_WriteFile(UINT32 Addr, UINT32 Size, UINT32 Fmt, UINT32 uiPathId, char* Path);
INT32 waitFalg = 0;
#if SF_NO_SD_SEND == ENABLE #if SF_NO_SD_SEND == ENABLE
if( // if(
PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK && // PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK &&
PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK) // PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK)
// if(PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){
// if(PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) != E_OK){
// waitFalg = 1;
// }
// }
if(PhotoFast_Wait_FileSys(FASTBOOT_WAIT_FILESYS_TIMEOUT_MS) != E_OK){
waitFalg = 1;
}
if(PhotoFast_Wait_FileNaming(FASTBOOT_WAIT_FILENAMING_TIMEOUT_MS) != E_OK){
waitFalg = 1;
}
if(waitFalg)
{ {
DBG_WRN("filesys not ready, store data into mem\n"); DBG_WRN("filesys not ready, store data into mem\n");

View File

@ -65,13 +65,13 @@ typedef struct
MMC_DEV_MOUNT_STATE moumted_state; MMC_DEV_MOUNT_STATE moumted_state;
MMC_DEV_SPACE_STATE space_state; MMC_DEV_SPACE_STATE space_state;
MMC_DEV_LOOP_STATE loop_state; MMC_DEV_LOOP_STATE loop_state;
int dcf_handle; signed long dcf_handle;
}SF_RTOS_ST_MMC_DEV; }SF_RTOS_ST_MMC_DEV;
void SF_RtosStrgInit(void); void SF_RtosStrgInit(void);
void SF_RtosStrgUnInit(void); void SF_RtosStrgUnInit(void);
int SF_RtosStrgRegister(int devid, int mounted_state); int SF_RtosStrgRegister(int devid, int mounted_state);
void SF_RtosStrgSetDcfHandle(UINT32 strg_id, UINT32 handle); void SF_RtosStrgSetDcfHandle(UINT32 strg_id, signed long handle);
SF_RTOS_ST_MMC_DEV *SF_RtosStrgCheckWorkableDev(void); SF_RTOS_ST_MMC_DEV *SF_RtosStrgCheckWorkableDev(void);
#endif #endif

View File

@ -239,7 +239,7 @@ int SF_RtosStrgRegister(int devid, int mounted_state)
return 0; return 0;
} }
void SF_RtosStrgSetDcfHandle(UINT32 strg_id, UINT32 handle) void SF_RtosStrgSetDcfHandle(UINT32 strg_id, signed long handle)
{ {
sf_rtos_mmc_dev[strg_id]->dcf_handle = handle; sf_rtos_mmc_dev[strg_id]->dcf_handle = handle;
DBG_WRN("strg_id = %d, handle = %d\n", strg_id, handle); DBG_WRN("strg_id = %d, handle = %d\n", strg_id, handle);