localconnectivityservice/legacymodemplugin/inc/monitorspeakerparser.h
changeset 0 c3e98f10fcf4
equal deleted inserted replaced
-1:000000000000 0:c3e98f10fcf4
       
     1 /*
       
     2 * Copyright (c) 2009 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: Handles commands "ATL", "ATL0", "ATL1", "ATL2", "ATL3", "ATM",
       
    15 *              "ATM0", "ATM1" and "ATM2"
       
    16 *
       
    17 */
       
    18 
       
    19 #ifndef C_MONITORSPEAKERPARSER_H
       
    20 #define C_MONITORSPEAKERPARSER_H
       
    21 
       
    22 #include "legacymodemplugin.h"
       
    23 
       
    24 /**  Detected commands */
       
    25 enum TDetectedCmd
       
    26     {
       
    27     EDetectedCmdUndefined,
       
    28     EDetectedCmdATL,   // For command "ATL"
       
    29     EDetectedCmdATL0,  // For command "ATL0"
       
    30     EDetectedCmdATL1,  // For command "ATL1"
       
    31     EDetectedCmdATL2,  // For command "ATL2"
       
    32     EDetectedCmdATL3,  // For command "ATL3"
       
    33     EDetectedCmdATM,   // For command "ATM"
       
    34     EDetectedCmdATM0,  // For command "ATM0"
       
    35     EDetectedCmdATM1,  // For command "ATM1"
       
    36     EDetectedCmdATM2   // For command "ATM2"
       
    37     };
       
    38 
       
    39 /**
       
    40  *  Main class for handling commands "ATL", "ATL0", "ATL1", "ATL2", "ATL3",
       
    41  *  "ATM", "ATM0", "ATM1" and "ATM2"
       
    42  *
       
    43  *  @since S60 v5.0
       
    44  */
       
    45 NONSHARABLE_CLASS( CMonitorSpeakerParser ) : public CLegacyModemPluginBase
       
    46     {
       
    47 
       
    48 public:
       
    49 
       
    50     /**
       
    51      * Two-phased constructor.
       
    52      * @param aCallback Callback
       
    53      * @return Instance of self
       
    54      */
       
    55     static CMonitorSpeakerParser* NewL( MLegacyModemPlugin* aCallback );
       
    56 
       
    57     /**
       
    58     * Destructor.
       
    59     */
       
    60     virtual ~CMonitorSpeakerParser();
       
    61 
       
    62 private:
       
    63 
       
    64     CMonitorSpeakerParser( MLegacyModemPlugin* aCallback );
       
    65 
       
    66     void ConstructL();
       
    67 
       
    68     /**
       
    69      * Checks if the command is speaker loudness command
       
    70      *
       
    71      * @param aCmd Command to check
       
    72      * @return ETrue if command understood, EFalse otherwise
       
    73      */
       
    74     TBool CheckSpeakerLoudnessCommand( const TDesC8& aCmd );
       
    75 
       
    76     /**
       
    77      * Checks if the command is speaker mode command
       
    78      *
       
    79      * @param aCmd Command to check
       
    80      * @return ETrue if command understood, EFalse otherwise
       
    81      */
       
    82     TBool CheckSpeakerModeCommand( const TDesC8& aCmd );
       
    83 
       
    84     /**
       
    85      * Main command handler (leaving version)
       
    86      *
       
    87      * @return ETrue if command understood, EFalse otherwise
       
    88      */
       
    89     TBool HandleCommandL();
       
    90 
       
    91 // from base class CLcCustomPluginBase
       
    92 
       
    93     /**
       
    94      * From CLcCustomPluginBase.
       
    95      * Reports the support status of an AT command. This is a synchronous API.
       
    96      *
       
    97      * @param aCmd The AT command. Its format may vary depending on the
       
    98      *             specification. E.g. in BT HFP case, the command may contain
       
    99      *             a character carriage return (<cr>) in the end.
       
   100      * @return ETrue if the command is supported; EFalse otherwise.
       
   101      */
       
   102     TBool IsCommandSupported( const TDesC8& aCmd );
       
   103 
       
   104     /**
       
   105      * From CLcCustomPluginBase.
       
   106      * Handles an AT command. Cancelling of the pending request is done by
       
   107      * HandleCommandCancel(). The implementation in the extension plugin should
       
   108      * be asynchronous.
       
   109      *
       
   110      * The extension plugin which accepts this command is responsible to supply
       
   111      * the result codes and response and to format result codes properly, e.g.
       
   112      * in BT HFP case, the format should be <cr><lf><result code><cr><lf>
       
   113      *
       
   114      * After an extension plugin has handled or decided to reject the given AT
       
   115      * command, it must inform ATEXT by HandleCommandCompleted() with a proper
       
   116      * error code.
       
   117      *
       
   118      * @since S60 5.0
       
   119      * @param aCmd The AT command to be handled. Its format may vary depending
       
   120      *             on the specification. E.g. in BT HFP case, the command may
       
   121      *             contain a character carriage return (<cr>) in the end.
       
   122      * @param aReply When passed in, contains the built in answer filled by
       
   123      *               ATEXT if it is not empty; when command handling completes
       
   124      *               successfully, contains the result codes and responses to
       
   125      *               this command; Its ownership always belongs to ATEXT, plugin
       
   126      *               may reallocate its space when needed.
       
   127      * @param aReplyNeeded Reply needed if ETrue, no reply otherwise. If EFalse,
       
   128      *                     the aReply must not contain the reply, otherwise it
       
   129      *                     must contain verbose or numeric reply (ATV0/1) or an
       
   130      *                     empty string reply (with ATQ).
       
   131      * @return None
       
   132      */
       
   133     void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
       
   134 
       
   135     /**
       
   136      * From CLcCustomPluginBase.
       
   137      * Cancels a pending HandleCommand request.
       
   138      *
       
   139      * @since S60 5.0
       
   140      * @return None
       
   141      */
       
   142     void HandleCommandCancel();
       
   143 
       
   144 private:  // data
       
   145 
       
   146     /**
       
   147      * Callback to call when accessing plugin information
       
   148      */
       
   149     MLegacyModemPlugin* iCallback;
       
   150 
       
   151     /**
       
   152      * Handler type for the three types
       
   153      */
       
   154     TCmdHandlerType iCmdHandlerType;
       
   155 
       
   156     /**
       
   157      * Detected command
       
   158      */
       
   159     TDetectedCmd iDetectedCmd;
       
   160 
       
   161     };
       
   162 
       
   163 #endif  // C_MONITORSPEAKERPARSER_H