📄 test_e1122000.cpp
字号:
progressBuf.AppendNum(aChannel.GetChannelInfo().iChannelType,EHex);
}
UpdateProcessL(progressBuf);
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::DataError( CSensrvChannel& /*aChannel*/, TSensrvErrorSeverity /*aError*/)
{
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::UpdateProcessL(const TDesC& aProgressText)
{
if(iWaitDialog)
{
iWaitDialog->SetTextL(aProgressText);
}
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::StartWaitNoteL()
{
iWaitDialog = new (ELeave) CAknWaitDialog((REINTERPRET_CAST(CEikDialog**,&iWaitDialog)), ETrue);
iWaitDialog->PrepareLC(R_WAIT_NOTE_SOFTKEY_CANCEL);
iWaitDialog->SetCallback(this);
iWaitDialog->RunLD();
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::DialogDismissedL (TInt aButtonId)
{
iWaitDialog = NULL;
if(iSensrvSensorChannel)
{
iSensrvSensorChannel->StopDataListening();
iSensrvSensorChannel->CloseChannel();
}
delete iSensrvSensorChannel;
iSensrvSensorChannel = NULL;
TTimeIntervalSeconds measureInterval(0);
TTime nowTime;
nowTime.HomeTime();
nowTime.SecondsFrom(iStartTime,measureInterval);
TBuf<250> hjelpper(_L("Got "));
hjelpper.AppendNum(iDataCount);
hjelpper.Append(_L(" values in "));
hjelpper.AppendNum(measureInterval.Int());
hjelpper.Append(_L(" seconds."));
hjelpper.Append(_L("Measuring speed is "));
TInt cunt = (iDataCount / measureInterval.Int());
hjelpper.AppendNum(cunt);
hjelpper.Append(_L(" per. sec. Data:"));
hjelpper.Append(_L(", 1Max = "));
hjelpper.AppendNum(iData1Max);
hjelpper.Append(_L(", 1Min = "));
hjelpper.AppendNum(iData1Min);
hjelpper.Append(_L(", 2Max = "));
hjelpper.AppendNum(iData2Max);
hjelpper.Append(_L(", 2Min = "));
hjelpper.AppendNum(iData2Min);
hjelpper.Append(_L(", 3Max = "));
hjelpper.AppendNum(iData3Max);
hjelpper.Append(_L(", 3Min = "));
hjelpper.AppendNum(iData3Min);
ShowDialogL(hjelpper,_L("Done"));
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::HandleCommandL( TInt aCommand )
{
switch( aCommand )
{
case ESelectSensor:
if(iResultsContainer)
{
if(iSensrvSensorChannel)
{
iSensrvSensorChannel->StopDataListening();
iSensrvSensorChannel->CloseChannel();
}
delete iSensrvSensorChannel;
iSensrvSensorChannel = NULL;
delete iProppertyContainer;
iProppertyContainer = NULL;
TInt senIndex(-1);
if(iResultsContainer->SelectSensorL(senIndex))
{
if(senIndex >= 0 && senIndex < iChannelInfoList.Count())
{
iSensrvSensorChannel = CSensrvChannel::NewL( iChannelInfoList[senIndex] );
iSensrvSensorChannel->OpenChannelL();
Cba()->SetCommandSetL(R_PROPPERTY_CBA);
Cba()->DrawDeferred();
iProppertyContainer = CProppertyContainer::NewL(iSensrvSensorChannel);
AddToStackL(iProppertyContainer);
}
}
}
break;
case EShowInfo:
if(iProppertyContainer)
{
iProppertyContainer->ShowInfoL();
}
break;
case EModifyProperty:
if(iProppertyContainer)
{
iProppertyContainer->ModifyPropertyL();
}
break;
case ECancelStart:
{
Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT);
delete iSensrvSensorChannel;
iSensrvSensorChannel = NULL;
if(iProppertyContainer)
{
RemoveFromStack(iProppertyContainer);
}
delete iProppertyContainer;
iProppertyContainer = NULL;
}
break;
case EStartNow:
if(iSensrvSensorChannel)
{
Cba()->SetCommandSetL(R_AVKON_SOFTKEYS_OPTIONS_EXIT);
if(iProppertyContainer)
{
RemoveFromStack(iProppertyContainer);
}
delete iProppertyContainer;
iProppertyContainer = NULL;
iSensrvSensorChannel->StartDataListeningL( this, 1,1,iUpdateInterval);
iData1Max = iData2Max = iData3Max = -100000;
iData1Min = iData2Min = iData3Min = 100000;
iStartTime.HomeTime();
StartWaitNoteL();
}
break;
case EEikCmdExit:
case EAknSoftkeyExit:
Exit();
break;
default:
break;
}
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::GetAllChannelsL(void)
{
iChannelInfoList.Reset();
TSensrvChannelInfo mySearchConditions; // none, so matches all.
iSensrvChannelFinder->FindChannelsL(iChannelInfoList,mySearchConditions);
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::ShowDialogL(TDesC& aText,const TDesC& aHeading)
{
CAknMessageQueryDialog* dlg = CAknMessageQueryDialog::NewL(aText);
dlg->PrepareLC(R_ABOUT_HEADING_PANE);
dlg->SetHeaderTextL(aHeading);
dlg->RunLD();
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestAppUi::LogEventL(const TDesC& aEvent)
{
STATIC_CAST(CTestDocument*,Document())->LogToFileL(aEvent);
}
/*
---------------------------------------------------------------------------------------
---------------------------------------------------------------------------------------
*/
void CTestAppUi::DynInitMenuPaneL(TInt aResourceId, CEikMenuPane* aMenuPane)
{
if(R_DMGETUIDVALDS_MENU == aResourceId)
{
if(iProppertyContainer)
{
aMenuPane->SetItemDimmed(ESelectSensor,ETrue);
}
else
{
aMenuPane->SetItemDimmed(EStartNow,ETrue);
aMenuPane->SetItemDimmed(EShowInfo,ETrue);
aMenuPane->SetItemDimmed(EModifyProperty,ETrue);
}
}
}
/*
-----------------------------------------------------------------------------
*****************************************************************************
-----------------------------------------------------------------------------
*/
CTestDocument* CTestDocument::NewL( CEikApplication& aApp )
{
CTestDocument* self = NewLC( aApp );
CleanupStack::Pop( self );
return self;
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CTestDocument* CTestDocument::NewLC( CEikApplication& aApp )
{
CTestDocument* self =
new ( ELeave ) CTestDocument( aApp );
CleanupStack::PushL( self );
self->ConstructL();
return self;
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
void CTestDocument::ConstructL()
{
_LIT(KRecFilename ,"C:\\Sens_Check.txt");
CCoeEnv::Static()->FsSession().Delete(KRecFilename);
iDebugFile.Create(CCoeEnv::Static()->FsSession(),KRecFilename,EFileWrite|EFileShareAny);
}
/*
-----------------------------------------------------------------------------
----------------------------------------------------------------------------
*/
void CTestDocument::LogToFileL(const TDesC& aStuff)
{
if(iDebugFile.SubSessionHandle())
{
TBuf8<255> hjelpper;
hjelpper.Copy(aStuff);
iDebugFile.Write(hjelpper);
iDebugFile.Write(_L8("\r\n"));
}
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CTestDocument::CTestDocument( CEikApplication& aApp )
: CAknDocument( aApp )//
{
// No implementation required
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CTestDocument::~CTestDocument()
{
if(iDebugFile.SubSessionHandle())
{
iDebugFile.Close();
}
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CEikAppUi* CTestDocument::CreateAppUiL()
{
// Create the application user interface, and return a pointer to it;
// the framework takes ownership of this object
iTestAppUi =new ( ELeave )CTestAppUi;
return static_cast <CEikAppUi*>(iTestAppUi);
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
CApaDocument* CTestApplication::CreateDocumentL()
{
// Create an Test document, and return a pointer to it
return (static_cast<CApaDocument*>
( CTestDocument::NewL( *this ) ) );
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
TUid CTestApplication::AppDllUid() const
{
// Return the UID for the Test application
return KUidTestApp;
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
LOCAL_C CApaApplication* NewApplication()
{
return new CTestApplication();
}
/*
-----------------------------------------------------------------------------
-----------------------------------------------------------------------------
*/
GLDEF_C TInt E32Main()
{
return EikStart::RunApplication( NewApplication );
}
// End of File
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -