satui/satapp/src/satappserverdispatcher.cpp
changeset 33 8d5d7fcf9b59
child 35 6aefa3341fcc
equal deleted inserted replaced
32:1f002146abb4 33:8d5d7fcf9b59
       
     1 /*
       
     2 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: Receives UI commands from SAT server and converts to QT
       
    15 *
       
    16 */
       
    17 
       
    18 // qt
       
    19 #include <QStringList>
       
    20 #include <qglobal.h>
       
    21 #include <QCoreApplication>
       
    22 // symbian
       
    23 #include <centralrepository.h>
       
    24 #include <ProfileEngineSDKCRKeys.h>
       
    25 
       
    26 // sat
       
    27 #include <msatuiadapter.h>
       
    28 #include "satappserverdispatcher.h"
       
    29 #include "satappaction.h"
       
    30 #include "satappconstant.h"
       
    31 
       
    32 
       
    33 // ----------------------------------------------------------------------------
       
    34 // SatAppServerDispatcher::SatAppServerDispatcher
       
    35 // ----------------------------------------------------------------------------
       
    36 //
       
    37 SatAppServerDispatcher::SatAppServerDispatcher(QObject *parent) :
       
    38     QObject(parent)
       
    39 {
       
    40     qDebug("SATAPP: SatAppServerDispatcher::SatAppServerDispatcher");
       
    41     QT_TRAP_THROWING(ConnectSatSessionL());
       
    42 }
       
    43 
       
    44 // ----------------------------------------------------------------------------
       
    45 // SatAppServerDispatcher::~SatAppServerDispatcher
       
    46 // ----------------------------------------------------------------------------
       
    47 //
       
    48 SatAppServerDispatcher::~SatAppServerDispatcher()
       
    49 {
       
    50     qDebug("SATAPP: SatAppServerDispatcher::~SatAppServerDispatcher");
       
    51     DisconnectSatSession();
       
    52 }
       
    53 
       
    54 // ----------------------------------------------------------------------------
       
    55 // SatAppServerDispatcher::menuSelection
       
    56 // ----------------------------------------------------------------------------
       
    57 //
       
    58 void SatAppServerDispatcher::menuSelection(SatAppAction* action)
       
    59 {
       
    60     qDebug("SATAPP: SatAppServerDispatcher::menuSelection >");
       
    61     if ( ESatSuccess == action->response() ) {
       
    62         // user selected item from menu
       
    63         int menuItem = action->value(KeySelection).toInt();
       
    64         int helpRequested = action->value(KeyHelpRequested).toBool();
       
    65         qDebug("SATAPP: SatAppServerDispatcher::MenuSelection item=%d",
       
    66             menuItem);
       
    67         iSat.Adapter()->MenuSelection(menuItem, helpRequested);
       
    68     } else if (ESatSessionTerminatedByUser == action->response()) {
       
    69         // session terminated while executing the menu action
       
    70         qDebug("SATAPP: SatAppServerDispatcher::SessionTerminated");
       
    71         iSat.Adapter()->SessionTerminated(EEndKeyUsed);
       
    72     }
       
    73     delete action;
       
    74     qDebug("SATAPP: SatAppServerDispatcher::menuSelection <");
       
    75 }
       
    76 
       
    77 // ----------------------------------------------------------------------------
       
    78 // SatAppServerDispatcher::userCancelResponse
       
    79 // ----------------------------------------------------------------------------
       
    80 //
       
    81 void SatAppServerDispatcher::userCancelSession(SatAppAction* action)
       
    82 {
       
    83     qDebug("SATAPP: SatAppServerDispatcher::userCancelSession");
       
    84     if (action && ESatBackwardModeRequestedByUser == action->response()){
       
    85         iSat.Adapter()->SessionTerminated(ESessionCancel);
       
    86     }    
       
    87     delete action;
       
    88     action = 0;
       
    89 }
       
    90 
       
    91 
       
    92 // ****************************************************************************
       
    93 // * ************************************************************************ *
       
    94 // * *                          SYMBIAN PART                                * *
       
    95 // * ************************************************************************ *
       
    96 // ****************************************************************************
       
    97 
       
    98 // ----------------------------------------------------------------------------
       
    99 // SatAppServerDispatcher::ConnectSatSessionL
       
   100 // ----------------------------------------------------------------------------
       
   101 //
       
   102 void SatAppServerDispatcher::ConnectSatSessionL()
       
   103 {
       
   104     qDebug("SATAPP: SatAppServerDispatcher::ConnectSatSessionL>");
       
   105     //Register to Server as subsession
       
   106     //If Server is not up, this function call may take time
       
   107     iSatSession.ConnectL();
       
   108     iSat.RegisterL(iSatSession, this);
       
   109     if (!iSat.Adapter())
       
   110         User::Leave(KErrNotFound);
       
   111     qDebug("SATAPP: SatAppServerDispatcher::ConnectSatSessionL<");
       
   112 }
       
   113 
       
   114 // ----------------------------------------------------------------------------
       
   115 // SatAppServerDispatcher::DisconnectSatSession
       
   116 // ----------------------------------------------------------------------------
       
   117 //
       
   118 void SatAppServerDispatcher::DisconnectSatSession()
       
   119 {
       
   120     qDebug("SATAPP: SatAppServerDispatcher::DisconnectSatSession>");
       
   121     iSat.Close();
       
   122     iSatSession.Close();
       
   123     qDebug("SATAPP: SatAppServerDispatcher::DisconnectSatSession<");
       
   124 }
       
   125 
       
   126 // ----------------------------------------------------------------------------
       
   127 // SatAppServerDispatcher::ProfileState
       
   128 // Get the profile status
       
   129 // ----------------------------------------------------------------------------
       
   130 //
       
   131 TInt SatAppServerDispatcher::ProfileState()
       
   132     {
       
   133     qDebug("SATAPP: SatAppServerDispatcher::ProfileState");
       
   134     TInt profileId(0);
       
   135     CRepository* cr (NULL);
       
   136 
       
   137     TRAPD(err, cr = CRepository::NewL(KCRUidProfileEngine));
       
   138     if ( KErrNone == err )
       
   139         {
       
   140         // Get the ID of the currently active profile:
       
   141         const TInt error = cr->Get(KProEngActiveProfile, profileId);
       
   142         qDebug("SATAPP: SatAppServerDispatcher::ProfileState error=%d",
       
   143                 error);
       
   144         delete cr;
       
   145         }
       
   146 
       
   147     return profileId;
       
   148     }
       
   149 
       
   150 // ----------------------------------------------------------------------------
       
   151 // My own quick string -> descriptor conversion function :-)
       
   152 // ----------------------------------------------------------------------------
       
   153 //
       
   154 void s2d(const QString str, TDes& desc)
       
   155 {
       
   156     desc.Copy(reinterpret_cast<const TUint16*>(str.utf16()), str.length());
       
   157 }
       
   158 
       
   159 // ----------------------------------------------------------------------------
       
   160 // SatAppServerDispatcher::DisplayTextL
       
   161 // ----------------------------------------------------------------------------
       
   162 //
       
   163 TSatUiResponse SatAppServerDispatcher::DisplayTextL( const TDesC& aText,
       
   164     const TDesC& aSimApplicationName,
       
   165     const TSatIconId& aIconId,
       
   166     TBool& aRequestedIconDisplayed,
       
   167     const TBool aSustainedText,
       
   168     const TTimeIntervalSeconds aDuration,
       
   169     const TBool aWaitUserToClear )
       
   170 {
       
   171     qDebug("SATAPP: SatAppServerDispatcher::DisplayTextL >");
       
   172     Q_UNUSED(aIconId);
       
   173     SatAppAction action(ESatDisplayTextAction);
       
   174     // validate
       
   175     if (aText.Length()== 0 || aText.Length()>RSat::KTextToDisplayMaxSize){
       
   176         qDebug("SATAPP: SatAppServerDispatcher::DisplayText no text");
       
   177         aRequestedIconDisplayed = EFalse;
       
   178         return ESatFailure;
       
   179     }
       
   180 
       
   181     QT_TRYCATCH_LEAVING(
       
   182         // ensure state
       
   183         emit stopShowWaitNote();
       
   184 
       
   185         // call
       
   186         action.set(KeyText,aText);
       
   187         action.set(KeyApplicationName, aSimApplicationName);
       
   188         action.set(KeySustainedText, aSustainedText);
       
   189         action.set(KeyDuration, const_cast<TTimeIntervalSeconds &>(aDuration));
       
   190         action.set(KeyWaitUserToClear, aWaitUserToClear);
       
   191 
       
   192         emit displayText(action);
       
   193         action.waitUntilCompleted();
       
   194     );
       
   195 
       
   196     // return
       
   197     qDebug("SATAPP: SatAppServerDispatcher::DisplayTextL action.response() %x<", 
       
   198         action.response());
       
   199     return action.response();
       
   200 }
       
   201 
       
   202 // ----------------------------------------------------------------------------
       
   203 // SatAppServerDispatcher::GetInkeyL
       
   204 // ----------------------------------------------------------------------------
       
   205 //
       
   206 TSatUiResponse SatAppServerDispatcher::GetInkeyL(
       
   207     const TDesC& aText,
       
   208     const TSatCharacterSet aCharacterSet,
       
   209     TChar& aInput,
       
   210     const TBool aHelpIsAvailable,
       
   211     const TSatIconId& aIconId,
       
   212     TBool& aRequestedIconDisplayed,
       
   213     TUint& aDuration,
       
   214     const TBool aImmediateDigitResponse )
       
   215 {
       
   216     Q_UNUSED(aHelpIsAvailable);
       
   217     Q_UNUSED(aIconId);
       
   218     
       
   219     qDebug("SATAPP: SatAppServerDispatcher::GetInkeyL >");
       
   220 
       
   221     // validate
       
   222     aRequestedIconDisplayed = EFalse;
       
   223     if (ESatYesNo == aCharacterSet && aText.Length() == 0) {
       
   224         qDebug("SATAPP: CSatUiObserver::GetInkey return ESatFailure");
       
   225         return ESatFailure;
       
   226     }
       
   227 
       
   228     SatAppAction action(ESatGetInkeyAction);
       
   229     QT_TRYCATCH_LEAVING(
       
   230         // ensure state
       
   231         emit stopShowWaitNote();
       
   232 
       
   233         // call
       
   234         action.set(KeyText,aText);
       
   235         action.set(KeyCharacterSet,(int)aCharacterSet);
       
   236         action.set(KeyInKey,(int)aInput);
       
   237         // convert from SAT time units(?) to milliseconds
       
   238         action.set(KeyDuration,(int)aDuration*KSymbianTimeConvertQtTime);
       
   239         action.set(KeyImmediate,(bool)aImmediateDigitResponse);
       
   240         emit getInkey(action);
       
   241         action.waitUntilCompleted();
       
   242         // convert from milliseconds to SAT time units(?)
       
   243         aDuration = 
       
   244                 action.value(KeyDuration).toInt()/KSymbianTimeConvertQtTime;
       
   245         aInput = action.value(KeyInKey).toInt();
       
   246     );
       
   247 
       
   248     // return
       
   249     qDebug("SATAPP: SatAppServerDispatcher::GetInkeyL <");
       
   250     return action.response();
       
   251 }
       
   252 
       
   253 // ----------------------------------------------------------------------------
       
   254 // SatAppServerDispatcher::GetInputL
       
   255 // ----------------------------------------------------------------------------
       
   256 //
       
   257 TSatUiResponse SatAppServerDispatcher::GetInputL(
       
   258     const TDesC& aText,
       
   259     const TSatCharacterSet aCharacterSet,
       
   260     TDes& aInput,
       
   261     const TInt aMinLength,
       
   262     const TInt aMaxLength,
       
   263     const TBool aHideInput,
       
   264     const TBool aHelpIsAvailable,
       
   265     const TSatIconId& aIconId,
       
   266     TBool& aRequestedIconDisplayed )
       
   267 {
       
   268     Q_UNUSED(aHelpIsAvailable);
       
   269     Q_UNUSED(aIconId);
       
   270     qDebug("SATAPP: SatAppServerDispatcher::GetInputL >");
       
   271 
       
   272     // validate
       
   273     aRequestedIconDisplayed = EFalse;
       
   274     if ((aCharacterSet == ESatCharSmsDefaultAlphabet ||
       
   275          aCharacterSet == ESatCharUcs2Alphabet) &&
       
   276          aHideInput) {
       
   277         qDebug("SATAPP: SatAppServerDispatcher::GetInput return ESatFailure");
       
   278         return ESatFailure;
       
   279     }
       
   280 
       
   281     SatAppAction action(ESatGetInputAction);
       
   282     QT_TRYCATCH_LEAVING(
       
   283         // ensure state
       
   284         emit stopShowWaitNote();
       
   285     
       
   286         // call
       
   287         action.set(KeyText,aText);
       
   288         action.set(KeyCharacterSet,(int)aCharacterSet);
       
   289         action.set(KeyInputString,aInput);
       
   290         action.set(KeyMinLength,aMinLength);
       
   291         action.set(KeyMaxLength,aMaxLength);
       
   292         action.set(KeyHideInput,(bool)aHideInput);
       
   293         emit getInput(action);
       
   294         action.waitUntilCompleted();
       
   295         s2d(action.value(KeyInputString).toString(), aInput);
       
   296     )
       
   297 
       
   298     // return
       
   299     qDebug("SATAPP: SatAppServerDispatcher::GetInputL <");
       
   300     return action.response();
       
   301 }
       
   302 
       
   303 // ----------------------------------------------------------------------------
       
   304 // SatAppServerDispatcher::SetUpMenuL
       
   305 // ----------------------------------------------------------------------------
       
   306 //
       
   307 TSatUiResponse SatAppServerDispatcher::SetUpMenuL(
       
   308     const TDesC& aText,
       
   309     const MDesCArray& aMenuItems,
       
   310     const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
   311     const TBool aHelpIsAvailable,
       
   312     const TSatIconId& aIconId,
       
   313     const CArrayFixFlat<TInt>* aMenuIcons,
       
   314     const enum TSatIconQualifier aIconListQualifier,
       
   315     const enum TSatSelectionPreference aSelectionPreference )
       
   316 {
       
   317     Q_UNUSED(aMenuItemNextActions);
       
   318     Q_UNUSED(aHelpIsAvailable);
       
   319     Q_UNUSED(aIconId);
       
   320     Q_UNUSED(aMenuIcons);
       
   321     Q_UNUSED(aIconListQualifier);
       
   322     Q_UNUSED(aSelectionPreference);
       
   323     qDebug("SATAPP: SatAppServerDispatcher::SetUpMenuL >");
       
   324 
       
   325     QT_TRYCATCH_LEAVING(
       
   326 
       
   327         // validate
       
   328         if (!aMenuItems.MdcaCount() ||
       
   329             (KSatActiveProfileOffline == ProfileState())) {
       
   330             emit clearScreen();
       
   331             QCoreApplication::instance()->quit();
       
   332             return ESatSuccess;
       
   333         }
       
   334 
       
   335         // ensure state
       
   336         emit stopShowWaitNote();
       
   337     
       
   338         // call
       
   339         SatAppAction* action = new SatAppAction(ESatSetUpMenuAction, this);
       
   340         action->set(KeyText,aText);
       
   341         action->set(KeyMenu,aMenuItems);
       
   342         // connect for asynchronous menu selection
       
   343         connect(
       
   344             action,SIGNAL(actionCompleted(SatAppAction*)),
       
   345             this,SLOT(menuSelection(SatAppAction*)));
       
   346         
       
   347         emit setUpMenu(*action);
       
   348     )
       
   349 
       
   350     // return
       
   351     qDebug("SATAPP: SatAppServerDispatcher::SetUpMenuL <");
       
   352     return ESatSuccess;
       
   353 }
       
   354 
       
   355 // ----------------------------------------------------------------------------
       
   356 // SatAppServerDispatcher::SelectItemL
       
   357 // ----------------------------------------------------------------------------
       
   358 //
       
   359 TSatUiResponse SatAppServerDispatcher::SelectItemL(
       
   360     const TDesC& aText,
       
   361     const MDesCArray& aMenuItems,
       
   362     const CArrayFixFlat<TSatAction>* aMenuItemNextActions,
       
   363     const TInt aDefaultItem,
       
   364     TUint8& aSelection,
       
   365     const TBool aHelpIsAvailable,
       
   366     const TSatIconId& aIconId,
       
   367     const CArrayFixFlat<TInt>* aMenuIcons,
       
   368     const enum TSatIconQualifier aIconListQualifier,
       
   369     TBool& aRequestedIconDisplayed,
       
   370     const enum TSatSelectionPreference aSelectionPreference )
       
   371 {
       
   372     Q_UNUSED(aMenuItemNextActions);
       
   373     Q_UNUSED(aHelpIsAvailable);
       
   374     Q_UNUSED(aIconId);
       
   375     Q_UNUSED(aMenuIcons);
       
   376     Q_UNUSED(aIconListQualifier);
       
   377     Q_UNUSED(aRequestedIconDisplayed);
       
   378     Q_UNUSED(aSelectionPreference);
       
   379     TSatUiResponse resp(ESatFailure);
       
   380     SatAppAction action(ESatSelectItemAction);
       
   381     qDebug("SATAPP: SatAppServerDispatcher::SelectItemL >");
       
   382 
       
   383     QT_TRYCATCH_LEAVING(
       
   384         // ensure state
       
   385         emit stopShowWaitNote();
       
   386     
       
   387         // call
       
   388         action.set(KeyText,aText);
       
   389         action.set(KeyMenu,aMenuItems);
       
   390         action.set(KeyDefault,aDefaultItem);
       
   391         emit selectItem(action);
       
   392         action.waitUntilCompleted();
       
   393         resp = action.response();
       
   394         if ( ESatSuccess == resp ) {
       
   395             aSelection = static_cast<TUint8>(
       
   396                     action.value(KeySelection).toInt());
       
   397         }
       
   398     )
       
   399 
       
   400     // return
       
   401     qDebug("SATAPP: SatAppServerDispatcher::SelectItemL <");
       
   402     return resp;
       
   403 }
       
   404 
       
   405 // ----------------------------------------------------------------------------
       
   406 // SatAppServerDispatcher::PlayTone
       
   407 // ----------------------------------------------------------------------------
       
   408 //
       
   409 TSatUiResponse SatAppServerDispatcher::PlayTone(
       
   410     const TDesC& aText,
       
   411     const TSatTone aTone,
       
   412     const TTimeIntervalMicroSeconds aDuration,
       
   413     const TSatIconId& aIconId,
       
   414     TBool& aRequestedIconDisplayed )
       
   415 {
       
   416     Q_UNUSED(aIconId);
       
   417     aRequestedIconDisplayed = EFalse;
       
   418     TSatUiResponse resp(ESatSuccess);
       
   419     qDebug("SATAPP: SatAppServerDispatcher::PlayTone >");
       
   420     SatAppAction action(ESatPlayToneAction);
       
   421     int err(KErrNone);
       
   422     QT_TRYCATCH_ERROR(
       
   423         err,
       
   424         // ensure state
       
   425         emit stopShowWaitNote();
       
   426     
       
   427         // call
       
   428         action.set(KeyText,aText);
       
   429         action.set(KeyToneId,aTone);
       
   430         action.set(KeyDuration, const_cast<TTimeIntervalMicroSeconds &>(aDuration));
       
   431         emit playTone(action);
       
   432         action.waitUntilCompleted();
       
   433         resp = action.response();
       
   434     )
       
   435 
       
   436     // return
       
   437     qDebug("SATAPP: SatAppServerDispatcher::PlayTone err = %d<", err);
       
   438     return resp;
       
   439 }
       
   440 
       
   441 
       
   442 // ----------------------------------------------------------------------------
       
   443 // SatAppServerDispatcher::ConfirmCommand
       
   444 // ----------------------------------------------------------------------------
       
   445 //
       
   446 void SatAppServerDispatcher::ConfirmCommand(
       
   447     const TSatSQueryCommand aCommandId,
       
   448     const TSatAlphaIdStatus aAlphaIdStatus,
       
   449     const TDesC& aText,
       
   450     const TDesC& aAdditionalText,
       
   451     TBool& aActionAccepted,
       
   452     const TSatIconId& aIconId,
       
   453     TBool& aRequestedIconDisplayed,
       
   454     TBool& aTerminatedByUser )
       
   455 {
       
   456     qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand >");
       
   457     Q_UNUSED(aIconId);
       
   458     aRequestedIconDisplayed = EFalse;
       
   459     aTerminatedByUser = EFalse;
       
   460     //ConfirmAction
       
   461     SatAppAction action(ESatConfirmAction);
       
   462     qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand");
       
   463     int err(KErrNone);
       
   464     QT_TRYCATCH_ERROR(
       
   465         err,
       
   466         emit stopShowWaitNote();
       
   467     
       
   468         action.set(KeyQueryCommandId, aCommandId);
       
   469         action.set(KeyAlphaIdStatus, aAlphaIdStatus);
       
   470         action.set(KeyText, aText);
       
   471         action.set(KeyAdditionalText, aAdditionalText);
       
   472         action.set(KeyActionAccepted, aActionAccepted);
       
   473 
       
   474         emit confirmCommand(action);
       
   475         action.waitUntilCompleted();
       
   476         if (ESatSuccess == action.response() ) {
       
   477             aActionAccepted = ETrue;
       
   478         }
       
   479     )
       
   480     qDebug("SATAPP: SatAppServerDispatcher::ConfirmCommand err = %d <", err);
       
   481 }
       
   482 
       
   483 // ----------------------------------------------------------------------------
       
   484 // SatAppServerDispatcher::Notification
       
   485 // ----------------------------------------------------------------------------
       
   486 //
       
   487 TSatUiResponse SatAppServerDispatcher::Notification(
       
   488     const TSatSNotifyCommand aCommandId,
       
   489     const TSatAlphaIdStatus aAlphaIdStatus,
       
   490     const TDesC& aText,
       
   491     const TSatIconId& aIconId,
       
   492     TBool& aRequestedIconDisplayed,
       
   493     const TSatControlResult aControlResult )
       
   494 {
       
   495     Q_UNUSED(aIconId);
       
   496     Q_UNUSED(aRequestedIconDisplayed);
       
   497     qDebug("SATAPP: SatAppServerDispatcher::Notification command id=%d",
       
   498         aCommandId);
       
   499 
       
   500     TSatUiResponse res(ESatFailure);
       
   501     int err(KErrNone);
       
   502     switch (aCommandId)
       
   503     {
       
   504         // With cancel
       
   505         case ESatSSendDataNotify:    // fall through
       
   506         case ESatSReceiveDataNotify: // fall through
       
   507         case ESatSSendDtmfNotify:    // fall through
       
   508         {
       
   509             QT_TRYCATCH_ERROR(
       
   510                 err,
       
   511                 emit stopShowWaitNote();
       
   512                 SatAppAction *action = new SatAppAction(ESatNotifyAction, this);
       
   513                 action->set(KeyText, aText);
       
   514                 action->set(KeyCommandId, aCommandId);
       
   515                 action->set(KeyAlphaIdStatus, aAlphaIdStatus);
       
   516                 action->set(KeyControlResult, aControlResult);
       
   517                 // connect for asynchronous menu selection
       
   518                 connect(
       
   519                     action,SIGNAL(actionCompleted(SatAppAction*)),
       
   520                     this,SLOT(userCancelSession(SatAppAction*)));
       
   521                 emit notification(*action);
       
   522                 res = ESatSuccess;
       
   523             )
       
   524             break;
       
   525         }
       
   526         // Without cancel
       
   527         case ESatSMoSmControlNotify:  // fall through
       
   528         case ESatSCallControlNotify:  // fall through 
       
   529         case ESatSSendUssdNotify:     // fall through 
       
   530         case ESatSSendSsNotify:       // fall through
       
   531         case ESatSSendSmsNotify:      // fall through
       
   532         case ESatSCloseChannelNotify: // fall through
       
   533         {
       
   534             QT_TRYCATCH_ERROR(
       
   535                 err,
       
   536                 emit stopShowWaitNote();
       
   537                 SatAppAction a(ESatNotifyAction);
       
   538                 a.set(KeyText, aText);
       
   539                 a.set(KeyCommandId, aCommandId);
       
   540                 a.set(KeyAlphaIdStatus, aAlphaIdStatus);
       
   541                 a.set(KeyControlResult, aControlResult);
       
   542                 emit notification(a);
       
   543                 res = ESatSuccess;
       
   544             )
       
   545             break;
       
   546         }
       
   547         default:
       
   548         {
       
   549             break;
       
   550         }
       
   551     }
       
   552     qDebug("SATAPP: SatAppServerDispatcher::Notification < ret=%d", err);
       
   553     return res;
       
   554 }
       
   555 
       
   556 // ----------------------------------------------------------------------------
       
   557 // SatAppServerDispatcher::EventNotification
       
   558 // ----------------------------------------------------------------------------
       
   559 //
       
   560 void SatAppServerDispatcher::EventNotification(
       
   561     const TSatSEvent aEventId,
       
   562     const TSatSEventStatus aEventStatus,
       
   563     const TInt aError )
       
   564 {
       
   565     qDebug( "SATAPP: SatAppServerDispatcher::EventNotification aEventId %d", 
       
   566         aEventId );
       
   567     Q_UNUSED(aEventStatus);
       
   568     Q_UNUSED(aError);
       
   569     int err(KErrNone);
       
   570 
       
   571     QT_TRYCATCH_ERROR( err,
       
   572     switch ( aEventId )
       
   573         {
       
   574         case ESatSSmEndEvent:
       
   575         case ESatSsEndEvent:
       
   576         case ESatSDtmfEndEvent:
       
   577             {
       
   578             emit stopShowWaitNote();
       
   579             break;
       
   580             }
       
   581         case ESatSClearScreenEvent:
       
   582             {
       
   583             qDebug("SATAPP: ClearScreen event");
       
   584             emit clearScreen();
       
   585             break;
       
   586             }
       
   587        case ESatSsErrorEvent:
       
   588             {
       
   589             qDebug("SATAPP: Notifying Ss error" );
       
   590             // If error occurred (and Alpha ID provided), notify user
       
   591             emit showSsErrorNote();
       
   592             break;
       
   593             }
       
   594         case ESatSCloseSatUiAppEvent:
       
   595             {
       
   596             qDebug(" Close UI event" );
       
   597             emit clearScreen();
       
   598             QCoreApplication::instance()->quit();
       
   599             break;
       
   600             }
       
   601         default:
       
   602             {
       
   603             qDebug("SATAPP: Unknown event occured: %i", aEventId);
       
   604             break;
       
   605             }
       
   606         }
       
   607     ) // end QT_TRYCATCH_ERROR
       
   608     qDebug("SATAPP: SatAppServerDispatcher::EventNotification err = %d<", err);
       
   609 }
       
   610 
       
   611 //End of file