ncdengine/engine/transport/inc/catalogssmssender.h
changeset 0 ba25891c3a9e
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/ncdengine/engine/transport/inc/catalogssmssender.h	Thu Dec 17 08:51:10 2009 +0200
@@ -0,0 +1,121 @@
+/*
+* Copyright (c) 2006 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:  
+*
+*/
+
+
+#ifndef C_CATALOGSSMSSENDER_H
+#define C_CATALOGSSMSSENDER_H
+
+#include <e32base.h>
+#include <msvapi.h> // MMsvSessionObserver
+
+
+class CCatalogsSmsOperation;
+class CMsvSession;
+class CClientMtmRegistry;
+class CSmsClientMtm;
+
+/**
+* SMS sender class
+*/
+class CCatalogsSmsSender : public CActive, public MMsvSessionObserver
+    {
+    public:
+
+        static CCatalogsSmsSender* NewL( CCatalogsSmsOperation& aObserver );
+    
+        ~CCatalogsSmsSender();
+    
+    public:
+        /**
+        * Start the operation
+        *
+        * @param aRecipient Message recipient
+        * @param aBody Message body
+        */  
+        void StartL( const TDesC& aRecipient, const TDesC& aBody );
+        
+        /**
+        * Cancels the operation and removes any created messages 
+        */
+         void CancelOperation();
+    
+    protected: // From CActive
+    
+        void RunL();
+        
+        void DoCancel();
+    
+        TInt RunError( TInt aError );
+    
+
+    protected: // Constructor
+    
+        CCatalogsSmsSender( CCatalogsSmsOperation& aObserver );
+
+    private: // from MMsvSessionObserver
+     
+        void HandleSessionEventL( TMsvSessionEvent aEvent, 
+            TAny* aArg1, TAny* aArg2, TAny* aArg3 );
+    
+
+    private:
+    
+        void CreateMessageL();
+        void SendMessageL();
+        void FinishMessageL();
+        void DeleteMessageL();
+        void Cleanup();
+    
+    
+    private:
+    
+        enum TCatalogsSmsState 
+            {
+            ECatalogsSmsStateIdle = 0,
+            ECatalogsSmsStateSessionReady,
+            ECatalogsSmsStateStarting,
+            ECatalogsSmsStateMoving,
+            ECatalogsSmsStateSending,
+            ECatalogsSmsStateDeletingSchedule,
+            ECatalogsSmsStateDeletingMessage,
+            ECatalogsSmsStateDone
+            };
+
+    private:
+    
+        CCatalogsSmsOperation& iObserver;
+    
+        CMsvSession* iSession; 
+        CClientMtmRegistry* iMtmRegistry;
+        
+        HBufC* iRecipient;
+        HBufC* iBody;
+        
+        // This represents an entry in the Message Server index
+        TMsvEntry iMsvEntry; 
+        CSmsClientMtm* iSmsMtm;
+        CMsvEntry* iParentEntry;
+        CMsvOperation* iOp;
+        CMsvEntrySelection* iSelection;
+        
+        TCatalogsSmsState iSmsState;
+        TBool iCancelled;
+        TMsvId iMovedId;
+        TMsvSendState iSendState;
+    };
+
+#endif // C_CATALOGSSMSSENDER_H
\ No newline at end of file