srsf/speechsynthesis/server/inc/speechsynthesisserverutilities.h
branchRCL_3
changeset 18 cad71a31b7fc
parent 17 8ce15fced3a6
child 19 e36f3802f733
equal deleted inserted replaced
17:8ce15fced3a6 18:cad71a31b7fc
     1 /*
       
     2 * Copyright (c) 2007 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:  Utility classes for speech synthesis server
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef SPEECHSYNTHESISSERVERUTILITIES_H
       
    20 #define SPEECHSYNTHESISSERVERUTILITIES_H
       
    21 
       
    22 // INCLUDES
       
    23 
       
    24 #include <e32base.h>
       
    25 #include <e32property.h>
       
    26 #include <speechsynthesis.h>
       
    27 
       
    28 
       
    29 // CONSTANTS
       
    30 
       
    31 _LIT( KPanic, "SpeechSynthesisServer" );
       
    32 
       
    33 // Time after server is closed if nobody is connected to it
       
    34 const TTimeIntervalMicroSeconds32 KSpeechSynthesisShutdownDelay = 0x200000; // 2 seconds
       
    35 
       
    36 
       
    37 // ----------------------------------------------------------------------------
       
    38 // TSpeechSynthesisPanic
       
    39 // Server's panic codes 
       
    40 // ----------------------------------------------------------------------------
       
    41 //
       
    42 enum TSpeechSynthesisPanic
       
    43     {
       
    44     EPanicGeneral,
       
    45     EPanicIllegalFunction
       
    46     };
       
    47 
       
    48 // ----------------------------------------------------------------------------
       
    49 // PanicClient
       
    50 //
       
    51 // ----------------------------------------------------------------------------
       
    52 //
       
    53 void PanicClient( const RMessagePtr2& aMessage, TSpeechSynthesisPanic aPanic );
       
    54 
       
    55 
       
    56 // ----------------------------------------------------------------------------
       
    57 // MSpeechSynthesisServerObserver
       
    58 // Observer to receive callbacks from server
       
    59 // ----------------------------------------------------------------------------
       
    60 //
       
    61 class MSpeechSynthesisServerObserver
       
    62 	{
       
    63     
       
    64     public:
       
    65 
       
    66         /**
       
    67         * Initialisation has finished
       
    68         * @param aError KErrNone if initialisation succeeded
       
    69         * @param aDuration Estimated duration of synthesis
       
    70         */
       
    71     	virtual void MsssInitComplete( TInt aError, 
       
    72 	                                   const TTimeIntervalMicroSeconds& aDuration ) = 0;
       
    73 
       
    74         /**
       
    75         * Synthesis complete
       
    76         * @param aError KErrNone synthesis has finalised without errors
       
    77         */
       
    78 	    virtual void MsssPlayComplete( TInt aError ) = 0;
       
    79 	    
       
    80 	    /**
       
    81 	    * Initialisation or synthesis has been aborted. 
       
    82 	    */
       
    83 	    virtual void MsssOperationAborted() = 0; 
       
    84 	
       
    85 	};
       
    86 
       
    87 
       
    88 // ----------------------------------------------------------------------------
       
    89 // MConfigurationObserver
       
    90 // Observer to receive callbacks from CConfigurationListener
       
    91 // ----------------------------------------------------------------------------
       
    92 //
       
    93 class MConfigurationObserver
       
    94     {
       
    95         
       
    96     public:
       
    97     
       
    98         /**
       
    99         * Change in configuration detected
       
   100         */ 
       
   101         virtual void McoConfigurationChanged() = 0;
       
   102         
       
   103     };
       
   104     
       
   105 
       
   106 // ----------------------------------------------------------------------------
       
   107 // TVoiceConfiguration 
       
   108 // 
       
   109 // ----------------------------------------------------------------------------
       
   110 //
       
   111 class TVoiceConfiguration : public TVoice
       
   112     {
       
   113     public:
       
   114     
       
   115         TUid        iPluginUid; 
       
   116         
       
   117         TVoiceConfiguration():
       
   118             TVoice(),
       
   119             iPluginUid( KNullUid ) {};
       
   120     };
       
   121     
       
   122 
       
   123 
       
   124 // ----------------------------------------------------------------------------
       
   125 // Auto shutdown class 
       
   126 //
       
   127 // ----------------------------------------------------------------------------
       
   128 //
       
   129 class CShutdown : public CTimer
       
   130     {
       
   131     
       
   132     public:
       
   133         
       
   134         static CShutdown* NewL(); 
       
   135         
       
   136         void Start();
       
   137     
       
   138     private:
       
   139     
       
   140         inline CShutdown();
       
   141         
       
   142         inline void ConstructL();
       
   143         
       
   144         void RunL();
       
   145         
       
   146     };
       
   147 
       
   148 
       
   149 // ----------------------------------------------------------------------------
       
   150 // Class used to detect installation and removal of SIS package
       
   151 //
       
   152 // ----------------------------------------------------------------------------
       
   153 // 
       
   154 class CConfigurationListener : public CActive
       
   155     {
       
   156     
       
   157     public:
       
   158         
       
   159         static CConfigurationListener* NewL( MConfigurationObserver& aHost );
       
   160         
       
   161         virtual ~CConfigurationListener();
       
   162         
       
   163     private:
       
   164         
       
   165         CConfigurationListener( MConfigurationObserver& aHost );
       
   166         
       
   167         void ConstructL();
       
   168         
       
   169         void RunL();
       
   170         
       
   171         void DoCancel();
       
   172         
       
   173     private:
       
   174         
       
   175         RProperty               iProperty;
       
   176         
       
   177         MConfigurationObserver& iHost; 
       
   178     };
       
   179 
       
   180 // ----------------------------------------------------------------------------
       
   181 // Class used to detect insertion and removal of MMC card
       
   182 // @todo Changes needed due to multiple drive support? 
       
   183 // ----------------------------------------------------------------------------
       
   184 // 
       
   185 class CMMCListener : public CActive
       
   186     {
       
   187     
       
   188     public:
       
   189         
       
   190         static CMMCListener* NewL( MConfigurationObserver& aHost );
       
   191         
       
   192         virtual ~CMMCListener();
       
   193         
       
   194     private:
       
   195         
       
   196         CMMCListener( MConfigurationObserver& aHost );
       
   197         
       
   198         void ConstructL();
       
   199         
       
   200         void RunL();
       
   201         
       
   202         void DoCancel();
       
   203         
       
   204     private:
       
   205         
       
   206         RProperty                   iProperty;
       
   207         
       
   208         TInt                        iPrevValue;
       
   209         
       
   210         MConfigurationObserver&     iHost; 
       
   211     };
       
   212 
       
   213 #endif // SPEECHSYNTHESISSERVERUTILITIES_H