⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cmmsssendhandler.h

📁 Symbian 手机发送彩信程序 mmssend
💻 H
字号:
/*  Copyright (c) 2004, Nokia. All rights reserved */


#ifndef __CMMSSHANDLER_H__
#define __CMMSSHANDLER_H__

// INCLUDES
#include <e32base.h>
#include <msvapi.h>

#include "CMsvHandler.h"

// FORWARD DECLARATIONS
class MMsvObserver;

// CLASS DECLARATION
/**
* Provides the MMS sending
*/

class CMmssSendHandler : public CMsvHandler
    {
	public:
        enum KMaxMsgPropertiesLength{ EMaxRecipientLength = 30,
                                      EMaxSubjectLength = 30 };

    private:
        /**
        * Message state enumerations
        */
        enum TPhase
            {
            EIdle,
            EWaitingForCreate,
            EWaitingForMove,
            EWaitingForScheduled,
            EWaitingForSent
            };

    public: // constructors and destructors
        /**
        * NewL
        * Create a CMmssSendHandler object using two phase construction,
        * and return a pointer to the created object
        * @param aObserver the object to be used to handle updates from the server
        * @result a pointer to the created instance of CMmssSendHandler
        */
        static CMmssSendHandler* NewL( MMsvObserver& aObserver );

        /**
        * NewLC
        * Create a CMmssSendHandler object using two phase construction,
        * and return a pointer to the created object
        * @param aObserver the object to be used to handle updates from the server
        * @result a pointer to the created instance of CMmssSendHandler
        */
        static CMmssSendHandler* NewLC( MMsvObserver& aObserver );

        /**
        * ~CMmssSendHandler
        * Destroy the object and release all memory objects
        */
        virtual ~CMmssSendHandler();

        /**
        * SendToL
        * Send an MMS message to a recipient with subject
        * @param aRecipient the recipient address
        * @param aSubject the message subject
        * @param aAppFullPath the application full path if phone used (otherwise NULL)
        */
        void SendToL( const TDesC& aRecipient, const TDesC& aSubject,
                      TFileName aAppFullPath );

        /**
        * From CexMsvHandler, IsIdle
        * Determine whether we are Idle and could
        * accept a new SendToL request
        * @result true if a new operation may be requested
        */
        TBool IsIdle();

        /**
        * From MMsvSessionObserver, HandleSessionEventL
        * Handles session event observer and calls event handling functions in
        * observer. Note that if additional session event handlers are defined in
        * the session, they are called before this function (as this is the
        * main session observer).
        * For most event types, the action that is taken, for example, updating the
        * display, is client-specific. All clients though should respond to
        * EMsvCloseSession and EMsvServerTerminated events.
        * @param aEvent indicates the type of event
        * @param aArg1 interpretation depends on event type
        * @param aArg2 interpretation depends on event type
        * @param aArg3 interpretation depends on event type
        */
        void HandleSessionEventL( TMsvSessionEvent aEvent,TAny* aArg1, TAny* aArg2, TAny* aArg3 );

        /**
        * HandleChangedEntryL
        * If we are waiting for the message to be sent then check the Id
        * of the changed entry. Report the success/failure to the observer.
        * If it succeeded, delete the message
        * @param aEntryId the entry to check
        */
        void HandleChangedEntryL( TMsvId aEntryId );

	protected:
        /**
        * From CActive, RunL
        * Callback function. Invoked to handle responses from the server
        */
	    void RunL();

        /**
        * CMmssSendHandler
        * Perform the first phase of two phase construction
        * @param aObserver the object to be used to handle status/error reports
        */
        CMmssSendHandler( MMsvObserver& aObserver );

	private:
        /**
        * ConstructL
        * Perform the second phase construction of a CMmsSendHandler object
        */
        void ConstructL();

        /**
        * CreateNewMessageL
        * Creates a new message server entry and set up default values.
        */
        void CreateNewMessageL();

        /**
        * AddTextAttachmentL
        * Adds text attachment for the message
        */
        void AddTextAttachmentL( TMsvId& attachmentId, TPtrC8& aType,
                                 const TUint aCode, TDes& aMsgText,
                                 TDes& aMsgName );
        /**
        * AddMultimediaAttachment2L
        * Adds multimedia attachment for the message
        * Message server defines the message type
        * @param attachmentId the id of the attachment
        * @param aType the type of the message (*.jpg, *.gif)
        * @param aObjFullPathAndName the full attachment path (and name)
        */
        void AddMultimediaAttachment2L( TMsvId& attachmentId, TPtrC8& aType,
                                        TFileName aObjFullPathAndName );

        /**
	    * SetupMmsHeaderL
        * Set up Mms specific information
        * @return true if successful
        */
        TBool SetupMmsHeaderL();

        /**
        * PopulateMessageL
        * Fill in message content
        * @param aMsvEntry the message
        */
        void PopulateMessageL( TMsvEntry& aMsvEntry );

        /**
        * InitializeMessageL
        * Prepares the message contents and saves to message server
        * @return true if ok
        */
        TBool InitializeMessageL();

        /**
        * MoveMessageEntryL
        * Moves an entry to another parent.
        * @param aTarget the message entry to move
        * @return true if move was attempted
        */
        TBool MoveMessageEntryL( TMsvId aTarget );

        /**
        * SetScheduledSendingStateL
        * Schedules the message to be sent through the etel server.
        * @param aSelection the message to send
        */
        void SetScheduledSendingStateL( CMsvEntrySelection& aSelection );

    private: //Member variables
        /**
        * iPhase the message state variable
        */
        TPhase  iPhase;

        /**
        * iAppFullPAth the message recipient address text (max 30 char.)
        */
        TFileName   iAppFullPath;

        /**
        * iRecipientText the message recipient address text (max 30 char.)
        */
        TBuf<EMaxRecipientLength>   iRecipientText;

        /**
        * iSubjectText the message recipient subject text (max 30 char.)
        */
        TBuf<EMaxSubjectLength>	    iSubjectText;
    };

#endif // __CMMSSHANDLER_H__

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -