examples/ForumNokia/SMSExample/Engine/inc/SMSExampleMtmsEngine.h

00001 /*
00002  * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). All rights reserved.
00003  *    
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *    
00007  *  * Redistributions of source code must retain the above copyright notice, this
00008  *    list of conditions and the following disclaimer.
00009  *  * Redistributions in binary form must reproduce the above copyright notice,
00010  *    this list of conditions and the following disclaimer in the documentation
00011  *    and/or other materials provided with the distribution.
00012  *  * Neither the name of Nokia Corporation nor the names of its contributors
00013  *    may be used to endorse or promote products derived from this software
00014  *    without specific prior written permission.
00015  *    
00016  *    THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00017  *    AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00018  *    IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
00019  *    DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
00020  *    FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
00021  *    DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
00022  *    SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
00023  *    CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
00024  *    OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
00025  *    OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00026  *    
00027  *    Description:  
00028  */
00029 
00030 #ifndef SMS_EXAMPLE_ENGINE
00031 #define SMS_EXAMPLE_ENGINE
00032 
00033 // INCLUDES 
00034 #include <e32base.h> // CBase
00035 #include <msvapi.h>  // MMsvSessionObserver
00036 #include <badesca.h> // CDesCArrayFlat
00037 
00038 // FORWARD DECLARATIONS
00039 class CClientMtmRegistry;
00040 class CSmsClientMtm;
00041 class MSMSExampleMtmsEngineObserver;
00042 
00043 // CLASS DECLARATION
00044 
00049 class CSMSExampleMtmsEngine : public CActive, public MMsvSessionObserver
00050     {
00051     public:
00052        
00059         static CSMSExampleMtmsEngine* NewL(MSMSExampleMtmsEngineObserver& 
00060                                            aObserver);
00061         
00065         ~CSMSExampleMtmsEngine();
00066 
00067     public:
00068 
00074         void MoveToFolderL( TMsvId aMessageId,  TMsvId aFolder );
00075 
00080         void DeleteMessageL( TMsvId aMessageId );
00081 
00087         void CopyMessageL( TMsvId aMessageId, TMsvId aFolder );
00088 
00094         void GetMessageAddressL( TMsvId aMessageId, TDes& aAddress );
00095 
00103         TBool GetMessageL( TMsvId aMessageId, TDes& aMessage );
00104 
00112         TBool GetMessageIndexBodyTextL( TMsvId aMessageId, TDes& aMessage );
00113 
00119         void GetFolderSMSMessageInformationL( TMsvId aFolderID, 
00120                                               CDesCArrayFlat*& aAddresses, 
00121                                               CDesCArrayFlat*& aMessages );
00122 
00128         RArray<TMsvId>* GetMessageIds();
00129 
00130     private:
00135         CSMSExampleMtmsEngine(MSMSExampleMtmsEngineObserver& aObserver);
00136 
00140         void ConstructL();
00141 
00145         void CreateMtmClientL();
00146 
00147     private: // from CActive
00148         virtual void DoCancel();
00149         virtual void RunL();
00150 
00151 
00152     private: // from MMsvSessionObserver
00153         void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, 
00154                                  TAny* aArg2, TAny* aArg3);
00155 
00156     private:
00157 
00158         // SMS client MTM interface
00159         CSmsClientMtm*      iSmsMtm;
00160 
00161         // Observer of this engine.
00162         MSMSExampleMtmsEngineObserver& iObserver;
00163 
00164         // Controls asynchronous commands in the messaging system
00165         // Get progress information about the sending.
00166         CMsvOperation*      iMsvOper;
00167 
00168         // Encapsulates an array of entry IDs.
00169         CMsvEntrySelection* iEntrySelection;
00170 
00171         // Represents a session to the messaging server
00172         CMsvSession*        iSession;   
00173 
00174         // This registry holds details of the all the Client-side 
00175         // MTMs currently available on the system. 
00176         CClientMtmRegistry* iClientMtmReg;
00177        
00178         // Array of ids
00179         RArray<TMsvId>*     iIdArray;
00180        
00181         // Id of an SMS message
00182         TMsvId              iSmsId;
00183     };
00184 
00188 class MSMSExampleMtmsEngineObserver
00189     {
00190     public:
00191         virtual void HandleMessageSentL(TInt aError) = 0;
00192     };
00193 
00194 
00195 #endif  // SMS_EXAMPLE_ENGINE
00196 

Generated by  doxygen 1.6.2