adaptationlayer/tsy/simatktsy_dll/internal/test/simatktsy_testtool/simatk/inc/satmenubase.h
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:   Abstact class containing menu-specific helper methods.
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 
       
    20 #ifndef SATMENUBASE_H
       
    21 #define SATMENUBASE_H
       
    22 
       
    23 // INCLUDES
       
    24 #include "satcommandbase.h"
       
    25 
       
    26 // CONSTANTS
       
    27 _LIT( KIconListQualifier,       "IconListQualifier" );
       
    28 _LIT( KPreference,              "Preference" );
       
    29 
       
    30 
       
    31 /**
       
    32 *  Class provides helper functions for SetUpMenu and SelectItem
       
    33 *  proactive commands.
       
    34 *  @lib SimAtk.dll
       
    35 */
       
    36 NONSHARABLE_CLASS( CSatMenuBase ) : public CSatCommandBase
       
    37     {
       
    38     
       
    39     protected:  // Constructors and destructor
       
    40         
       
    41         /**
       
    42         * Constructor.
       
    43         */     
       
    44         CSatMenuBase( const TSatIpc aIpc, const RSat& aSat,
       
    45             CStifItemParser& aParser,  CStifLogger& aLog,
       
    46             const RSat::TPCmd aCommandType );
       
    47         
       
    48        /**
       
    49         * Destructor.
       
    50         */
       
    51         ~CSatMenuBase();
       
    52   
       
    53     
       
    54     private: // Struct
       
    55     
       
    56         /**
       
    57         * Structure is used to store menu related parameters, which
       
    58         * are parsed from the script.        
       
    59         */
       
    60         struct TScriptedItem
       
    61             {
       
    62             TPtrC16 iItemString;
       
    63             TUint8 iItemId;
       
    64             TInt iAction;
       
    65             TInt iIconId;
       
    66             };
       
    67             
       
    68 
       
    69     protected: // New functions
       
    70     
       
    71         /**
       
    72         * Helper function that verifies the validi of menu structure
       
    73         * common to SetUpMenu and SelectItem proactive commands against
       
    74         * scripted parameters. Checked parameters include state of RemoveMenu,
       
    75         * Number of Items, Menu Content and all Menu Items. Item Id and text
       
    76         * of each menu item is checked, as well as next action and/or icon 
       
    77         * id's if available.
       
    78         * @param aData Reference to proactive command data structure
       
    79         * @return KErrNone if data was valid, KErrCorrupt if received data
       
    80         *   and script or default did not match.
       
    81         */
       
    82         TInt CheckMenuStructure( const RSat::TMenuItemBaseV1& aData );
       
    83             
       
    84                 
       
    85     private:    // New methods
       
    86     
       
    87         /**
       
    88         * Internal function that parses an menu item from the
       
    89         * script. Number and type of cripted parameters should match 
       
    90         * with the provided menu content.
       
    91         * @param aMenuContent Content of menu, menu items and actions/iconIds.
       
    92         * @param aScriptedItem Output where the parsed values are stored.
       
    93         * @return KErrNone if menu item was parsed successfully or KErrCorrupt
       
    94         *   if mandatory parameters were missing from the script.
       
    95         */
       
    96         TInt ParseItem ( const TInt aMenuContent,
       
    97             TScriptedItem& aScriptedItem );
       
    98     
       
    99         /**
       
   100         * Internal function that verifies the validity of menu item
       
   101         * and associted parameters.
       
   102         * @param aScriptedItem Menu item parsed from the script. Menu item
       
   103         *   received from the proactive command is compared to it.
       
   104         * @param aData Reference to proactive command data structure
       
   105         * @param aIndex Index of menu item which is under verification
       
   106         * @param aMenuContent Content of menu, menu items and actions/iconIds.
       
   107         * @return KErrNone if data was valid, KErrCorrupt if received data
       
   108         *   and scripted item did not match and KErrArgument is parsing failed.
       
   109         */
       
   110         TInt CheckMenuItem ( const TScriptedItem& aScriptedItem,
       
   111             const RSat::TMenuItemBaseV1& aData, const TUint aIndex,
       
   112             const TInt aMenuContent );
       
   113                 
       
   114     };
       
   115 
       
   116 #endif      // SATMENUBASE_H
       
   117             
       
   118 // End of File