void CScores::OnRequestSuccessRanking()
{	
	//Get score and rank
	m_curuserscore = 0;
	m_curuserrank = (int)SC_RankingController_GetRanking(m_rankingController);
	SC_Score_h score = SC_RankingController_GetScore(m_rankingController);
	if (score)
	{
		m_curuserscore = (int)SC_Score_GetResult(score);
		m_curuserminorresult = (int)SC_Score_GetMinorResult(score);
	}
	if (g_localhighscore > m_curuserscore) //Submit local highscore if need be
	{
		
		DoSubmitScore();
		StartWait("Submiting current user score");
		
	}
	else // Else loading scores list
	{
		//See OnRequestSuccess()
		SC_ScoresController_SetMode(m_scoresController, 1);
		SC_ScoresController_LoadRange(m_scoresController, 0, SC_PAGE_SCORES_COUNT);		
		StartWait("Loading global scores");
	}
}
Beispiel #2
0
void CPhone::GetAcIndicatorSync(TChargerStatus& aStatus)
	{
	if (IsActive())
		{
		Cancel();
		}
	CTelephony::TIndicatorV1Pckg indicatorPckg(iIndicator);
	iTelephony->GetIndicator(iStatus,indicatorPckg);
	iFunc = EAcIndicator;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	if(iIndicator.iCapabilities & CTelephony::KIndChargerConnected)
		{
	    //We can detect when a charger is connected
	    if(iIndicator.iIndicator & CTelephony::KIndChargerConnected)
	    	{
	        //Charger is connected
	        aStatus = EChargerStatusConnected;  
	        }
		else
	        {
	        //Charger is not connected
			aStatus = EChargerStatusNotConnected;
	        }
	    }
	    else
	    {
	    //We do not know whether or not a charger is connected
	    aStatus = EChargerStatusUnknown;
	    }
	}
Beispiel #3
0
void CPhone::GetOperatorNameSync(TDes& aOperatorName)
	{
	if (IsActive())
		{
		Cancel();
		}
	/*
	CTelephony::TOperatorNameV1Pckg operatorNamePckg(iOpName);
	iTelephony->GetOperatorName(iStatus,operatorNamePckg);
	iFunc = EOperatorName; 
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	aOperatorName.Copy(iOpName.iOperatorName);
	*/
	CTelephony::TNetworkInfoV1Pckg netInfoPckg(iNetInfo);
	iTelephony->GetCurrentNetworkInfo(iStatus,netInfoPckg);
	iFunc = ECellID;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	aOperatorName.Copy(iNetInfo.iShortName);
	if (aOperatorName.Length() == 0)
		{
			aOperatorName.Copy(iNetInfo.iLongName);
		}
		
	}
void CScores::ControlPress(int index)
{
	switch (index)
	{
		case 0:
		{
			m_needscenetype = stMainMenu;
			Close();
		} break;
		case 1:
		{
			m_needscenetype = stProfile;
			Close();
		} break;
		case 2:
		{
			FillLocalScoresTable();
		} break;
		case 3:
		{
			// Loading Scoreloop scores
			// First loading score and rank 
			// See OnRequestSuccessRanking()
			SC_RankingController_Cancel(m_rankingController); //Cancel last request
			SC_User_h user = SC_Session_GetUser(SC_Client_GetSession(g_client));
			SC_RankingController_SetSearchList(m_rankingController, SC_SCORE_SEARCH_LIST_GLOBAL);
			SC_RankingController_SetMode(m_rankingController, 1);
			SC_RankingController_SetTimeInterval(m_rankingController, SC_TIME_INTERVAL_GLOBAL); 
			SC_RankingController_RequestRankingForUser(m_rankingController, user);
			
			StartWait("Loading current user score");
			
		} break;
	}
}
Beispiel #5
0
void CPhone::GetCellIDSync(TDes8& pckgNet)
	{
	__FLOG(_L("GetCellIDSync"));
#ifdef __WINSCW__
	return;
#endif 
	iTelephony->GetCurrentNetworkInfo(iStatus, pckgNet);
	iFunc = ECellID;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	}
