[lpa]1.调试lpa初始化成功

This commit is contained in:
alisa 2023-08-23 23:29:39 +08:00
parent 432a6b5b64
commit a0d3ee12e5
7 changed files with 30 additions and 13 deletions

4
code/application/source/sf_app/MakeConfig.mk Normal file → Executable file
View File

@ -81,4 +81,8 @@ C_PREDEFINED = \
-DCFG_COMM_MCU_UART \
-DCFG_SUPPORT_OTHER_SIM \
-DCFG_SUPPORT_GPS \
-DLPA_SDK__PLATFORM_RASPBIAN \
-DLPA_SDK__SEMEDIA_DRIVER_GENERIC_MODEM \
-DLPA_SDK__USING_EX_API \
-DLPA_SDK__MAX_SIZE_OF_DATA_IN_STORE_DATA_APDU=253 \

View File

@ -475,7 +475,7 @@ bool SampleLPA_Initialize()
return(false);
}
ExePath[0]='/';
//sprintf(ExePath, "%s", SF_LPA_FOLDER);
strcpy(InputPath, ExePath);
strcat(InputPath, INPUT_SUBFOLDER);
strcpy(OutputPath, ExePath);

View File

@ -22,7 +22,7 @@
#ifndef LPA_SDK__LPA_CORE_H
#define LPA_SDK__LPA_CORE_H
#define LPA_SDK__PLATFORM_RASPBIAN
//#define LPA_SDK__PLATFORM_RASPBIAN
#ifdef LPA_SDK__PLATFORM_WIN
#include "lpasdk/core/win/lpa_core.h"

View File

@ -397,11 +397,12 @@ bool lpaManagerInitializeSEMedia()
lpaCoreLogAppend(SDK_LOG_LEVEL_DEBUG, "++ lpaManagerInitializeSEMedia(...)");
res = seMediaManagerInitialize();
printf("[%s-%d]res:%x\n", __FUNCTION__, __LINE__, res);
if (res)
res = seMediaManagerSetCallbackEventExecutionError(_lpaManagerEventExecutionErrorCallback);
lpaCoreLogAppend(SDK_LOG_LEVEL_DEBUG, "-- lpaManagerInitializeSEMedia(...)");
printf("[%s-%d]res:%x\n", __FUNCTION__, __LINE__, res);
return res;
}

View File

@ -37,11 +37,11 @@
#include "lpasdk/driver/semedia_winscard.h" // SE driver for Windows (using Winscard API) or Cygwin (using also Winscard API)
#endif // LPA_SDK__PLATFORM_WIN || LPA_SDK__PLATFORM_CYGWIN || defined(LPA_SDK__PLATFORM_RASPBIAN)
#else
//#error "No SEMedia compilation option defined"
#include "lpasdk/driver/semedia_winscard.h"
#error "No SEMedia compilation option defined"
#endif // LPA_SDK__SEMEDIA_DRIVER_EXTERNAL
static TSEMedia* _seMedia = NULL;
static bool _manageAutomatically61XX = true;
static bool _manageAutomatically6CXX = false;
@ -60,16 +60,21 @@ UT_EXPORT_DLL bool seMediaManagerInitialize()
{
#ifdef LPA_SDK__SEMEDIA_DRIVER_EXTERNAL
_seMedia = New_SEMediaExternal();
printf("[%s-%d]\n", __FUNCTION__, __LINE__);
#elif LPA_SDK__SEMEDIA_DRIVER_GENERIC_MODEM
_seMedia = New_SEMediaGenericModem();
printf("[%s-%d]\n", __FUNCTION__, __LINE__);
#elif LPA_SDK__SEMEDIA_DRIVER_WINSCARD
#if defined(LPA_SDK__PLATFORM_WIN) || defined(LPA_SDK__PLATFORM_CYGWIN) || defined(LPA_SDK__PLATFORM_RASPBIAN)
_seMedia = New_SEMediaWinSCard();
printf("[%s-%d]\n", __FUNCTION__, __LINE__);
#endif // LPA_SDK__PLATFORM_WIN || LPA_SDK__PLATFORM_CYGWIN
#endif // LPA_SDK__SEMEDIA_DRIVER_GENERIC_MODEM
initOk = _seMedia != NULL;
printf("[%s-%d]initOk:%x\n", __FUNCTION__, __LINE__, initOk);
if(! initOk)
lpaCoreLogAppend(SDK_LOG_LEVEL_ERROR, "seMediaManagerInitialize(): Unable to create _seMedia!");
}

View File

@ -39,6 +39,8 @@
// For timer features
#include <time.h>
//#include <sys/time.h>
#endif // LPA_SDK__PLATFORM_CYGWIN || LPA_SDK__PLATFORM_RASPBIAN
@ -318,7 +320,7 @@ void _seMediaGenericModemWaitingTimer(uint32_t pTime)
typedef struct
{
__time_t tv_sec; // Seconds.
__syscall_slong_t tv_nsec; // Nanoseconds.
long long int tv_nsec; // Nanoseconds.
}gm_timespec;
gm_timespec tim;

View File

@ -152,6 +152,8 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
if (ptrLpaOutputFolder == NULL || strlen(ptrLpaOutputFolder) >= LPA_MAX_PATH)
lpaErrorCode = LPA_ERROR_INVALID_PARAMETER;
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
if (lpaErrorCode == LPA_NO_ERROR)
{
#ifdef LPA_SDK__PLATFORM_RASPBIAN
@ -162,7 +164,8 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
snprintf(_lpaLogBackupFileName, sizeof(_lpaLogBackupFileName), "%s//%s", ptrLpaOutputFolder, "lpa.backup.log") >= LPA_MAX_PATH)
#endif
lpaErrorCode = LPA_ERROR_INSUFFICIENT_BUFFER; // Note: This line is triggered by one the conditional "if(snprintf..." above
}
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
}
if (lpaErrorCode == LPA_NO_ERROR)
{
@ -173,7 +176,8 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
bool lpaLogInitialized = lpaCoreLogIsInitialized();
if (!lpaLogInitialized)
lpaLogInitialized = lpaCoreLogInit();
printf("[%s-%d]lpaLogInitialized:%x\n", __FUNCTION__, __LINE__, lpaLogInitialized);
if (lpaLogInitialized)
{
if( !lpaCoreLogIsOpen())
@ -268,6 +272,7 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
lpaErrorCode = LPA_ERROR_UNABLE_TO_INIT_LOG;
}
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
if (lpaErrorCode == LPA_NO_ERROR)
{
lpaCoreLogAppend(SDK_LOG_LEVEL_INFO, "------ LPA Initialize ------");
@ -281,7 +286,7 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
else
lpaCoreLogAppend(SDK_LOG_LEVEL_INFO, "LPAManager initialization done successfully");
}
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
// Initialize SE Media component
if (lpaErrorCode == LPA_NO_ERROR)
{
@ -293,7 +298,7 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
lpaErrorCode = LPA_ERROR_SE_MEDIA_NOT_INITIALIZED;
}
}
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
if (lpaErrorCode == LPA_NO_ERROR)
{
lpaCoreLogAppend(SDK_LOG_LEVEL_INFO, "---- ===================== ----");
@ -302,7 +307,7 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
if (!lpaManagerInitializeHttpMedia())
lpaErrorCode = LPA_ERROR_UNABLE_TO_INITIALIZE_HTTP_MEDIA;
}
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
// Load and apply configuration file
if (lpaErrorCode == LPA_NO_ERROR)
{
@ -327,7 +332,7 @@ EXPORT_DLL bool lpaInitializeWithInputOutputFolder(const char* ptrLpaIntputFolde
}
}
}
printf("[%s-%d]lpaErrorCode:%x\n", __FUNCTION__, __LINE__, lpaErrorCode);
if (lpaErrorCode == LPA_NO_ERROR)
{
_lpaInit = true;