cbsatplugin/atmisccmdplugin/inc/cmgdcommandhandler.h
author Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Thu, 19 Aug 2010 10:05:41 +0300
branchRCL_3
changeset 54 0ba996a9b75d
permissions -rw-r--r--
Revision: 201031 Kit: 201033

/*
 * Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies).
 * All rights reserved.
 * This component and the accompanying materials are made available
 * under the terms of "Eclipse Public License v1.0"
 * which accompanies this distribution, and is available
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
 * Initial Contributors:
 * Nokia Corporation - initial contribution.
 *
 * Contributors:
 * 
 * Description :
 * 
 * CCMGDCommandHandler class declaration for AT+CMGD command
 * 
 */

#ifndef CMGDCOMMANDHANDLER_H
#define CMGDCOMMANDHANDLER_H

#include "atcmdasyncbase.h"

#include <etelmm.h>

class CMobilePhoneGsmSmsList;
class CRetrieveMobilePhoneSmsList;
/**
 *  AT+CMGD command handler implementation class
 */
NONSHARABLE_CLASS( CCMGDCommandHandler ) : public CATCmdAsyncBase
    {
private:
/**
 * States for CMGD command handler
 */
enum TCMGDState
    {
    ECMGDStateIdle,
    ECMGDStateRetrieveAllIndices,
    ECMGDStateDeleteOneEntry,
    ECMGDStateDeleteFilteredEntries,
    ECMGDStateDeleteAllEntries,
    ECMGDStateSimStoreNotSupported
    };

enum TCMGDFilter
    {
    ECMGDFilterReadMessagesOnly,
    ECMGDFilterReadAndSentMessages,
    ECMGDFilterReadSentAndUnsentMessages
    };

public:
    static CCMGDCommandHandler* NewL(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
    ~CCMGDCommandHandler();
    
private: // methods from CActive
    
    virtual void RunL();
    virtual void DoCancel();
    virtual TInt RunError(TInt aError);

private: // methods from CATCmdAsyncBase    
    
    virtual void HandleCommand( const TDesC8& aCmd, RBuf8& aReply, TBool aReplyNeeded );
    
private:
    
    CCMGDCommandHandler(MATMiscCmdPlugin* aCallback, TAtCommandParser& aATCmdParser, RMobilePhone& aPhone);
    void ConstructL();
    
    TInt ParseParameters();
    TInt DoHandleCommand();
    
    void GetMessageIndexListL();
    void FilterMessageListL();
    
private:
    
    RMobileSmsMessaging     iMobileSmsMessaging;
    RMobileSmsStore         iMobileSmsStore;
    
    CRetrieveMobilePhoneSmsList* iRetrieveSmsList;
    CMobilePhoneGsmSmsList*      iGsmSmsList;
    
    TCMGDState  iHandlerState;
    TCMGDFilter    iFilterType;
    TInt iIndex;
    TInt iDelFlag;
    RArray<TInt> iDeleteList;
    
    RBuf8 iReply;
    };

#endif /* CMGDCommandHandler_H */