cbsref/telephonyrefplugins/atltsy/atcommand/sms/inc/atsmssend.h
branchRCL_3
changeset 20 07a122eea281
parent 19 630d2f34d719
child 21 4814c5a49428
equal deleted inserted replaced
19:630d2f34d719 20:07a122eea281
     1 // Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // @file atsmssend.h
       
    15 // This contains CAtSmsSend which is used to send sms message
       
    16 // 
       
    17 
       
    18 #ifndef ATSMSSEND_H
       
    19 #define ATSMSSEND_H
       
    20 
       
    21  //system include
       
    22 #include <e32std.h>
       
    23 #include <e32base.h>
       
    24 #include <callbacktimer.h>
       
    25 
       
    26 // user include
       
    27 #include "atcommandbase.h"
       
    28 
       
    29 // CLASS DECLARATION
       
    30 /**
       
    31  *  TSmsSendParam
       
    32  */
       
    33 class TSmsSendParam
       
    34    	{
       
    35 public:
       
    36 	RMobilePhone::TMobileAddress iDestination;
       
    37    	TBuf8<KGsmTpduSize> iSmsTpdu;
       
    38     RMobileSmsMessaging::TMobileSmsDataFormat iDataFormat;
       
    39     RMobilePhone::TMobileAddress  iGsmServiceCentre;
       
    40     TBool iMoreMessages;
       
    41    	};
       
    42 /**
       
    43  *  TSmsSendResponse 
       
    44  */
       
    45 class TSmsSendResponse
       
    46 	{
       
    47 public:
       
    48     TInt iValRef;
       
    49     TBuf8<KGsmTpduSize>	 iSubmitReport;
       
    50 	};
       
    51 /**
       
    52  * CAtSmsSend
       
    53  *
       
    54  */
       
    55 class CAtSmsSend : public CAtCommandBase,
       
    56                    public MTimerObserver
       
    57 	{
       
    58 public:
       
    59 	/**
       
    60 	* Destructor
       
    61 	*
       
    62 	*/
       
    63 	~CAtSmsSend();
       
    64 	
       
    65 	/**
       
    66 	*  static NewL  
       
    67 	*
       
    68 	* @param aGloblePhone
       
    69 	* @param aCtsyDispatcherCallback
       
    70 	*/
       
    71 	static CAtSmsSend* NewL(CGlobalPhonemanager& aGloblePhone, 
       
    72                             CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
    73 	
       
    74 	/**
       
    75 	*  static NewLC 
       
    76 	*
       
    77 	* @param aGloblePhone
       
    78 	* @param aCtsyDispatcherCallback
       
    79 	*/
       
    80 	static CAtSmsSend* NewLC(CGlobalPhonemanager& aGloblePhone, 
       
    81                              CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
    82 	
       
    83 	/**
       
    84 	* Virtual function. Inherited from CAtCommandBase
       
    85 	*  Start Execute AT Command
       
    86 	*/
       
    87 	virtual void ExecuteCommand();
       
    88 	
       
    89 	/**
       
    90 	* Will be called by AT Manager whenever a event was triggered
       
    91 	* 
       
    92 	* @param aEventSource
       
    93 	* @param aStatus
       
    94 	*/
       
    95 	virtual void EventSignal(TAtEventSource aEventSource, TInt aStatus);
       
    96 	/**
       
    97 	* Virtual function. Inherited from CAtCommandBase
       
    98 	* 
       
    99 	* @param aResponseBuf Line buf reading from baseband 
       
   100 	*/
       
   101 	virtual void ParseResponseL(const TDesC8& aResponseBuf);
       
   102 	/**
       
   103 	* Start this request
       
   104 	* 
       
   105 	*/
       
   106 	void StartRequest();
       
   107 	/**
       
   108 	* set send message parameter
       
   109 	* 
       
   110 	* @param  aMsgParam
       
   111 	*/
       
   112 	void SetMessageParam(TSmsSendParam aMsgParam);
       
   113 private:
       
   114 	/**
       
   115 	* Constructor
       
   116 	*
       
   117 	* @param aGloblePhone
       
   118 	* @param aCtsyDispatcherCallback
       
   119 	*/
       
   120 	CAtSmsSend(CGlobalPhonemanager& aGloblePhone, 
       
   121                CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
   122 	
       
   123 	/**
       
   124 	* 2nd Constructor
       
   125 	*/
       
   126 	void ConstructL();
       
   127 	
       
   128 	/**
       
   129 	* confirm if there is a sca address 
       
   130 	*  
       
   131 	*  @return  KErrNone......
       
   132 	*/
       
   133 	TInt ConfirmSca();
       
   134 		
       
   135     /**
       
   136      * start a timer
       
   137      */
       
   138     void BeginTimer();	
       
   139     
       
   140 	/**
       
   141 	* From MTimerObserver 
       
   142 	*/
       
   143 	virtual void TimerRun(TInt aError);
       
   144 	
       
   145 	/**
       
   146 	* Issue writing AT Command to baseband
       
   147 	* not using base class because the buffer length is KMaxAsciiPduLength
       
   148 	*/
       
   149 	void StartWritingPduLength();
       
   150 	
       
   151 	/**
       
   152 	* Issue writing AT Command to baseband
       
   153 	* not using base class because the buffer length is KMaxAsciiPduLength
       
   154 	*/
       
   155 	void StartWritingPdu();
       
   156 private:
       
   157 	/**
       
   158 	*  state machine for EventSignal 
       
   159 	*/
       
   160 	enum 
       
   161 		{
       
   162 		ESetPDULengthComplete,
       
   163 		ESendPDUComplete,
       
   164 		}iState;
       
   165 		
       
   166 	/**
       
   167 	*  A pointer for Timer
       
   168 	*/
       
   169 	CCallbackTimer* iCallbackTimer;	
       
   170 	
       
   171 	/**
       
   172 	* The buffer contains the "AT" String which should be sent to BaseBand Modem
       
   173 	*/
       
   174 	TBuf8<KMaxAsciiPduLength> iTxBuffer;	
       
   175 	
       
   176 	/**
       
   177 	* The structure contains sending message parameter
       
   178 	*/
       
   179 	TSmsSendParam iSmsSendParam;
       
   180 	
       
   181 	/**
       
   182 	* PDU in ascii format
       
   183 	*/
       
   184 	TBuf8<KMaxAsciiPduLength> iMsgDataAscii; 
       
   185 	
       
   186 	/**
       
   187 	* The response structure which read from modem
       
   188 	*/
       
   189 	TSmsSendResponse iSmsSendResponse;
       
   190 	
       
   191 	/**
       
   192 	* The return error value of AT command executed 
       
   193 	*/
       
   194 	TInt iError;	
       
   195 	
       
   196 	/**
       
   197 	* The error value before Execute write()
       
   198 	*/
       
   199 	TInt iCallbackVal;
       
   200 	}; // class CAtSmsSend
       
   201 #endif // ATSMSSEND_H