cbsatplugin/atmisccmdplugin/inc/cusdcommandhandler.h
changeset 32 19bd632b5100
parent 26 b78e66e88238
equal deleted inserted replaced
31:a0ea99b6fa53 32:19bd632b5100
    18 #include <e32base.h>
    18 #include <e32base.h>
    19 #include <etelmm.h>
    19 #include <etelmm.h>
    20 #include <mmretrieve.h>
    20 #include <mmretrieve.h>
    21 #include <gsmuelem.h>
    21 #include <gsmuelem.h>
    22 
    22 
    23 #include "atmisccmdplugin.h"
    23 #include "atcmdsyncbase.h"
    24 
    24 
    25 class CCUSSDSendMessageImpl;
    25 class CUSSDSendMessageImpl;
    26 class CCUSSDReadMessageImpl;
    26 class CUSSDReadMessageImpl;
    27 /**
    27 /**
    28  *  Class for accessing plugin information and common functionality
    28  *  Class for accessing plugin information and common functionality
    29  */
    29  */
    30 NONSHARABLE_CLASS( MUSSDCallback )
    30 NONSHARABLE_CLASS( MUSSDCallback )
    31     {
    31     {
    32 public:
    32 public:
    33     /**
    33     /**
    34      * Creates an AT command reply based on the reply type and completes the
    34      * Callback method for handling received USSD messages
    35      * request to ATEXT.
    35      * @param aError - the result code from the read operation
    36      */
    36      */
    37     virtual void HandleReadMessageComplete(TInt aResult) = 0;
    37     virtual void HandleReadMessageComplete(TInt aError) = 0;
    38 
    38 
    39     /**
    39     /**
    40       * Creates an AT command reply based on the reply type and completes the
    40       * Callback method for handling sent USSD messages
    41       * request to ATEXT.
    41       * @param aError - the result code from the send operation
    42       */
    42       */
    43     virtual void HandleSendMessageComplete(TInt aResult) = 0;
    43     virtual void HandleSendMessageComplete(TInt aError) = 0;
    44     };
    44     };
    45 
    45 
    46 
    46 /**
    47 NONSHARABLE_CLASS( CCUSDCommandHandler ) : public CATCmdAsyncBase,
    47  *  Class for handling USSD requests
       
    48  */
       
    49 NONSHARABLE_CLASS( CCUSDCommandHandler ) : public CATCmdSyncBase,
    48                                            public MUSSDCallback
    50                                            public MUSSDCallback
    49 {
    51 {
    50 public:
    52 public:
    51     static CCUSDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
    53     static CCUSDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
    52     ~CCUSDCommandHandler();
    54     ~CCUSDCommandHandler();
    53     
    55      
    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
    56 private: // methods from MUSSDCallback
    60     virtual void HandleSendMessageComplete(TInt aResult);
    57     virtual void HandleSendMessageComplete(TInt aError);
    61     virtual void HandleReadMessageComplete(TInt aResult);
    58     virtual void HandleReadMessageComplete(TInt aError);
    62     
    59     
    63 private: // methods from CATCmdAsyncBase    
    60 private: // methods from CATCmdAsyncBase    
    64     virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
    61     virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
    65     virtual void HandleCommandCancel();
    62     virtual void HandleCommandCancel();
    66     
    63     
    67 private:
    64 private:
    68     CCUSDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
    65     CCUSDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
    69     void ConstructL();
    66     void ConstructL();
    70     
    67     
    71     TInt ParseCUSDCmd(const TDesC8& aCmd);
    68     TInt ParseCUSDCmd();
    72     void CCUSDCommandHandler::FindFirstCarriageReturnL( 
    69     void CCUSDCommandHandler::FindFirstCarriageReturnL( 
    73          const TDesC& aBuffer ,
    70          const TDesC& aBuffer ,
    74          TUint& aSkipChars , 
    71          TUint& aSkipChars , 
    75          TUint& aStartBit );
    72          TUint& aStartBit );
    76     
    73     
    84     TBool iSendCommandSent;
    81     TBool iSendCommandSent;
    85     RBuf8 iReply;
    82     RBuf8 iReply;
    86 
    83 
    87     RMobileUssdMessaging iUssdMessaging;
    84     RMobileUssdMessaging iUssdMessaging;
    88 
    85 
    89     CCUSSDSendMessageImpl* iUSSDSender;
    86     CUSSDSendMessageImpl* iUSSDSender;
    90     RMobileUssdMessaging::TMobileUssdAttributesV1 iSendAttributes;
    87     RMobileUssdMessaging::TMobileUssdAttributesV1 iSendAttributes;
    91     RBuf8 iUSSDCommand;
    88     RBuf8 iUSSDCommand;
    92 
    89 
    93     CCUSSDReadMessageImpl* iUSSDReader;
    90     CUSSDReadMessageImpl* iUSSDReader;
    94     RMobileUssdMessaging::TGsmUssdMessageData iReceivedData;
    91     RMobileUssdMessaging::TGsmUssdMessageData iReceivedData;
    95     TInt iDisplayRetMessage;
    92     TInt iDisplayRetMessage;
    96     RMobileUssdMessaging::TMobileUssdAttributesV1 iReceiveAttributes;
    93     RMobileUssdMessaging::TMobileUssdAttributesV1 iReceiveAttributes;
    97     };
    94     };
    98 
    95