messagingfw/alwaysonline/AlwaysOnlineManager/inc/AOCommandParser.h
changeset 0 8e480a14352b
equal deleted inserted replaced
-1:000000000000 0:8e480a14352b
       
     1 /*
       
     2 * Copyright (c) 2002 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: AlwaysOnline server command parser
       
    15 *
       
    16 */
       
    17 
       
    18 
       
    19 #ifndef CAOCOMMANDPARSER_H
       
    20 #define CAOCOMMANDPARSER_H
       
    21 
       
    22 // INCLUDES
       
    23 #include <e32base.h>
       
    24 
       
    25 #include <AlwaysOnlineManagerCommon.h>
       
    26 
       
    27 // CONSTANTS
       
    28 enum TAOParserErrors
       
    29     {
       
    30     EAOParserNoError = 0,
       
    31     EAOParserNoUid,
       
    32     EAOParserNoCmd,
       
    33     EAOParserNoResult,
       
    34     EAOParserUnknownFormat
       
    35     };
       
    36 // MACROS
       
    37 // DATA TYPES
       
    38 // FUNCTION PROTOTYPES
       
    39 // FORWARD DECLARATIONS
       
    40 // CLASS DECLARATION
       
    41 
       
    42 /**
       
    43 * Utility class to parse received messages from 
       
    44 * CAOServerCommandHandler::FinalProgress()
       
    45 *  @since S60 3.1
       
    46 */
       
    47 class CAOCommandParser : public CBase
       
    48     {
       
    49     public:  // Constructors and destructor
       
    50 
       
    51         /**
       
    52         * Creates object from CAOCommandParser and leaves it to cleanup stack
       
    53         * @since S60 3.1
       
    54         * @param aProgress, final progress
       
    55         * @return, Constructed object
       
    56         */
       
    57         static CAOCommandParser* NewLC( const TDesC8& aProgress );
       
    58 
       
    59         /**
       
    60         * Creates object from CAOCommandParser
       
    61         * @since S60 3.1
       
    62         * @param aProgress, final progress
       
    63         * @return, Constructed object
       
    64         */
       
    65         static CAOCommandParser* NewL( const TDesC8& aProgress );
       
    66 
       
    67         /**
       
    68         * Destructor
       
    69         * @since S60 3.1
       
    70         */
       
    71         virtual ~CAOCommandParser();
       
    72 
       
    73     public: // New functions
       
    74         /**
       
    75         * Parses the received message.
       
    76         * @since S60 3.1
       
    77         */
       
    78         TAOParserErrors Parse();
       
    79         
       
    80         /**
       
    81         * Gets the UID from received message.
       
    82         * @since S60 3.1
       
    83         * @return, plugin's UID
       
    84         */
       
    85         const TUid& Uid();
       
    86         
       
    87         /**
       
    88         * Gets the command from received message.
       
    89         * @since S60 3.1
       
    90         * @return, command issued
       
    91         */
       
    92         TInt Command();
       
    93         
       
    94         /**
       
    95         * Gets the result from received message.
       
    96         * @since S60 3.1
       
    97         * @return, plugin's result
       
    98         */
       
    99         const TDes8& Result();
       
   100         
       
   101     protected:  // Constructors
       
   102 
       
   103         /**
       
   104         * Default constructor for classCAOCommandParser
       
   105         * @since S60 3.1
       
   106         * @return, Constructed object
       
   107         */
       
   108         CAOCommandParser();
       
   109 
       
   110         /**
       
   111         * Symbian 2-phase constructor
       
   112         * @since S60 3.1
       
   113         * @param aProgress, final progress
       
   114         */
       
   115         void ConstructL( const TDesC8& aProgress );
       
   116 
       
   117     private:  // Functions from base classes
       
   118         void ParseUID( TDesC8& aEndBuf );
       
   119         void ParseCommand( TDesC8& aEndBuf );
       
   120         void ParseResult( TDesC8& aEndBuf );
       
   121 
       
   122     private:    // Data
       
   123         // Final progress
       
   124         HBufC8*                         iProgress;
       
   125         // Parsed uid
       
   126         TUid                            iUid;
       
   127         // Parsed command
       
   128         TInt                            iCommand;
       
   129         // Parsed result
       
   130         TBuf8<KAOFinalProgressLength>   iResult;
       
   131     };
       
   132 
       
   133 #endif //  CAOCOMMANDPARSER_H
       
   134 
       
   135 // End of File