cbsatplugin/atmisccmdplugin/inc/cusdcommandhandler.h
branchRCL_3
changeset 16 b23265fb36da
child 32 19bd632b5100
equal deleted inserted replaced
14:f7fbeaeb166a 16:b23265fb36da
       
     1 /* Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
       
     2  * All rights reserved.
       
     3  * This component and the accompanying materials are made available
       
     4  * under the terms of "Eclipse Public License v1.0"
       
     5  * which accompanies this distribution, and is available
       
     6  * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7  * Initial Contributors:
       
     8  * Nokia Corporation - initial contribution.
       
     9  *
       
    10  * Contributors:
       
    11  * Description :
       
    12  *
       
    13  */
       
    14 
       
    15 #ifndef CUSDCOMMANDHANDLER_H
       
    16 #define CUSDCOMMANDHANDLER_H
       
    17 
       
    18 #include <e32base.h>
       
    19 #include <etelmm.h>
       
    20 #include <mmretrieve.h>
       
    21 #include <gsmuelem.h>
       
    22 
       
    23 #include "atmisccmdplugin.h"
       
    24 
       
    25 class CCUSSDSendMessageImpl;
       
    26 class CCUSSDReadMessageImpl;
       
    27 /**
       
    28  *  Class for accessing plugin information and common functionality
       
    29  */
       
    30 NONSHARABLE_CLASS( MUSSDCallback )
       
    31     {
       
    32 public:
       
    33     /**
       
    34      * Creates an AT command reply based on the reply type and completes the
       
    35      * request to ATEXT.
       
    36      */
       
    37     virtual void HandleReadMessageComplete(TInt aResult) = 0;
       
    38 
       
    39     /**
       
    40       * Creates an AT command reply based on the reply type and completes the
       
    41       * request to ATEXT.
       
    42       */
       
    43     virtual void HandleSendMessageComplete(TInt aResult) = 0;
       
    44     };
       
    45 
       
    46 
       
    47 NONSHARABLE_CLASS( CCUSDCommandHandler ) : public CATCmdAsyncBase,
       
    48                                            public MUSSDCallback
       
    49 {
       
    50 public:
       
    51     static CCUSDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
       
    52     ~CCUSDCommandHandler();
       
    53     
       
    54 private: // methods from CActive
       
    55     virtual void RunL();
       
    56     virtual void DoCancel();
       
    57     // RunError not needed as RunL does not leave
       
    58  
       
    59 private: // methods from MUSSDCallback
       
    60     virtual void HandleSendMessageComplete(TInt aResult);
       
    61     virtual void HandleReadMessageComplete(TInt aResult);
       
    62     
       
    63 private: // methods from CATCmdAsyncBase    
       
    64     virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
       
    65     virtual void HandleCommandCancel();
       
    66     
       
    67 private:
       
    68     CCUSDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
       
    69     void ConstructL();
       
    70     
       
    71     TInt ParseCUSDCmd(const TDesC8& aCmd);
       
    72     void CCUSDCommandHandler::FindFirstCarriageReturnL( 
       
    73          const TDesC& aBuffer ,
       
    74          TUint& aSkipChars , 
       
    75          TUint& aStartBit );
       
    76     
       
    77     TInt Pack(const TDesC8& aIn, TDes8& aOut);
       
    78     TInt ElementSizeInBits(TSmsDataCodingScheme::TSmsAlphabet aAlphabet) const;
       
    79     TInt PackedOctetsRequired( TInt aNumUDUnits ) const;
       
    80     TBool IsDcsValid( const TUint8 aDcs ) const;
       
    81     void FormatUSSDReceivedData();
       
    82 
       
    83 private:
       
    84     TBool iSendCommandSent;
       
    85     RBuf8 iReply;
       
    86 
       
    87     RMobileUssdMessaging iUssdMessaging;
       
    88 
       
    89     CCUSSDSendMessageImpl* iUSSDSender;
       
    90     RMobileUssdMessaging::TMobileUssdAttributesV1 iSendAttributes;
       
    91     RBuf8 iUSSDCommand;
       
    92 
       
    93     CCUSSDReadMessageImpl* iUSSDReader;
       
    94     RMobileUssdMessaging::TGsmUssdMessageData iReceivedData;
       
    95     TInt iDisplayRetMessage;
       
    96     RMobileUssdMessaging::TMobileUssdAttributesV1 iReceiveAttributes;
       
    97     };
       
    98 
       
    99 #endif // CUSDCOMMANDHANDLER_H