int time_count = 0;
int status = 0;
TapiHandle* handle = null;
-
+
while(time_count < 30) //Wait 30 second.
{
- handle = tel_init(null);
+ if(handle == null)
+ {
+ handle = tel_init(null);
+ }
if(handle != null)
{
ret = tel_check_modem_power_status(handle, &status);
SysLog(NID_SYS, "Modem check result is %d, status is %d.", handle, status);
- SysTryReturnResult(NID_SYS, ret == TAPI_API_SUCCESS, E_SYSTEM, "It is failed to get Modem status.");
+ if(ret != TAPI_API_SUCCESS)
+ {
+ tel_deinit(handle);
+ SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
+ return E_SYSTEM;
+ }
if(status == 0)
{
time_count++;
}
- if(ret != TAPI_API_SUCCESS)
+ if(handle != null)
{
- tel_deinit(handle);
- SysLogException(NID_SYS, E_SYSTEM, "It is failed to get IMEI.");
- return E_SYSTEM;
+ if(status == 0)
+ {
+ pDeviceString = tel_get_misc_me_imei_sync(handle);
+ tel_deinit(handle);
+ SysTryReturnResult(NID_SYS, pDeviceString != null, E_SYSTEM, "It is failed to get IMEI");
+ }
+ else
+ {
+ tel_deinit(handle);
+ SysLogException(NID_SYS, E_SYSTEM, "Modem is not ready to get IMEI.");
+ return E_SYSTEM;
+ }
}
else
{
- pDeviceString = tel_get_misc_me_imei_sync(handle);
- tel_deinit(handle);
- SysTryReturnResult(NID_SYS, pDeviceString != null, E_SYSTEM, "It is failed to get IMEI");
+ SysLogException(NID_SYS, E_SYSTEM, "Modem handle is not ready.");
+ return E_SYSTEM;
}
}
else if(type == 1)