void CScores::OnRequestSuccessSubmit()
{
	g_localhighscoresubmited = true;
	Save();
	//Loading rank and score again
	//See OnRequestSuccessRanking()
	SC_User_h user = SC_Session_GetUser(SC_Client_GetSession(g_client));
	SC_RankingController_SetSearchList(m_rankingController, SC_SCORE_SEARCH_LIST_GLOBAL);
	SC_RankingController_SetMode(m_rankingController, 1);
	SC_RankingController_SetTimeInterval(m_rankingController, SC_TIME_INTERVAL_GLOBAL); 
	SC_RankingController_RequestRankingForUser(m_rankingController, user);
	StartWait("Loading current user score");		

}
Beispiel #7
0
void CPhone::GetSignalStrengthSync(TInt32& aSignalStrength)
	{
	if (IsActive())
		{
		Cancel();
		}

	CTelephony::TSignalStrengthV1Pckg sigStrengthPckg(iSigStrengthV1);
	iTelephony->GetSignalStrength(iStatus,sigStrengthPckg);
	iFunc = ESignalStrength; 
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	aSignalStrength = iSigStrengthV1.iSignalStrength;
	}
Beispiel #8
0
void CPhone::GetPhoneIdSync(TDes& aManufacturer, TDes& aModel)
	{
	if (IsActive())
		{
		Cancel();
		}

	CTelephony::TPhoneIdV1Pckg phoneIdPckg(iPhoneId);
	iTelephony->GetPhoneId(iStatus,phoneIdPckg);
	iFunc = EImei; 
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	aManufacturer.Copy(iPhoneId.iManufacturer);
	aModel.Copy(iPhoneId.iModel);
	}
Beispiel #9
0
void CPhone::GetBatteryInfoSync(TUint& aChargeLevel, CTelephony::TBatteryStatus& aBatteryStatus)
	{
	if (IsActive())
		{
		Cancel();
		}

	CTelephony::TBatteryInfoV1Pckg batteryInfoPckg(iBatteryInfo);
	iTelephony->GetBatteryInfo(iStatus,batteryInfoPckg);
	iFunc = EBatteryInfo; 
	SetActive();
	StartWait();
	iFunc = ENoneFunc;
	aChargeLevel = iBatteryInfo.iChargeLevel;
	aBatteryStatus = iBatteryInfo.iStatus;
	}
void CScores::OnRequestSuccess()
{
	m_listview->Clear();
	SC_ScoreList_h scores = SC_ScoresController_GetScores(m_scoresController);
	unsigned int count = SC_ScoreList_GetScoresCount(scores);
	int index;
	char buf[128];
	for (unsigned int i = 0; i < count; i++)
	{
		/* Get the i-th score */
		SC_Score_h score = SC_ScoreList_GetScore(scores, i);
		
		/* Get login of the score's user */
		SC_User_h user = SC_Score_GetUser(score);
		const char* login = SC_String_GetData(SC_User_GetLogin(user));
		sprintf(buf, "%d. %s", (int)SC_Score_GetRank(score), login);
		index = m_listview->AddItem(NULL, buf);
		m_listview->SetItemCaptionRighti(index, (int)SC_Score_GetResult(score));
		//Get OS type from Minor Result
		int OSindex = (int)SC_Score_GetMinorResult(score);
		if (OSindex < 0 && OSindex > 22)
			OSindex = 0;
		m_listview->SetItemSubtext(index, g_OScaptions[OSindex]);
	}
	if (m_curuserrank > 0)
	{
		if (m_curuserrank <= SC_PAGE_SCORES_COUNT && m_curuserrank < (int)m_listview->get_itemscount() + 1)
		{
			CGUIListItem *li = m_listview->get_item(m_curuserrank - 1);
			li->fontcolor = 0xff0000ff;
			m_listview->MoveItemToCenter(m_curuserrank - 1);
			FinishWait();
		}
		else
		{
			// Loading user score if rank > SC_PAGE_SCORES_COUNT
			// See OnRequestSuccessUser()
			SC_UserController_RequestUserDetail(m_userController);
			StartWait("Loading current user details");
		}
	}
	else
	{
		FinishWait();
	}	
	
}
Beispiel #11
0
void CPhone::GetImsiSync(TDes& aImsi)
	{
	__FLOG(_L("GetImsiSync"));
	if (IsActive())
		{
		Cancel();
		}

#ifdef __WINSCW__
	aImsi = _L("123456789012345");
	return;
#endif
	CTelephony::TSubscriberIdV1Pckg subIdPckg(iSubId);
	iTelephony->GetSubscriberId(iStatus, subIdPckg);

	iFunc = EImsi;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;

	aImsi = iSubId.iSubscriberId;
	}
