Exemplo n.º 1
0
void CmyPlay::MapcInitComplete(TInt aError, const TTimeIntervalMicroSeconds &aDuration)
    {
    __LOGSTR("MapcInitComplete");
    iState = aError ? ENotReady : EReady;
    __LOGSTR1("after MapcInitComplete max vol: %d",iPlayer->MaxVolume());
    if(iNeedToSetVolume)
        {
            iPlayer->SetVolume(iNewVolume);
            iNeedToSetVolume = EFalse;
        }
    if(iAllow)
        iPlayer->Play();
    __LOGSTR1("iState: %d",iState);
    }
Exemplo n.º 2
0
TInt CMyServer::RunError(TInt aError)
    {
#ifdef __DEBUG
    __LOGSTR1("RunError: %d",aError);
#endif
    return KErrNone;
    }
Exemplo n.º 3
0
void CButton::Draw()
	{
	iWindow.SetPosition(TPoint(0,iScreenSize.iY-60));
	iWindow.SetSize(TSize(iScreenSize.iX,60));
	iWindow.SetVisible(ETrue);
	TInt i = iScreenSize.iY-60;
	__LOGSTR1("i: %d",i);
	iGc->Activate(iWindow);
	iRectButton = TRect(TPoint(0,0),TSize(iScreenSize.iX,60));
	iWindow.Invalidate();
	iWindow.BeginRedraw();
	iGc->Clear();
	iGc->SetPenColor(iColor);
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	iGc->UseFont(iFont);
	iGc->SetPenColor(KRgbBlue);
	iGc->SetBrushColor(KRgbGray);
	iGc->Clear(iRectButton);
	iGc->DrawText(_L("Демо(Пропустить)"),iRectButton/*TRect(0,0, iRectButton.Width(),iRectButton.Height())*/,60-iFont->FontMaxAscent(), CGraphicsContext::ECenter, 0);
	/*iGc->SetPenColor(KRgbSilver);
	iGc->DrawLine(TPoint(iScreenSize.iX/2,0),TPoint(iScreenSize.iX-1,0));//горизонтальная сверху
	iGc->DrawLine(TPoint(iScreenSize.iX-1,0),TPoint(iScreenSize.iX-1,60));//Вертикальная справа
	iGc->DrawLine(TPoint(iScreenSize.iX/2,59),TPoint(iScreenSize.iX,59));//Горизонтальная снизу
	iGc->DrawLine(TPoint(iScreenSize.iX/2,0),TPoint(iScreenSize.iX/2,60));//Вертикальная справа
*/
	iWindow.EndRedraw();
	iGc->Deactivate();
	iWs.Flush();
	}
Exemplo n.º 4
0
void CDecoder::RunL()
    {
	if( iStatus == KErrUnderflow ) // continue converting
    {
    iDecoder->ContinueConvert( &iStatus );
    SetActive();
    }

	else if( iStatus == KErrNone )
	    {
		 // Nothing to do, we're done
	    iLoaded = ETrue;
	    }

    else // error
        {
        __LOGSTR1("Error while opening image:%d" , iStatus.Int()); // Error is my own error reporting function
        }

    // Stop blocking the Active Scheduler
	//iSchedWait->AsyncStop();

	// Free up resources for next time.
	/*if(iDecoder)
		{
		delete iDecoder;
		iDecoder = NULL;
		}
	if(iSchedWait)
		{
		delete iSynchroniser;
		iSynchroniser = NULL;
		}*/

    }
