adaptationlayer/tsy/simatktsy_dll/internal/test/simatktsy_testtool/simatk/src/commandselectitem.cpp
changeset 4 510c70acdbf6
parent 3 1972d8c2e329
child 5 8ccc39f9d787
equal deleted inserted replaced
3:1972d8c2e329 4:510c70acdbf6
     1 /*
       
     2 * Copyright (c) 2002-2006 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 the License "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:   Select Item specific test class. Inherits CCommandBase.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 // INCLUDE FILES
       
    21 #include <stifparser.h>
       
    22 #include "commandselectitem.h"
       
    23 
       
    24 // CONSTANTS
       
    25 _LIT( KDefaultItemId,       "DefaultItemId");
       
    26 _LIT( KPresentationType,    "PresentationType");
       
    27 _LIT( KHelp,                "Help" );
       
    28 
       
    29 
       
    30 // -----------------------------------------------------------------------------
       
    31 // CCommandSelectItem::CCommandSelectItem
       
    32 // C++ default constructor can NOT contain any code, that
       
    33 // might leave.
       
    34 // -----------------------------------------------------------------------------
       
    35 //
       
    36 CCommandSelectItem::CCommandSelectItem
       
    37         (
       
    38         const TSatIpc       aIpc,
       
    39         const RSat&         aSat,
       
    40         CStifItemParser&    aParser,
       
    41         CStifLogger&        aLog
       
    42         ) : CSatMenuBase ( aIpc, aSat, aParser, aLog, RSat::ESelectItem ),
       
    43         iDataPckg( iData ),
       
    44         iRspPckg( iRsp )
       
    45     {
       
    46     }
       
    47 
       
    48 // -----------------------------------------------------------------------------
       
    49 // CCommandSelectItem::~CCommandSelectItem
       
    50 // Destructor
       
    51 // -----------------------------------------------------------------------------
       
    52 //
       
    53 CCommandSelectItem::~CCommandSelectItem()
       
    54     {
       
    55     }
       
    56 
       
    57 // -----------------------------------------------------------------------------
       
    58 // CCommandSelectItem::NotifySat
       
    59 // Send a notify request to Etel and clear internal data
       
    60 // (other items were commented in a header).
       
    61 // -----------------------------------------------------------------------------       
       
    62 //
       
    63 TInt CCommandSelectItem::NotifySat
       
    64         (
       
    65         TRequestStatus& aSimAtkStatus
       
    66         )
       
    67     {
       
    68     TInt ret ( KErrNone );
       
    69     
       
    70     // Clear the packages
       
    71     Init( iData );
       
    72     Init( iRsp );
       
    73 
       
    74     iSat.NotifySelectItemPCmd( aSimAtkStatus, iDataPckg );
       
    75     
       
    76     return ret;
       
    77     }
       
    78 
       
    79 // -----------------------------------------------------------------------------
       
    80 // CCommandSelectItem::CheckData
       
    81 // Verifies the validity of received command
       
    82 // (other items were commented in a header).
       
    83 // -----------------------------------------------------------------------------       
       
    84 //
       
    85 TInt CCommandSelectItem::CheckData()
       
    86     {
       
    87     iLog.Log( _L( "CCommandSelectItem::CheckData" ) );    
       
    88     
       
    89     TInt ret( KErrNone );
       
    90     
       
    91     // First check the validity of common menu structure
       
    92     ret = CheckMenuStructure( iData );
       
    93 
       
    94     if ( iData.IsRemoveMenu() == EFalse )
       
    95         {
       
    96         // Display menu received
       
    97         
       
    98         // DefaultItemId, 0 (none) as default
       
    99         if ( KErrNone != CheckValue( KDefaultItemId, 
       
   100             iData.iDefaultItemId, 0 ) )
       
   101             {
       
   102             ret = KErrCorrupt;
       
   103             }
       
   104         
       
   105         // PresentationType
       
   106         if ( KErrNone != CheckValue( KPresentationType, 
       
   107             iData.iPresentationType, RSat::ENotSpecified ) )
       
   108             {
       
   109             ret = KErrCorrupt;
       
   110             }
       
   111 
       
   112         // IconListQualifier
       
   113         if ( KErrNone != CheckValue( KIconListQualifier,
       
   114             iData.iIconListQualifier, RSat::ENoIconId ) )
       
   115             {
       
   116             ret = KErrCorrupt;
       
   117             }
       
   118                         
       
   119         // Preference
       
   120         if ( KErrNone != CheckValue( KPreference, iData.iPreference,
       
   121             RSat::ENoSelectionPreference ) )
       
   122             {
       
   123             ret = KErrCorrupt;
       
   124             }
       
   125             
       
   126         // AlphaId
       
   127         if ( KErrCorrupt == CheckAlphaId( iData.iAlphaId ) )
       
   128             {
       
   129             ret = KErrCorrupt;
       
   130             }
       
   131 
       
   132         // Icon
       
   133         if ( KErrNone != CheckIcon( iData.iIconId ) )
       
   134             {
       
   135             ret = KErrCorrupt;
       
   136             }
       
   137 
       
   138         // Help
       
   139         if ( KErrNone != CheckValue( KHelp, iData.iHelp,
       
   140             RSat::ENoHelpAvailable ) )
       
   141             {
       
   142             ret = KErrCorrupt;
       
   143             }    
       
   144 
       
   145         }
       
   146         
       
   147     return ret;
       
   148     }
       
   149  
       
   150 // -----------------------------------------------------------------------------
       
   151 // CCommandSelectItem::SendResponse
       
   152 // Creates response according to scripted parameters
       
   153 // (other items were commented in a header).
       
   154 // -----------------------------------------------------------------------------       
       
   155 //
       
   156 TInt CCommandSelectItem::SendResponse()
       
   157     {
       
   158     iLog.Log( _L( "CCommandSelectItem::SendResponse" ) );    
       
   159     
       
   160     TInt ret( KErrNone );
       
   161 
       
   162     // General result
       
   163     SetGeneralResult( iRsp.iGeneralResult );
       
   164     
       
   165     // Additional info & type
       
   166     SetAdditionalInfo( iRsp.iInfoType, iRsp.iAdditionalInfo );
       
   167     
       
   168     if ( KErrNone == ret )
       
   169         {
       
   170         ret = CSatCommandBase::SendResponse( iRspPckg );
       
   171         }
       
   172 
       
   173     return ret;
       
   174     }
       
   175     
       
   176 // End of File