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

00001 /*
00002  * Copyright © 2008 Nokia Corporation.
00003  */
00004 
00005 #ifndef CSMSENGINE_H
00006 #define CSMSENGINE_H
00007 
00008 //  EXTERNAL INCLUDES
00009 #include <e32base.h>
00010 
00011 //  INTERNAL INCLUDES
00012 #include "SMSExampleMtmsEngine.h"
00013 
00014 //  CONSTANTS
00015 const TInt KSmsMessageLength = 512;
00016 const TInt KAddressLength = 64;
00017 
00018 
00019 class MSmsEngineObserver
00020 {
00021     public:
00022         virtual void SendingMessage()=0;
00023         virtual void MessageSent()=0;
00024         virtual void MessageReceived(const TDesC& addr, const TDesC& msg)=0;
00025         virtual void SmsEngineInitialized()=0;
00026         virtual void SmsEngineError(TInt aErrorCode)=0;
00027         virtual void MessageDeleted()=0; //if automatic deletion is on
00028 };
00029 
00030 //  CLASS DEFINITION
00040 class CSmsEngine : public CBase, public MMsvSessionObserver, public MSMSExampleMtmsEngineObserver
00041     {
00042     public:     // Constructors and destructor
00043 
00048         IMPORT_C static CSmsEngine* NewL(MSmsEngineObserver& aObserver);
00049 
00054         IMPORT_C static CSmsEngine* NewLC(MSmsEngineObserver& aObserver);
00055 
00059         IMPORT_C ~CSmsEngine();
00060 
00061      public:     //new functions
00067         IMPORT_C void SendSmsL(const TDesC& aAddr, const TDesC&aMsg); //nyt CreateSmsMessage, validateCreatedSms ja SendSms, laita kaikki piiloon
00068 
00074         IMPORT_C void ListenforIncomingSms(TBool aListening);
00075 
00081         IMPORT_C void SetAutomaticDeletetion(TBool aDeletion);
00082 
00083 
00091         IMPORT_C void GetFolderSMSMessageInformationL(TMsvId aFolderID,
00092                                                 CDesCArrayFlat*& aAddresses,
00093                                                 CDesCArrayFlat*& aMessages);
00094 
00103         IMPORT_C RArray<TMsvId>* GetMessageIds();
00104 
00110         IMPORT_C void CopyMessageL( TMsvId aMessageId, TMsvId aFolder );
00111 
00117         IMPORT_C void MoveToFolderL( TMsvId aMessageId,  TMsvId aFolder );
00118 
00123         IMPORT_C void DeleteMessageL( TMsvId aMessageId );
00124 
00125     public:  //from base classes
00126 
00130         void HandleSessionEventL(TMsvSessionEvent aEvent, TAny* aArg1, TAny* aArg2, TAny* aArg3);
00131 
00135         void HandleMessageSentL(TInt aError);
00136 
00137     private:    // Constructors
00138 
00143         CSmsEngine(MSmsEngineObserver& aObserver);
00144 
00148         void ConstructL();
00149 
00150     private:
00151 
00158         void SendSmsInThirdEditionL(const TDesC& aAddr, const TDesC& aMsg);
00159 
00160     private:    // Data
00161 
00162         //The observer
00163         MSmsEngineObserver& iObserver;
00164 
00165         // SMS engine
00166         CSMSExampleMtmsEngine* iEngine;
00167 
00168         // Parser that searches phone numbers
00169         //CSMSExampleParser* iParser;
00170 
00171         // Recipient address
00172         TBuf<KAddressLength> iAddress;
00173 
00174         // Message body
00175         TBuf<KSmsMessageLength> iMessage;
00176 
00177         // ETrue is automatic delete is on, EFalse otherwise
00178         TBool iAutomaticDelete;
00179 
00180         // are we listening for incoming messages
00181         TBool iListeningForIncoming;
00182 
00183         // Session with the messaging server
00184         CMsvSession* iMsvSession;
00185 
00186         // CMsvEntry accesses and acts upon a particular Message Server entry
00187         CMsvEntry* iMsvEntry;
00188 
00189         // Id of a new message
00190         TMsvId iNewMessageId;
00191 
00192         // Id of the sent message
00193         TMsvId iSentMessageId;
00194 
00195     };
00196 
00197 //  INLINE FUNCTIONS
00198 
00199 #endif      //  CSMSENGINE_H
00200 
00201 // End of file

Generated by  doxygen 1.6.2