Exemplo n.º 5
0
void CMyServer::GetOrientation()
{
	iScreen->GetDefaultScreenSizeAndRotation(iPixels);
	iOrientation = iPixels.iRotation;
#ifdef __DEBUG
	__LOGSTR1("iOrientation: %d",iOrientation);
#endif
}
Exemplo n.º 6
0
void CButton::GetWgEvent()
    {
    #ifdef __DEBUG
    __LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
    #endif
   if(iStatus == KErrNone)
	{
    TWsEvent e;
    iWs.GetEvent(e);
    #ifdef __DEBUG
    __LOGSTR1("event: %d",e.Type());
    #endif
    switch(e.Type())
    	{
    	case EEventPointer:
    	case EEventPointerEnter:
    	case EEventDragDrop:
    	{
    	__LOGSTR("SendClose");
    	iMconnect->SendClose();
    	break;
    	}
    	case EEventFocusGained:
    		__LOGSTR("Focus gained");
    		iIsFocus = ETrue;
    		//iColor = KRgbGreen;
    		break;
    	case EEventFocusLost:
    		__LOGSTR("Focus lost");
    		iIsFocus = EFalse;
    		//iColor = KRgbRed;
    		break;
    	case EEventKeyDown:
    		__LOGSTR2("EEventKeyDown,iIsFocus: %d,iScanCode: %d",iIsFocus,e.Key()->iScanCode);
    		if(iIsFocus && e.Key()->iScanCode == 167)
    			{
    			iMconnect->SendClose();
    			}
    		break;
    	}
	}
	Draw();
	iWs.Flush();
    WaitWgEvent();
    }
Exemplo n.º 7
0
void ShowNoteL(const TDesC& aNote)
	{
	__LOGSTR("ShowNote");
	__LOGSTR1("ShowGlobalNote: %S",&aNote);

	CAknGlobalNote* note = CAknGlobalNote::NewLC();
	TInt NoteId;
	NoteId = note->ShowNoteL(EAknGlobalInformationNote,aNote);
	User::After(5000000);
	note->CancelNoteL(NoteId);
	__CPOPD(note);
	}
Exemplo n.º 8
0
void CPhoneReceiver::RunL()
{
#ifdef __DEBUG
	__LOGSTR1("CPhoneReceiver::RunL(),iCurrentStatusPckg: %d",iCurrentStatusPckg().iStatus);
#endif
	/*if(iNumms > 2)
		return ;*/
	if(iStatus.Int() == KErrNone)
	{
		//Get call status
		iCallStatus = iCurrentStatusPckg().iStatus;
		switch(iCallStatus)
		{
		case CTelephony::EStatusRinging:
			//++iNumms;
			iPhoneReceiverObserver.CallRinging();
			break;

		case CTelephony::EStatusAnswering:
			iPhoneReceiverObserver.CallAnswered();
			break;
		default:
#ifdef __DEBUG
			__LOGSTR("default");
#endif
			break;
		}
#ifdef __DEBUG
		__LOGSTR("Run startL");
#endif
	//StartL();
	}
	else
	{
#ifdef __DEBUG
		__LOGSTR1("Error In status,iStatus: %d",iStatus.Int());
#endif
	}
	StartL();
}
Exemplo n.º 9
0
void CMyServer::GetWgEvent()
    {
    #ifdef __DEBUG
    __LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
    #endif
   if(iStatus == KErrNone)
	{
    TWsEvent e;
    iWs.GetEvent(e);
    #ifdef __DEBUG
    __LOGSTR1("event: %d",e.Type());
    #endif
	}
    TInt WgId = iWs.GetFocusWindowGroup();
    CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(iWs, WgId);
    #ifdef __DEBUG
    __LOGSTR2("focused app with uid: 0x%x,config uid: 0x%x",gn->AppUid(),iConfig.iUid);
    #endif
    if(gn->AppUid() == iConfig.iUid)
	{

    	Show();
	//Draw();
    //iWindow.SetVisible(ETrue);
    //iWs.Flush();
    #ifdef __DEBUG
	__LOGSTR("UIDs ==");
    #endif
	}else{
	//iWindow.SetVisible(EFalse);
		Hide();
	iWs.Flush();
    #ifdef __DEBUG
	__LOGSTR("UIDs !=");
    #endif
	}
    WaitWgEvent();
    }
