using namespace Tizen::Media;
using namespace Tizen::Social;
using namespace Tizen::Ui::Scenes;
+using namespace Tizen::Telephony;
CallPresentationModel* CallPresentationModel::__pInstance = null;
CallPresentationModel::DialCall(String& contactNumber, bool isEmergency)
{
int errorCode = ERROR_NONE;
+ bool isCallServiceAvailable = false;
+ NetworkStatus networkStatus;
+ NetworkManager* pNetworkManager = new NetworkManager();
+ result r;
//Check if Telephony Manager is initialized
TryCatch(__pTelephonyMgr != null, (errorCode = ERROR_TAPI_INIT_FAILED), "TAPI initialization failed");
__pTelEventListener->HandleTelephonyError(ERROR_FLIGHT_MODE_SET);
return;
}
+ //Check if dialing a call is possible - Check if sim is available
+ if (GetSimInfo() == E_FAILURE)
+ {
+ __pTelEventListener->HandleTelephonyError(ERROR_CODE_SIM_INITIALIZATION_FAILED);
+ return ;
+ }
+
+ //fetch call service status
+ r = pNetworkManager->Construct(null);
+ if (r == E_SUCCESS)
+ {
+ r = pNetworkManager->GetNetworkStatus(networkStatus);
+ if (r == E_SUCCESS)
+ {
+ isCallServiceAvailable = networkStatus.IsCallServiceAvailable();
+ }
+ }
+ delete pNetworkManager;
+
+ if (isCallServiceAvailable == false)
+ {
+ __pTelEventListener->HandleTelephonyError(ERROR_DIAL_FAILED);
+ return ;
+ }
//setup outgoing call
errorCode = __pTelephonyMgr->SetupMoCall(contactNumber, isEmergency);
TryCatch(errorCode == ERROR_NONE,,"Error occurred while setup MO call");
CallPresentationModel::RejectCall(int callHandle, bool sendMsg, const String& contactNumber)
{
AppLogDebug("Enter");
+ if (sendMsg == true && __pAppControlMgr != null)
+ {
+ //launch compose message AppControl
+ __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast<String*>(&contactNumber)), this);
+ }
result r = __pTelephonyMgr->AnswerCall(callHandle, false);
if (IsFailed(r))
{
return false;
}
- if (sendMsg == true && __pAppControlMgr != null)
- {
- //launch compose message AppControl
- __isMessageAppControlRunning = __pAppControlMgr->LaunchComposeMessageAppControl(*(const_cast<String*>(&contactNumber)), this);
- }
+
AppLogDebug("Exit");
return true;
}
ArrayList* pLaunchArgs = null;
SceneManager* pSceneManager = SceneManager::GetInstance();
int currentActiveCallCount = GetCurrentCallCount();
- if(currentActiveCallCount <= 1)
+ if(currentActiveCallCount <= 1 && IsIncomingorDialingCallPresent() == false)
{
//make an outgoing call with given number
String* contactTxt = new (std::nothrow) String(phoneNumber);
//1) Defer from sending call disconnected event to form, in case Msg AppControl is running,
//to avoid PhoneApp from going to EndCall form, where it shows for 3 sec. and automatically closes.
//2) Do not send call disconnected event to any form, in case an incoming call or dialing call is present.
- if (__pTelEventListener != null && __isMessageAppControlRunning == false )
+ if (__pTelEventListener != null /*&& __isMessageAppControlRunning == false*/ )
{
__pTelEventListener->HandleCallDisconnected(isLastCall, pCallList);
}
__pAppControlMgr->AppControlRequestCompleted();
}
}
+
+result
+CallPresentationModel::GetSimInfo(void)
+{
+ int mnc;
+ int mcc;
+ bool isAvailable;
+ String spn;
+ String iccId;
+ String operatorName;
+
+ SimStateManager simStateManager;
+ SimInfo simInfo;
+
+ result r = simStateManager.Construct();
+ if (IsFailed(r))
+ {
+ return E_FAILURE;
+ }
+
+ r = simStateManager.GetSimInfo(simInfo);
+ if (IsFailed(r))
+ {
+ return E_FAILURE;
+ }
+
+ mnc = simInfo.GetMnc();
+ mcc = simInfo.GetMcc();
+ spn = simInfo.GetSpn();
+ iccId = simInfo.GetIccId();
+ operatorName = simInfo.GetOperatorName();
+ //Checks whether a SIM card is present in the device or not
+ isAvailable = simInfo.IsAvailable();
+ if(isAvailable == true)
+ {
+ return E_SUCCESS;
+ }
+ else
+ {
+ return E_FAILURE;
+ }
+}