// ----------------------------------------------------------------------------- // CTestSDKNotes::TestNCNCAknConfirmationNoteL // ----------------------------------------------------------------------------- TInt CTestSDKNotes::TestNCNCAknConfirmationNoteL( CStifItemParser& /*aItem*/ ) { CAknConfirmationNote* confirmationNote = new (ELeave) CAknConfirmationNote; CleanupStack::PushL( confirmationNote ); STIF_ASSERT_NOT_NULL( confirmationNote ); CleanupStack::Pop( confirmationNote ); confirmationNote->ExecuteLD(); return KErrNone; }
void CTTGPSLoggerCheckBoxSettingItem::HandleSettingPageEventL(CAknSettingPage *aSettingPage, TAknSettingPageEvent aEventType) { HBufC* iMsgSettingChanged = CEikonEnv::Static()->AllocReadResourceL(R_TTGP_TBUF_MSG_SETTING_CHANGED); CAknConfirmationNote *note = new (ELeave) CAknConfirmationNote(EFalse); note->ExecuteLD(*iMsgSettingChanged ); delete iMsgSettingChanged; CAknEnumeratedTextSettingItem::HandleSettingPageEventL(aSettingPage, aEventType); if (aEventType == MAknSettingPageObserver::EEventSettingOked) { // } else if (aEventType == MAknSettingPageObserver::EEventSettingCancelled) { LoadL(); } }
// ----------------------------------------------------------------------------- // CTestSDKNotes::TestNCNHandlePointerEventL // ----------------------------------------------------------------------------- TInt CTestSDKNotes::TestNCNHandlePointerEventL( CStifItemParser& /*aItem*/ ) { CAknConfirmationNote* note = new (ELeave) CAknConfirmationNote; CleanupStack::PushL( note ); STIF_ASSERT_NOT_NULL( note ); TPointerEvent event; event.iType = TPointerEvent::EButton1Down; event.iModifiers = 0; TPoint eventPos( KPoint1, KPoint2 ); event.iPosition = eventPos; event.iParentPosition = eventPos; note->HandlePointerEventL( event ); CleanupStack::PopAndDestroy( note ); return KErrNone; }
// --------------------------------------------------------- // CFepSetupContainer::UnInstallFepL // --------------------------------------------------------- // void CFepSetupContainer::UnInstallFepL() { TBuf<KFormatBufSize> formatingBuf; #ifndef __SERIES60_3X__ // Series60 1.x/2.x API HBufC* currentFep = iCoeEnv->NameOfInstalledFepL(); CleanupStack::PushL( currentFep ); TPtr currentFepPtr( currentFep->Des() ); currentFepPtr.LowerCase(); // remove case-sensitivity TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing if( ConeUtils::FileExists( KAknFepFileName )) // 2ndfp2 platform and newer use aknfep.fep { if( currentFepPtrC.Compare( TParsePtrC( KAknFepFileName ).Name() ) != 0 ) // Already installed? { iCoeEnv->InstallFepL( KAknFepFileName ); // Install the default Fep formatingBuf.Format( KFepUninstalled, ¤tFepPtrC ); } else { formatingBuf.Format( KFepAlreadyInstalled, ¤tFepPtrC ); } } else // older platforms use T9fep.fep { if( currentFepPtrC.Compare( TParsePtrC( KT9FepFileName ).Name() ) != 0 ) // Already installed? { iCoeEnv->InstallFepL( KT9FepFileName ); // Install the default Fep formatingBuf.Format( KFepUninstalled, ¤tFepPtrC ); } else { formatingBuf.Format( KFepAlreadyInstalled, ¤tFepPtrC ); } } CAknConfirmationNote* dialog = new(ELeave)CAknConfirmationNote(); dialog->ExecuteLD( formatingBuf ); CleanupStack::PopAndDestroy(); // currentFep #else // Series60 3.x API TUid currentFepUid = iEikonEnv->FepUid(); TInt defaultIndex = iFepUids.Find( KAknFepUid ); TPtrC defaultFepPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( defaultIndex )).Name()); // file name parsing if( currentFepUid == KAknFepUid ) // Already installed? { formatingBuf.Format( KFepAlreadyInstalled, &defaultFepPtr ); } else { iCoeEnv->InstallFepL( KAknFepUid ); // Install the default Fep formatingBuf.Format( KFepInstalled, &defaultFepPtr ); } CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote(); confirmationDialog->ExecuteLD( formatingBuf ); #endif }
// --------------------------------------------------------- // CFepSetupContainer::InstallFepL // --------------------------------------------------------- // void CFepSetupContainer::InstallFepL() { TBuf<KFormatBufSize> formatingBuf; TInt index( 0 ); CAknListQueryDialog* dlg = new(ELeave) CAknListQueryDialog( &index ); dlg->PrepareLC( R_FEPSETUP_LIST_QUERY ); dlg->SetItemTextArray( iNamesOfAvailableFeps ); dlg->SetOwnershipType( ELbmDoesNotOwnItemArray ); // Execute the dialog TInt answer = dlg->RunLD(); if( answer == EAknSoftkeyOk ) { #ifndef __SERIES60_3X__ // Series60 1.x/2.x API iEikonEnv->InfoMsg( TParsePtrC( iFileNamesOfAvailableFeps->MdcaPoint( index )).Name()); // The code below is to check whether the selected Fep is already installed. HBufC* fepToInstall = iFileNamesOfAvailableFeps->MdcaPoint( index ).AllocL(); CleanupStack::PushL( fepToInstall ); TPtr fepToInstallPtr( fepToInstall->Des() ); fepToInstallPtr.LowerCase(); // remove case-sensitivity TPtrC fepToInstallPtrC( TParsePtrC( fepToInstallPtr ).Name()); // file name parsing HBufC* currentFep = iCoeEnv->NameOfInstalledFepL(); CleanupStack::PushL( currentFep ); TPtr currentFepPtr( currentFep->Des() ); currentFepPtr.LowerCase(); // remove case-sensitivity TPtrC currentFepPtrC( TParsePtrC( currentFepPtr ).Name()); // file name parsing if( fepToInstallPtrC.Compare( currentFepPtrC ) == 0) // Already installed? { formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtrC ); } else { // Loads the specified FEP DLL into all running applications. // The current loaded FEP, if any, will be unloaded. iCoeEnv->InstallFepL( iFileNamesOfAvailableFeps->MdcaPoint( index )); formatingBuf.Format( KFepInstalled, &fepToInstallPtrC ); } CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote(); confirmationDialog->ExecuteLD( formatingBuf ); CleanupStack::PopAndDestroy( 2 ); // currentFep, fepToInstall; #else // Series60 3.x API TPtrC fepToInstallPtr( TParsePtrC( iNamesOfAvailableFeps->MdcaPoint( index )).Name()); // file name parsing iEikonEnv->InfoMsg( fepToInstallPtr ); // The code below is to check whether the selected Fep is already installed. TUid fepToInstallUid = iFepUids[index]; TUid currentFepUid = iEikonEnv->FepUid(); if( currentFepUid == fepToInstallUid ) { formatingBuf.Format( KFepAlreadyInstalled, &fepToInstallPtr ); } else { // Loads the specified FEP DLL into all running applications. // The current loaded FEP, if any, will be unloaded. iCoeEnv->InstallFepL( fepToInstallUid ); formatingBuf.Format( KFepInstalled, &fepToInstallPtr ); } CAknConfirmationNote* confirmationDialog = new(ELeave)CAknConfirmationNote(); confirmationDialog->ExecuteLD( formatingBuf ); #endif } else { iEikonEnv->InfoMsg( KNoFep ); } }
void CAzqInternalGPSReader::RunL() { iState = EReadComplete; if(iStatus.Int() == KErrNone ) { iPositionInfo.GetPosition(iPosition); if(iSyncTimeWhenValid) { User::SetUTCTime(iPosition.Time()); iSyncTimeWhenValid = EFalse; CAknConfirmationNote* informationNote = new (ELeave) CAknConfirmationNote(EFalse); _LIT(KConfirmText,"GPS TimeSync Successful"); informationNote->ExecuteLD(KConfirmText); } TAzqGPSData aGPSData; _LIT8(KGPSPosValFormat8,"%.05f"); TBuf8<32> tmpdst,tmpsrc; ///////////////////LAT tmpdst.Zero(); tmpsrc.Format(KGPSPosValFormat8,iPosition.Latitude()); //TGPSData::ConvertFromDDDMM_MMMM_TO_DD_DDDDD(tmpdst,tmpsrc); aGPSData.iLat.Copy(tmpsrc); if(iPosition.Latitude()<0) { _LIT(KSouthInd,"S"); aGPSData.iLat += KSouthInd; } else { _LIT(KNorthInd,"N"); aGPSData.iLat += KNorthInd; } /////////////////////// ///////////////////LON tmpdst.Zero(); tmpsrc.Format(KGPSPosValFormat8,iPosition.Longitude()); //TGPSData::ConvertFromDDDMM_MMMM_TO_DD_DDDDD(tmpdst,tmpsrc); aGPSData.iLon.Copy(tmpsrc); if(iPosition.Longitude()<0) { _LIT(KWestInd,"W"); aGPSData.iLon += KWestInd; } else { _LIT(KEastInd,"E"); aGPSData.iLon += KEastInd; } _LIT(KGPSStateUpdate,"Got GPS position report"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,aGPSData ); //////////////////////// } else { TAzqGPSData aGPSData; iObserver.OnGPSStateUpdate(KGetGPSPositionFailedStr,aGPSData ); } StartL(); }
void CTTGPSLoggerPositionRequester::RunL() { switch (iStatus.Int()) { case KErrNone: case KPositionPartialUpdate: { SetPositionModuleInfo(); iPositionData->SetPositionInfoL(iPositionModuleInfo, iPositionInfo); for (int i1 = 0; i1 < iPositionObserver.Count(); i1++) { if (iStatus.Int() == KErrNone) { iPositionObserver[i1]->PositionUpdatedL(iPositionData); } else { iPositionObserver[i1]->PositionUpdatedPartialL(iPositionData); } } iPositionInfo->ClearPositionData(); iPositioner.NotifyPositionUpdate(*iPositionInfo, iStatus); SetActive(); break; } case KPositionQualityLoss: { SetPositionModuleInfo(); iPositionInfo->ClearPositionData(); for (int i1 = 0; i1 < iPositionObserver.Count(); i1++) { iPositionObserver[i1]->PositionQualityLossL(); } iPositioner.NotifyPositionUpdate(*iPositionInfo, iStatus); SetActive(); break; } case KErrTimedOut: { SetPositionModuleInfo(); iPositionInfo->ClearPositionData(); for (int i1 = 0; i1 < iPositionObserver.Count(); i1++) { iPositionObserver[i1]->PositionTimedOutL(); } iPositioner.NotifyPositionUpdate(*iPositionInfo, iStatus); SetActive(); break; } //case KErrArgument: //{ //iPositionInfoBase = &iPositionInfo[0]; //iPositioner.NotifyPositionUpdate(*iPositionInfoBase, iStatus); //SetActive(); //break; //} case KErrCancel: { break; } case KErrArgument: case KErrAccessDenied: default: iPositionInfo->ClearPositionData(); for (int i1 = 0; i1 < iPositionObserver.Count(); i1++) { iPositionObserver[i1]->PositionErrorL(iStatus.Int()); } CAknQueryDialog* dialog1 = CAknQueryDialog::NewL(); if (dialog1->ExecuteLD(R_TTGP_DIALOG_QUERY_NOTITLE_YESNO, *iMsgLBSError1)) { StartL(); } else { CAknConfirmationNote *note = new (ELeave) CAknConfirmationNote(EFalse); note->ExecuteLD(*iMsgLBSError2); } break; } }
void CAzqBtGPSReader::RunL() { iCallbackTimer->Cancel(); switch(iState) { case ENoState: break; case EInquiringDevices: { if( iStatus !=KErrNone) { iHostResolver.Close(); if(iStatus == KErrHostResNoMoreResults) { { iGPSData.Reset(); _LIT(KGPSStateUpdate,"BT GPS Search finished..."); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } //choose and connect to BT GPS modules if(iBtGPSArray.Count()>0) { User::LeaveIfError(iSendingSocket.Open(iSocketServer,RFCOMM)); TBTSockAddr address; address.SetBTAddr(iBtGPSArray[0]); // GPS devices usually use port 1 as data channel // so we don't have to query it address.SetPort(1); { iGPSData.Reset(); iState = EConnecting; _LIT(KGPSStateUpdate,"Trying to connect to first device"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } iSendingSocket.Connect(address, iStatus); SetActive(); ResetBtTimer(); } else { { iGPSData.Reset(); iState = ENoState; _LIT(KGPSStateUpdate,"No BT GPS. Retry press 9"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } } } else { { iGPSData.Reset(); iState = ENoState; _LIT(KGPSStateUpdate,"Search failed. Retry press 9"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } } } else { TInquirySockAddr &addr = TInquirySockAddr::Cast(iNameEntry().iAddr); if(addr.MajorClassOfDevice() == KBtGPSMajorClass) { //add to array... iBtGPSArray.AppendL(addr.BTAddr()); { iGPSData.Reset(); _LIT(KGPSStateUpdate,"Found %d BT GPS, Searching..."); TBuf<128> buf; buf.Format(KGPSStateUpdate, iBtGPSArray.Count()); iObserver.OnGPSStateUpdate(buf,iGPSData ); } } ///////////get next device iState = EInquiringDevices; iHostResolver.Next(iNameEntry, iStatus); SetActive(); ResetBtTimer(); /////////////////////////////////// } } break; case EConnecting: { if( iStatus !=KErrNone) { //remove previous device from array if(iBtGPSArray.Count()>0) { iBtGPSArray.Remove(0); } //if more gps devices remaining to try if(iBtGPSArray.Count()>0) { //socket alraedy opened... TBTSockAddr address; address.SetBTAddr(iBtGPSArray[0]); // GPS devices usually use port 1 as data channel // so we don't have to query it address.SetPort(1); iState = EConnecting; { iGPSData.Reset(); _LIT(KGPSStateUpdate,"Connecting next device"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } iSendingSocket.Connect(address, iStatus); SetActive(); ResetBtTimer(); } else//finished list { { iGPSData.Reset(); iState = ENoState; _LIT(KGPSStateUpdate,"Connect GPS failed. Retry press 9"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } iSendingSocket.Close(); } } else { iState = EReading; { _LIT(KGPSStateUpdate,"Reading GPS data..."); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } iWaitGPSReadyRetry = 0; //only related if iSyncTimeWhenValid is ETrue line.Zero(); iLineHeadReceivedTime = 0;//just to make sure it's fresh iSendingSocket.RecvOneOrMore(data, 0, iStatus, iReadDataLength); SetActive(); ResetBtTimer(); } } break; case EReading: { if( iStatus !=KErrNone) { { iGPSData.Reset(); iState = ENoState; _LIT(KGPSStateUpdate,"Read GPS failed. Retry press 9"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } iSendingSocket.Close(); return; } iState = EReadComplete; iGPSData.Reset();//prepare for new data int rpos = 0; while ((rpos = data.Locate('\r')) != KErrNotFound) { TPtrC8 leftr(0,0); leftr.Set(data.Left(rpos)); TInt leftrlen = leftr.Length(); if(leftrlen + line.Length() < line.MaxLength()) { if(line.Length()==0) iLineHeadReceivedTime.HomeTime(); line.Append(leftr); } else { line.Zero(); if(leftrlen + line.Length() < line.MaxLength()) { //if(line.Length()==0) sure it is, see above lines iLineHeadReceivedTime.HomeTime(); line.Append(leftr); } } if(rpos+1<data.Length()) { data.Copy(data.Mid(rpos+1)); if(data[0] == '\n') data.Delete(0,1); } else { data.Zero(); } TGPSData gpsdata; TTimeIntervalMicroSeconds proctime; if(iLineHeadReceivedTime == TTime(0))//just in case... { iLineHeadReceivedTime.HomeTime(); CAknWarningNote* informationNote = new (ELeave) CAknWarningNote(ETrue); //informationNote->SetTimeout(CAknNoteDialog::EShortTimeout); _LIT(KConfirmText,"Warning: No read-offset time correction"); informationNote->ExecuteLD(KConfirmText); } if(gpsdata.ParseGPSInput(line,iLineHeadReceivedTime,proctime)) { if((gpsdata.POS_STAT.Length() == 0) || (gpsdata.POS_STAT.Length()>0 && gpsdata.POS_STAT[0]!='A'))//if data NOT valid { ///////////////BEGIN parsed but NOT valid data if(iSyncTimeWhenValid)//if the NetMonview is in the "Awaiting Fresh GPS Params State for the first time of session - needs time sync" { if(iWaitGPSReadyRetry>=KMaxWaitGPSReadyRetries) { //max retries finished, notify as in EReadcomplete state as set by above _LIT(KGPSStateUpdate,"GPS Connected but Not Ready"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); iSyncTimeWhenValid = EFalse; } else { //don't notify as in EReadcomplete state yet... iState = EReading; iWaitGPSReadyRetry++; TBuf<64> buf; _LIT(KGPSStateUpdateFormat,"GPS NotReady: TimeSync retry %d/%d"); buf.Format(KGPSStateUpdateFormat,iWaitGPSReadyRetry,KMaxWaitGPSReadyRetries); iObserver.OnGPSStateUpdate(buf,iGPSData ); } } else { _LIT(KGPSStateUpdate,"GPS Connected but Not Ready"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); } //latdeg = londeg = latmin = lonmin = latsec = lonsec = 0; line.Zero(); if(data.Length()>0) { if(line.Length() + data.Length() < line.MaxLength()) { iLineHeadReceivedTime.HomeTime(); line.Append(data); } else { line.Zero(); if(line.Length() + data.Length() < line.MaxLength()) { //line is zero len from line.Zero() above iLineHeadReceivedTime.HomeTime(); line.Append(data); } } } data.Zero(); iState = EReading; iSendingSocket.RecvOneOrMore(data, 0, iStatus, iReadDataLength); SetActive(); ResetBtTimer(); return; ///////////////END not valid } ////////// boyond here is the VALID case ////////////set device's UTC time if(iSyncTimeWhenValid) { TTime devTime; devTime.HomeTime(); TDateTime dt = devTime.DateTime(); if(gpsdata.POS_UTC.Length() < 6 || gpsdata.DATE.Length() < 6) { //line not ready/full... do nothing } else { //All NMEA chars are ASCII dt.SetHour((gpsdata.POS_UTC[0]-48)*10+(gpsdata.POS_UTC[1]-48)); dt.SetMinute((gpsdata.POS_UTC[2]-48)*10+(gpsdata.POS_UTC[3]-48)); dt.SetSecond((gpsdata.POS_UTC[4]-48)*10+(gpsdata.POS_UTC[5]-48)); dt.SetDay((gpsdata.DATE[0]-48)*10+(gpsdata.DATE[1]-48) -1); dt.SetMonth(TMonth((gpsdata.DATE[2]-48)*10+(gpsdata.DATE[3]-48) -1)); dt.SetYear((gpsdata.DATE[4]-48)*10+(gpsdata.DATE[5]-48)+KY2K); if(gpsdata.POS_UTC.Length()>9 && gpsdata.POS_UTC.Find(_L8("."))>0) { dt.SetMicroSecond((gpsdata.POS_UTC[7]-48)*KONEHUNDREDTHOUSAND+(gpsdata.POS_UTC[8]-48)*KTENTHOUSAND+(gpsdata.POS_UTC[9]-48)*1000); } devTime = dt; devTime += proctime; #ifdef EKA2 User::SetUTCTime(devTime); #else //TODO: detect timezone and add accordingly TTime hometime(devTime); hometime += TTimeIntervalHours(7); User::SetHomeTime(hometime); #endif iSyncTimeWhenValid = EFalse; CAknConfirmationNote* informationNote = new (ELeave) CAknConfirmationNote(EFalse); //informationNote->SetTimeout(CAknNoteDialog::EShortTimeout); _LIT(KConfirmText,"GPS TimeSync Successful"); informationNote->ExecuteLD(KConfirmText); //TODO: report to scheduler that device time has changed? OR let scheduler detect device time change? } } ///////////////////////// //SET LAT LON values... TBuf<1> ref; if(gpsdata.LAT.Length() < iGPSData.iLat.MaxLength() && gpsdata.LAT_REF.Length()==1) { iGPSData.iLat.Copy(gpsdata.LAT); ref.Zero(); ref.Copy(gpsdata.LAT_REF); iGPSData.iLat+=ref; } if(gpsdata.LON.Length() < iGPSData.iLon.MaxLength() && gpsdata.LON_REF.Length()==1) { iGPSData.iLon.Copy(gpsdata.LON); ref.Zero(); ref.Copy(gpsdata.LON_REF); iGPSData.iLon+=ref; } _LIT(KGPSStateUpdate,"Connected to GPS"); iObserver.OnGPSStateUpdate(KGPSStateUpdate,iGPSData ); }//END if gps parsed line.Zero(); } if(data.Length()>0) { if(line.Length() + data.Length() < line.MaxLength()) { if(line.Length()==0) //if not appending data to previous line iLineHeadReceivedTime.HomeTime(); line.Append(data); } else { line.Zero(); if(line.Length() + data.Length() < line.MaxLength()) { //if(line.Length()==0) sure it is, see above lines iLineHeadReceivedTime.HomeTime(); line.Append(data); } } } data.Zero(); iState = EReading; iSendingSocket.RecvOneOrMore(data, 0, iStatus, iReadDataLength); SetActive(); ResetBtTimer(); } break; } }
int main(int argc, char *argv[]) { bool running = false; TFullName res; TFindProcess find; while(find.Next(res) == KErrNone) { RProcess ph; ph.Open(res); if(ph.SecureId() == 0x2002B30D) if (ph.ExitType() == EExitPending) { running = true; break; } ph.Close(); } if (running == false) { QProcess *myProcess = new QProcess; myProcess->start("whatsapp.exe"); } else { QApplication app(argc, argv); CAknConfirmationNote* run = new (ELeave) CAknConfirmationNote; QT_TRAP_THROWING(run->ExecuteLD(_L("Closed WhatsApp"))); TFullName res1; TFindProcess find1(_L("*[2002B306]*")); while(find1.Next(res1) == KErrNone) { RProcess ph1; ph1.Open(find1); ph1.Kill(KErrNone); ph1.Close(); } TFullName res2; TFindProcess find2(_L("*[2002B310]*")); while(find2.Next(res2) == KErrNone) { RProcess ph2; ph2.Open(find2); ph2.Kill(KErrNone); ph2.Close(); } TFullName res3; TFindProcess find3(_L("*[2002B30D]*")); while(find3.Next(res3) == KErrNone) { RProcess ph3; ph3.Open(find3); ph3.Kill(KErrNone); ph3.Close(); } QTest::qWait(1500); } return 1; }