/*
    Call CBaBackupSessionWrapper to close apps
    this is synchronous which will take a while, please call this function in thread
*/
void CFmServiceUtilsHandler::CloseAppsL()
{
    if( iBSWrapper ) {
        delete iBSWrapper;
        iBSWrapper = 0;
    }

    iBSWrapper = CBaBackupSessionWrapper::NewL();

    TBackupOperationAttributes atts(
        MBackupObserver::EReleaseLockNoAccess,
        MBackupOperationObserver::EStart );
    iBSWrapper->NotifyBackupOperationL( atts );
    iBSWrapper->CloseAll( MBackupObserver::EReleaseLockNoAccess, iStatus );
    SetActive();

    // Memory card formatting cannot be executed if there are open files on it.
    // It has been detected, that in some cases memory card using applications 
    // have no time to close file handles before formatting is tried to be executed. 
    // To address this issue, we need to add a delay here after client-notification 
    // about pending format and real formatting procedure.
    User::After( KAppCloseTimeout );
    StartWait();
}
Beispiel #13
0
void CPhone::GetNetworkStatusSync(CTelephony::TRegistrationStatus& regStatus)
	{
	__FLOG(_L("GetNetworkStatusSync"));
	if (IsActive())
		{
		Cancel();
		}

#ifdef __WINSCW__
	regStatus = CTelephony::ERegisteredOnHomeNetwork;
	return;
#endif

	CTelephony::TNetworkRegistrationV1Pckg netStatPckg(iNetStatus);
	iNetStatus.iRegStatus = CTelephony::ERegistrationUnknown;
	iTelephony->GetNetworkRegistrationStatus(iStatus, netStatPckg);

	iFunc = ENetStatus;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;

	regStatus = iNetStatus.iRegStatus;
	}
Beispiel #14
0
void CPhone::GetNetworkNameSync(TDes& aNetworkName)
	{
	__FLOG(_L("GetNetworkNameSync"));
	if (IsActive())
		{
		Cancel();
		}

#ifdef __WINSCW__
	aNetworkName = _L("FakeNet");
	return;
#endif
	CTelephony::TNetworkNameV1Pckg netPckg(iNetwork);
	iTelephony->GetCurrentNetworkName(iStatus, netPckg);

	iFunc = ENetName;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;

	aNetworkName = iNetwork.iNetworkName;
	__FLOG(_L("NetworkName:"));
	__FLOG(aNetworkName);
	}
Beispiel #15
0
void CPhone::GetImeiSync(TDes& aImei)
	{
	__FLOG(_L("GetImeiSync"));
	if (IsActive())
		{
		Cancel();
		}

#ifdef __WINSCW__
	aImei = _L("356962014461702");
	return;
#endif

	CTelephony::TPhoneIdV1Pckg phoneIdPckg(iPhoneId);
	iTelephony->GetPhoneId(iStatus, phoneIdPckg);

	iFunc = EImei;
	SetActive();
	StartWait();
	iFunc = ENoneFunc;

	iPhoneId.iSerialNumber.Trim();
	aImei = iPhoneId.iSerialNumber.Left(15);
	}