speechsrv_plat/vas_api/inc/nssvasmspeechitem.h
branchRCL_3
changeset 19 e36f3802f733
parent 0 bf1d17376201
equal deleted inserted replaced
18:cad71a31b7fc 19:e36f3802f733
       
     1 /*
       
     2 * Copyright (c) 2004-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 "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:  The MSeechItem provides speech methods to the client.
       
    15 *               The methods are used by the client to request speech services from SRS. 
       
    16 *
       
    17 */
       
    18 
       
    19 
       
    20 #ifndef NSSVASMSPEECHITEM_H
       
    21 #define NSSVASMSPEECHITEM_H
       
    22 
       
    23 // INCLUDE FILES
       
    24 #include <nssvascoreconstant.h>
       
    25 
       
    26 // FORWARD DECLARATIONS
       
    27 class MNssPlayEventHandler;
       
    28 class MNssTrainVoiceEventHandler;
       
    29 class MNssTrainTextEventHandler;
       
    30 class CNssTrainingParameters;
       
    31 
       
    32 /**
       
    33 * The MSpeechItem class represents the speech part of a voice tag. The
       
    34 * MSeechItem provides speech methods to  the client. The methods are used by
       
    35 * the client  to request speech services from SRS
       
    36 *
       
    37 *  @lib NssVASApi.lib
       
    38 *  @since 2.0
       
    39 */
       
    40 class MNssSpeechItem
       
    41 {
       
    42   public:  //enum
       
    43 
       
    44     /**
       
    45     * TNssSpeechItemResult will have all the enums to represent the return values from
       
    46     * MSpeechItem's methods.
       
    47     * 
       
    48     * NOTE:
       
    49     * The caller functions should be able to handle the unknown TNssSpeechItemResult enum values.
       
    50     */         
       
    51     enum TNssSpeechItemResult
       
    52      {
       
    53         EVasErrorNone,
       
    54         EVasUnexpectedRequest,  // Unexpected request from client, when the state is not Idle
       
    55         EVasInUse,              // VAS resource is currently in use.
       
    56         EVasInvalidParameter,
       
    57         EVasPlayFailed,
       
    58         EVasTrainFailed
       
    59      };
       
    60 
       
    61 
       
    62   public:
       
    63 
       
    64     /**
       
    65     * The Record method is used by the client to record input speech.
       
    66     *
       
    67     * @since 2.0
       
    68     * @param aTrainVoiceEventHandler A call back object to handle the record events
       
    69     * @return TNssSpeechItemResult, synchronous return value to identify whether the
       
    70     *         synchronous process is success or fail
       
    71     */    
       
    72     virtual TNssSpeechItemResult RecordL( 
       
    73                 MNssTrainVoiceEventHandler* aTrainVoiceEventHandler ) = 0;
       
    74 
       
    75 
       
    76     /**
       
    77     * Method called by the client to indicate to SRS that a playback is
       
    78     * needed.
       
    79     *
       
    80     * @since 2.0
       
    81     * @param aPlayEventHandler A call back object to handle the play events
       
    82     * @return TNssSpeechItemResult, synchronous return value to identify whether the
       
    83     *         synchronous process is success or fail
       
    84     */    
       
    85     virtual TNssSpeechItemResult PlayL( MNssPlayEventHandler* aPlayEventHandler ) = 0;
       
    86 
       
    87     /**
       
    88     * Method called by the client to indicate to SRS that a playback is
       
    89     * needed with a certain language.
       
    90     *
       
    91     * @since 2.8
       
    92     * @param aPlayEventHandler A call back object to handle the play events
       
    93     * @param aLanguage Language which will be used in playback
       
    94     * @return TNssSpeechItemResult, synchronous return value to identify whether the
       
    95     *         synchronous process is success or fail
       
    96     */    
       
    97     virtual TNssSpeechItemResult PlayL( MNssPlayEventHandler* aPlayEventHandler,
       
    98                                         TLanguage aLanguage ) = 0;
       
    99 
       
   100    /**
       
   101     * Method called by the client to indicate to SRS that training is
       
   102     * needed.
       
   103     *
       
   104     * @since 2.0
       
   105     * @param aTrainVoiceEventHandler A call back object to handle the train events
       
   106     * @return TNssSpeechItemResult, synchronous return value to identify whether the
       
   107     *         synchronous process is success or fail
       
   108     */    
       
   109     virtual TNssSpeechItemResult TrainVoiceL( 
       
   110                 MNssTrainVoiceEventHandler* aTrainVoiceEventHandler ) = 0;
       
   111 
       
   112     /**
       
   113     * Method called by the client to  cancel the previous operation.
       
   114     *
       
   115     * @since 2.0
       
   116     * @return TNssSpeechItemResult, synchronous return value to identify whether the
       
   117     *         synchronous process is success or fail
       
   118     */    
       
   119     virtual TNssSpeechItemResult CancelL() = 0;
       
   120 
       
   121 
       
   122     /**
       
   123     * The GetTrainingCapabilities member fucntion is used by the client 
       
   124     * to get training capabilities to beused in Speaker Independent voice 
       
   125     * recognition.
       
   126     *
       
   127     * @since 2.0
       
   128     * @return the pointer to the array of Training capabilities data
       
   129     */    
       
   130     virtual CArrayFixFlat<TNssVasCoreConstant::TNssTrainingCapability>* TrainingCapabilities() = 0;
       
   131 
       
   132 
       
   133     /**
       
   134     * The GetTrainedType member function is used by the client to get 
       
   135     * train type  to be used in Speaker Independent voice recognition. 
       
   136     * 
       
   137     * @since 2.0
       
   138     * @return the enum for the trained type
       
   139     */    
       
   140     virtual TNssVasCoreConstant::TNssTrainedType TrainedType() = 0;
       
   141 
       
   142 
       
   143     /**
       
   144     * The Text member fucntion is used by the client to get text to be
       
   145     * used in Speaker Independent voice recognition. The text can also be
       
   146     * used to identify the voice tag, and can be used for user display by
       
   147     * the client.
       
   148     *
       
   149     * @since 2.0
       
   150     * @return A text buffer
       
   151     */    
       
   152     virtual TDesC& Text() = 0;
       
   153 
       
   154 
       
   155     /**
       
   156     * The SetTextL method is used by the client to initialize the Text
       
   157     * data member
       
   158     *
       
   159     * @since 2.0
       
   160     * @param aText the reference of a text buffer
       
   161     */    
       
   162     virtual void SetTextL( const TDesC& aText ) = 0;
       
   163 
       
   164 
       
   165     /**
       
   166     * Playing a tag is not supported, if the recognition technology is speaker
       
   167     * independent and speech synthesis is not present.
       
   168     *
       
   169     * @since 2.0
       
   170     * @return ETrue Playing is supported.
       
   171     *         EFalse PlayL() will leave with KErrNotSupported.
       
   172     */
       
   173     virtual TBool IsPlayingSupported() = 0;
       
   174 
       
   175 
       
   176     /**
       
   177     * Trains the speech model. The model is based on the text
       
   178     * which was given earlier at SetTextL.
       
   179     *
       
   180     * @since 2.0
       
   181     * @param aEventHandler To inform the client when the training has finished.
       
   182     * @param aTrainingParams Training parameters 
       
   183     * @return TNssSpeechItemResult Success status
       
   184     */
       
   185     virtual TNssSpeechItemResult TrainTextL( MNssTrainTextEventHandler* aEventHandler,
       
   186                                              CNssTrainingParameters* aTrainingParams ) = 0;
       
   187 
       
   188     /**
       
   189     * Returns the raw training text from where escape characters are not removed.
       
   190     * Should not be used by clients who want to display the string.
       
   191     *
       
   192     * @since 3.2
       
   193     * @return Reference to the text buffer
       
   194     */    
       
   195     virtual TDesC& RawText() = 0;
       
   196     
       
   197     /**
       
   198     * Returns the part of text which identified with the given id.
       
   199     * If RawText() is for example "_1Amy_1Harris_2mobile" then 
       
   200     * PartialText( _L( "1" ) ) call will return "Amy Harris".
       
   201     *
       
   202     * @since 3.2
       
   203     * @param aIdentifier ID of the text part to return
       
   204     * @return Text, ownership is transferred to client
       
   205     */
       
   206     virtual HBufC* PartialTextL( const TDesC& aIdentifier ) = 0;
       
   207 };
       
   208 
       
   209 #endif // NSSVASMSPEECHITEM_H