mmserv/sts/tsrc/ststester/src/ststester.cpp
changeset 47 c2e43643db4c
parent 22 128eb6a32b84
equal deleted inserted replaced
42:1fa3fb47b1e3 47:c2e43643db4c
    47                                 {
    47                                 {
    48                                 STR(""), KOperation_NextOptionPage
    48                                 STR(""), KOperation_NextOptionPage
    49                                 },
    49                                 },
    50                             // 0 - 9
    50                             // 0 - 9
    51                                 {
    51                                 {
       
    52                                         STR("Stop Current Alarm"),
       
    53                                         EOperation_StopCurrentAlarm
       
    54                                 },
       
    55                                 {
    52                                         STR("Play Default Beep"),
    56                                         STR("Play Default Beep"),
    53                                         EOperation_PlayDefaultBeep
    57                                         EOperation_PlayDefaultBeep
    54                                 },
    58                                 },
    55                                 {
    59                                 {
    56                                         STR("Play Clock Alarm"),
    60                                         STR("Play Default Alarm"),
    57                                         EOperation_PlayClockAlarm
    61                                         EOperation_PlayDefaultAlarm
    58                                 },
    62                                 },
    59                                 {
    63                                 {
    60                                         STR("Stop Clock Alarm"),
    64                                         STR("Play Default Beep as Alarm"),
    61                                         EOperation_StopClockAlarm
    65                                         EOperation_PlayDefaultasAlarm
    62                                 },
    66                                 },
    63                                 {
    67                                 {
    64                                 STR(""), KOperation_None
    68                                         STR("Play Incoming Call Alarm"),
    65                                 },
    69                                         EOperation_PlayIncomingCallAlarm
    66                                 {
    70                                 },
    67                                 STR(""), KOperation_None
    71                                 {
    68                                 },
    72                                         STR("Play Warning Beep"),
    69                                 {
    73                                         EOperation_PlayWarningBeep
    70                                 STR(""), KOperation_None
       
    71                                 },
    74                                 },
    72                                 {
    75                                 {
    73                                 STR(""), KOperation_None
    76                                 STR(""), KOperation_None
    74                                 },
    77                                 },
    75                                 {
    78                                 {
   115     TRAP_IGNORE(MainL());
   118     TRAP_IGNORE(MainL());
   116     }
   119     }
   117 
   120 
   118 void CStsTester::MainL()
   121 void CStsTester::MainL()
   119     {
   122     {
       
   123     _LIT(KStopCurrentAlarm, "Stop Current Alarm");
   120     _LIT(KPlayDefault, "Play Default Beep");
   124     _LIT(KPlayDefault, "Play Default Beep");
   121     _LIT(KPlayClockAlarm, "Play Clock Alarm");
   125     _LIT(KPlayDefaultAlarm, "Play Default Alarm");
   122     _LIT(KStopClockAlarm, "Stop Clock Alarm");
   126     _LIT(KPlayDefaultAsAlarm, "Play Default Beep as Alarm");
       
   127     _LIT(KPlayIncomingCallAlarm, "Play Incoming Call Alarm");
       
   128     _LIT(KPlayWarningBeep, "Play Warning Beep");
   123     _LIT(KExit, "Exit");
   129     _LIT(KExit, "Exit");
   124 
   130 
   125     bool done = false;
   131     bool done = false;
   126 
   132 
   127     while (!done)
   133     while (!done)
   128         {
   134         {
   129         RPointerArray<TDesC> operations;
   135         RPointerArray<TDesC> operations;
       
   136         operations.Append(&KStopCurrentAlarm);
   130         operations.Append(&KPlayDefault);
   137         operations.Append(&KPlayDefault);
   131         operations.Append(&KPlayClockAlarm);
   138         operations.Append(&KPlayDefaultAlarm);
   132         operations.Append(&KStopClockAlarm);
   139         operations.Append(&KPlayDefaultAsAlarm);
       
   140         operations.Append(&KPlayIncomingCallAlarm);
       
   141         operations.Append(&KPlayWarningBeep);
   133         operations.Append(&KExit);
   142         operations.Append(&KExit);
   134 
   143 
   135         TInt index = SelectFromListL(TPoint(0, 0), iDisplaySize, _L(
   144         TInt index = SelectFromListL(TPoint(0, 0), iDisplaySize, _L(
   136                 "Select STS operation to perform:"), operations);
   145                 "Select STS operation to perform:"), operations);
   137 
   146 
   143             {
   152             {
   144             case -1:
   153             case -1:
   145                 done = true;
   154                 done = true;
   146                 break;
   155                 break;
   147             case 0:
   156             case 0:
       
   157                 ExecuteOperation(EOperation_StopCurrentAlarm, operationName);
       
   158                 break;
       
   159             case 1:
   148                 ExecuteOperation(EOperation_PlayDefaultBeep, operationName);
   160                 ExecuteOperation(EOperation_PlayDefaultBeep, operationName);
   149                 break;
   161                 break;
   150             case 1:
       
   151                 ExecuteOperation(EOperation_PlayClockAlarm, operationName);
       
   152                 break;
       
   153             case 2:
   162             case 2:
   154                 ExecuteOperation(EOperation_StopClockAlarm, operationName);
   163                 ExecuteOperation(EOperation_PlayDefaultAlarm, operationName);
   155                 break;
   164                 break;
   156             case 3:
   165             case 3:
       
   166                 ExecuteOperation(EOperation_PlayDefaultasAlarm, operationName);
       
   167                 break;
       
   168             case 4:
       
   169                 ExecuteOperation(EOperation_PlayIncomingCallAlarm, operationName);
       
   170                 break;
       
   171             case 5:
       
   172                 ExecuteOperation(EOperation_PlayWarningBeep, operationName);
       
   173                 break;
       
   174             case 6:
   157                 done = true;
   175                 done = true;
   158                 break;
   176                 break;
   159             }
   177             }
   160         }
   178         }
   161     }
   179     }
   162 
   180 
   163 void CStsTester::ExecuteOperation(TInt aOperation, const TDesC& /*aOperationText*/)
   181 void CStsTester::ExecuteOperation(TInt aOperation, const TDesC& /*aOperationText*/)
   164     {
   182     {
   165     switch (aOperation)
   183     switch (aOperation)
   166         {
   184         {
   167         case EOperation_PlayDefaultBeep:
   185         case EOperation_StopCurrentAlarm:
   168             {
       
   169             TAG_TIME_PROFILING_BEGIN;
       
   170             iSts->PlayTone(CSystemToneService::EDefaultBeep);
       
   171             TAG_TIME_PROFILING_END;
       
   172             PRINT_TO_CONSOLE_TIME_DIFF;
       
   173             break;
       
   174             }
       
   175         case EOperation_PlayClockAlarm:
       
   176             {
       
   177             // Only play if not already playing
       
   178             if (iPlayState != EPlaying)
       
   179                 {
       
   180                 iPlayState = EPlaying;
       
   181                 TAG_TIME_PROFILING_BEGIN;
       
   182                 iSts->PlayAlarm(CSystemToneService::EClockAlarm,
       
   183                         iCurrentContext, *this);
       
   184                 TAG_TIME_PROFILING_END;
       
   185                 PRINT_TO_CONSOLE_TIME_DIFF;
       
   186                 }
       
   187             break;
       
   188             }
       
   189         case EOperation_StopClockAlarm:
       
   190             {
   186             {
   191             TAG_TIME_PROFILING_BEGIN;
   187             TAG_TIME_PROFILING_BEGIN;
   192             iSts->StopAlarm(iCurrentContext);
   188             iSts->StopAlarm(iCurrentContext);
   193             TAG_TIME_PROFILING_END;
   189             TAG_TIME_PROFILING_END;
   194             PRINT_TO_CONSOLE_TIME_DIFF;
   190             PRINT_TO_CONSOLE_TIME_DIFF;
   195             iPlayState = EStopped;
   191             iPlayState = EStopped;
   196             break;
   192             break;
   197             }
   193             }
       
   194         case EOperation_PlayDefaultBeep:
       
   195             {
       
   196             TAG_TIME_PROFILING_BEGIN;
       
   197             iSts->PlayTone(CSystemToneService::EDefaultBeep);
       
   198             TAG_TIME_PROFILING_END;
       
   199             PRINT_TO_CONSOLE_TIME_DIFF;
       
   200             break;
       
   201             }
       
   202         case EOperation_PlayDefaultAlarm:
       
   203             {
       
   204             // Only play if not already playing
       
   205             if (iPlayState != EPlaying)
       
   206                 {
       
   207                 iPlayState = EPlaying;
       
   208                 TAG_TIME_PROFILING_BEGIN;
       
   209                 iSts->PlayAlarm(CSystemToneService::EClockAlarm,
       
   210                         iCurrentContext, *this);
       
   211                 TAG_TIME_PROFILING_END;
       
   212                 PRINT_TO_CONSOLE_TIME_DIFF;
       
   213                 }
       
   214             break;
       
   215             }
       
   216         case EOperation_PlayDefaultasAlarm:
       
   217             {
       
   218             // Only play if not already playing
       
   219             if (iPlayState != EPlaying)
       
   220                 {
       
   221                 iPlayState = EPlaying;
       
   222                 TAG_TIME_PROFILING_BEGIN;
       
   223                 iSts->PlayAlarm(CSystemToneService::EDefaultBeep,
       
   224                         iCurrentContext, *this);
       
   225                 TAG_TIME_PROFILING_END;
       
   226                 PRINT_TO_CONSOLE_TIME_DIFF;
       
   227                 }
       
   228             break;
       
   229             }
       
   230         case EOperation_PlayIncomingCallAlarm:
       
   231             {
       
   232             // Only play if not already playing
       
   233             if (iPlayState != EPlaying)
       
   234                 {
       
   235                 iPlayState = EPlaying;
       
   236                 TAG_TIME_PROFILING_BEGIN;
       
   237                 iSts->PlayAlarm(CSystemToneService::EIncomingCall,
       
   238                         iCurrentContext, *this);
       
   239                 TAG_TIME_PROFILING_END;
       
   240                 PRINT_TO_CONSOLE_TIME_DIFF;
       
   241                 }
       
   242             break;
       
   243             }
       
   244         case EOperation_PlayWarningBeep:
       
   245             {
       
   246             // Only play if not already playing
       
   247                 TAG_TIME_PROFILING_BEGIN;
       
   248                 iSts->PlayTone(CSystemToneService::EWarningBeep);
       
   249                 TAG_TIME_PROFILING_END;
       
   250                 PRINT_TO_CONSOLE_TIME_DIFF;
       
   251             break;
       
   252             }
   198         default:
   253         default:
   199             {
   254             {
   200             break;
   255             break;
   201             }
   256             }
   202         }
   257         }