srsf/vcommandmanager/src/vcommandmanager.h
branchRCL_3
changeset 23 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
22:cad71a31b7fc 23:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2005 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:  Main class of Voice Command Manager
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef VCOMMANDMANAGER_H
       
    20 #define VCOMMANDMANAGER_H
       
    21 
       
    22 //  INCLUDES
       
    23 #include <e32base.h>
       
    24 #include <f32file.h>
       
    25 #include "vcxmlparser.h"
       
    26 
       
    27 #include "vcommandapi.h"
       
    28 
       
    29 // FORWARD DECLARATIONS
       
    30 
       
    31 class CRepository;
       
    32 class CVCommandHandler;
       
    33 class CVCommandArray;
       
    34 class CVCommand;
       
    35 
       
    36 // CLASS DECLARATION
       
    37 
       
    38 /**
       
    39 * Main class of Voice Command Manager
       
    40 *
       
    41 * @lib nssvcommandmanager.exe
       
    42 *
       
    43 */
       
    44 class CVCommandManager : public CBase, public MVcXmlParserObserver
       
    45     {
       
    46     public: // Constructors and destructor
       
    47         
       
    48         /**
       
    49         * Two-phased constructor.
       
    50         * 
       
    51         * @param aForceRetrain For testing purposes. ETrue to retrain all commands
       
    52         */
       
    53         static CVCommandManager* NewL( TBool aForceRetrain );
       
    54         
       
    55         /**
       
    56         * Destructor.
       
    57         */
       
    58         virtual ~CVCommandManager();
       
    59         
       
    60     public: // From MVcXmlParserObserver
       
    61     
       
    62         /**
       
    63         * Creates new voice command with given parameters
       
    64         *
       
    65         * @see MVcXmlParserObserver for more information
       
    66         */
       
    67         void MvcxpoVoiceCommandFound( const TDesC& aWrittenText,
       
    68                                       const TDesC& aSpokenText,
       
    69                                       const TDesC& aTooltipText,
       
    70                                       const TDesC& aFolder,
       
    71                                       const TDesC& aFolderTitle,
       
    72                                       const TDesC& aParameters, 
       
    73                                       TUid aIcon,
       
    74                                       TUid aAppId,
       
    75                                       const TDesC& aAppName,
       
    76                                       TBool aStartImmediately,
       
    77                                       TBool aUserCanModify,
       
    78                                       const TDesC& aFolderIconFile,
       
    79                                       TInt aFolderIconIndex
       
    80                                       );
       
    81         
       
    82     public: // New functions
       
    83 
       
    84         /**
       
    85         * Thread function.
       
    86         */
       
    87         static TInt VCMThreadFunction( TAny* aParams );
       
    88        
       
    89     private:
       
    90         
       
    91         /**
       
    92         * C++ default constructor.
       
    93         * 
       
    94         * @param aForceRetrain For testing purposes. ETrue to retrain all commands
       
    95         */
       
    96         CVCommandManager( TBool aForceRetrain );
       
    97         
       
    98         /**
       
    99         * By default Symbian 2nd phase constructor is private.
       
   100         */
       
   101         void ConstructL();
       
   102 
       
   103         /**
       
   104         * Goes through all XML files
       
   105         */ 
       
   106         void ParseAllFilesL();
       
   107         
       
   108         
       
   109         /**
       
   110         * Goes through all XML files in directory
       
   111         *
       
   112         * @param aDrive Contains directory path (e.g. C:\private\)
       
   113         */
       
   114         void ParseAllFilesFromDirectoryL( const TDesC& aDirectory );
       
   115 
       
   116         /**
       
   117         * Compares if two commands are equal
       
   118         * @param aFirst Command to compare
       
   119         * @param aSecond Command to compare
       
   120         * @return ETrue if commands are equal else EFalse
       
   121         */
       
   122         TBool CompareCommands( const CVCommand* aFirst, const CVCommand* aSecond );
       
   123         
       
   124         void ConstructCommandL( const TDesC& aWrittenText,
       
   125                                 const TDesC& aSpokenText,
       
   126                                 const TDesC& aTooltipText,
       
   127                                 const TDesC& aFolder,
       
   128                                 const TDesC& aFolderTitle,
       
   129                                 const TDesC& aParameters, 
       
   130                                 TUid aIcon,
       
   131                                 TUid aAppId,
       
   132                                 const TDesC& aAppName,
       
   133                                 TBool aStartImmediately,
       
   134                                 TBool aUserCanModify,
       
   135                                 const TDesC& aFolderIconFile,
       
   136                                 TInt aFolderIconIndex
       
   137                                 );
       
   138 
       
   139         
       
   140     private: // Data
       
   141 
       
   142         // Parser
       
   143         CVcXmlParser*                   iParser;
       
   144         
       
   145         // Command array for commands found from xml-files
       
   146         RVCommandArray                  iCommands;
       
   147         
       
   148         // Command index array
       
   149         RArray<TInt>                    iMatchingIndices;
       
   150         
       
   151         // Command array for commands found from VAS
       
   152         CVCommandArray*                 iCommandArray;
       
   153         
       
   154         // Tells if language has changed
       
   155         TBool                           iLanguageChanged;
       
   156         
       
   157         // File system handle
       
   158         RFs                             iRFs;
       
   159  
       
   160     };
       
   161 
       
   162 #endif // VCOMMANDMANAGER_H
       
   163 
       
   164 // End of File