Exemplo n.º 10
0
TInt ParseCopy(const TDesC& aString)
	{
	__LOGSTR("ParseCopy");
	TBuf<256> aOld;
	TBuf<256> aNew;
	TInt found;
	TInt err = -1;
	found = aString.Find(KParseCopyString);

	__LOGSTR1("found parsered statement: %d",found);

	if(found != KErrNotFound)
		{
	aOld = aString.Left(found);
	aNew = aString.Right(aString.Length()-(found+3));

	__LOGSTR1("aOld:%S",&aOld);
	__LOGSTR1("aNew:%S",&aNew);

	err = Copy(aOld,aNew);
		}
	return err;
	}
Exemplo n.º 11
0
TInt Copy(const TDesC& aOld,const TDesC& aNew)
	{
	__LOGSTR("Copy");
	TInt err;
	RFs session;
	__CH__(session.Connect());
	__CPUSHC(session);
	CFileMan* manager = CFileMan::NewL(session);
	__CPUSH(manager);
	err = manager->Copy(aOld,aNew,CFileMan::ERecurse | CFileMan::EOverWrite);

	__LOGSTR1("Copy returned value: %d",err);
	__CPOPD(manager);
	__CPOPD(&session);
	return err;
	}
Exemplo n.º 12
0
void CMyServer::Draw(const TDesC& aText)
    {
	__LOGSTR("CMyServer::Draw");
	__LOGSTR1("Draw text: %S",&aText);
	GetFontSize();
	iWindow.SetSize(iSize);
	iWindow.SetPosition(TPoint(0,0)/*iPos*/);
	iWindow.SetVisible(ETrue);
	iGc->Activate(iWindow);
	//TRect Drw(iPos,iSize);
	iRect = TRect(iPos,iSize);
	iWindow.Invalidate(iRect);
	iWindow.BeginRedraw();
	iGc->Clear();
	iGc->SetPenColor(iConfig.iColor);
	iGc->SetBrushStyle(CGraphicsContext::ESolidBrush);
	iGc->UseFont(iFont);
	iGc->DrawText(iTitle,TRect(0,0, iRect.Width(),iRect.Height()),iFont->FontMaxAscent(), CGraphicsContext::ELeft, 0);
	iGc->DrawText(aText,TRect(0,iSize.iHeight/2, iRect.Width(),iRect.Height()),iFont->FontMaxAscent(), CGraphicsContext::ECenter, 0);
    iWindow.EndRedraw();
    iGc->Deactivate();
    iWs.Flush();
    }
Exemplo n.º 13
0
LOCAL_C void SavePanic(TInt aError)
	{
	__LOGSTR1("Panic: %d",aError);
	}
Exemplo n.º 14
0
void CmyPlay::Open(TDesC& aFile)
    {
    iPlayer->OpenFileL(aFile);
    __LOGSTR1("Open file: %S",&aFile);
    }
Exemplo n.º 15
0
TInt CMyServer::RunError(TInt aError)
    {
    __LOGSTR1("RunError: %d",aError);
    return KErrNone;
    }
Exemplo n.º 16
0
void CMyServer::GetWgEvent()
    {
    __LOGSTR1("GetWgEvent,iStatus: %d",iStatus.Int());
   if(iStatus == KErrNone)
	{
    TWsEvent e;
    iWs.GetEvent(e);
    __LOGSTR1("event: %d",e.Type());
    switch(e.Type())
    	{
    	case EEventPointer:
    	case EEventPointerEnter:
    		//case EEventDragDrop:
    		{
    		__LOGSTR("EventPointer");
    		//обработчик клика
    		switch(iTypeEvent)
    			{
    			case ETypeCall:
    				{
    				if( e.Pointer()->iType == TPointerEvent::EButton1Down )
    					{
    					//iCaller->Cancel();
    					iCaller->Call(iDrawTextOld);
    					}
    				break;
    				}
    			case ETypeSearch:
    				if( e.Pointer()->iType == TPointerEvent::EButton1Down )
    					{
    					LaunchStandardBrowser();
    				break;
    					}
    			}
    		break;
    		}
    	}
	}
   /* TInt WgId = iWs.GetFocusWindowGroup();

    TUint handle = iWs.GetWindowGroupHandle(WgId);
    RWindowGroup wg_test = RWindowGroup(iWg);
    __LOGSTR2("handle: %d, constuct: %d",handle,wg_test.Construct(handle));

    CApaWindowGroupName* gn = CApaWindowGroupName::NewLC(iWs, WgId);
    __LOGSTR2("focused app with uid: 0x%x,config uid: 0x%x",gn->AppUid(),iConfig.iUid);
    if(gn->AppUid() == TUid::Uid(0xa0002f97))
    	{

        CApaWindowGroupName* test = CApaWindowGroupName::NewL(iWs,WgId);
        __LOGSTR2("1: system: %d, hidden: %d",test->IsSystem(),test->Hidden());
        test->SetSystem(ETrue);
        test->SetHidden(ETrue);
        __LOGSTR2("2: system: %d, hidden: %d",test->IsSystem(),test->Hidden());
        CEikonEnv* env = new CEikonEnv;
        env->ConstructL();
    	}
    if(gn->AppUid() == iConfig.iUid)
	{
    	iOldName = iEngine->ActiveProfileL()->ProfileName().Name();
    	Draw(iOldName);
	__LOGSTR("UIDs ==");
	}else{
	iWindow.SetVisible(EFalse);
	iWs.Flush();
	__LOGSTR("UIDs !=");
	}*/
    WaitWgEvent();
    }
Exemplo n.º 17
0
void CMyServer::ReadConf()
    {
    __LOGSTR("ReadConf");
    if(iFile.Open(iFs,KFileConfig,EFileRead) != KErrNone)
	{//file not exist
    __LOGSTR("File not exist");
	TInt err = iFs.MkDirAll(KFileConfigDir);
	__LOGSTR1("Mkdir: %d",err);
	iFile.Replace(iFs,KFileConfig,EFileRead|EFileWrite);
	TFileText text;
	iFile.Write(0,_L8("\xff\xfe"));//signature
	text.Set(iFile);
	text.Write(_L("140"));//iX
	text.Write(_L("190"));//iY
	text.Write(_L("120"));//iLandY
	text.Write(_L("150"));//iLandX
	text.Write(_L("15"));//iHeight
	text.Write(_L("0xffffff"));//TRgb white

	text.Write(_L("0x102750f0"));//default UID
	iFile.Close();
	ReadConf();
	}else{
	__LOGSTR("File exist");
	//file exist
	TFileText text;
	TLex lex;
	TBuf<32> buf;
	text.Set(iFile);
	text.Read(buf);
	lex.Assign(buf);
	lex.Val(iConfig.iX);

	text.Read(buf);
	lex.Assign(buf);
	lex.Val(iConfig.iY);

	text.Read(buf);
	lex.Assign(buf);
	lex.Val(iConfig.iLandY);

	text.Read(buf);
	lex.Assign(buf);
	lex.Val(iConfig.iLandX);

	text.Read(buf);
	lex.Assign(buf);
	lex.Val(iConfig.iHeight);

	text.Read(buf);
	if(buf.Left(2)==_L("0x"))
		buf.Delete(0,2);
	lex.Assign(buf);
	TUint32 rgb;
	lex.Val(rgb,EHex);
	iConfig.iColor = rgb;

	text.Read(buf);
	buf.Delete(0,2); // delete 0x
	lex.Assign(buf);
	TUint tempuid;
	lex.Val(tempuid,EHex);
	iConfig.iUid.iUid = tempuid;

	iFile.Close();
	}
    }