cbsref/telephonyrefplugins/atltsy/atcommand/callcontrol/inc/atdtmfvts.h
branchRCL_3
changeset 65 630d2f34d719
equal deleted inserted replaced
61:17af172ffa5f 65:630d2f34d719
       
     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 atdtmfvts.h
       
    15 // This contains CATDtmfVts which send the DTMF to network.
       
    16 // 
       
    17 
       
    18 #ifndef ATDTMFVTS_H_
       
    19 #define ATDTMFVTS_H_
       
    20 
       
    21 //system include
       
    22 #include <callbacktimer.h>
       
    23 //user include
       
    24 #include "atcommandbase.h"
       
    25 
       
    26 //const define
       
    27 const TInt KLtsyTonesLength = 200;
       
    28 
       
    29 
       
    30 //class forward
       
    31 class CGlobalPhonemanager;
       
    32 class CCtsyDispatcherCallback;
       
    33 
       
    34 class CATDtmfVts : public CAtCommandBase, 
       
    35 				   public MTimerObserver
       
    36 	{
       
    37 public:
       
    38 	/**
       
    39 	 * Factory funciton
       
    40 	 * 
       
    41 	 */
       
    42 	static CATDtmfVts* NewL(CGlobalPhonemanager& aGloblePhone,
       
    43 			                CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
    44 	
       
    45 	/**
       
    46 	 * Factory function
       
    47 	 * 
       
    48 	 */
       
    49 	static CATDtmfVts* NewLC(CGlobalPhonemanager& aGloblePhone,
       
    50 			                 CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
    51 	
       
    52 	/**
       
    53 	 * Destructor
       
    54 	 * 
       
    55 	 */
       
    56 	virtual ~CATDtmfVts();
       
    57 	
       
    58 	/**
       
    59 	 * Execute the AT command
       
    60 	 * 
       
    61 	 */
       
    62 	virtual void ExecuteCommand();
       
    63 		
       
    64 	/**
       
    65 	 * Start the request
       
    66 	 * 
       
    67 	 */
       
    68 	virtual void StartRequest();
       
    69 	
       
    70 	/**
       
    71 	 * From CAtCommandBase
       
    72 	 * 
       
    73 	 */
       
    74 	virtual void EventSignal(TAtEventSource aEventSource, TInt aStatus);
       
    75 
       
    76 	/**
       
    77 	 * From CAtCommandBase
       
    78 	 * 
       
    79 	 */
       
    80 	virtual void ParseResponseL(const TDesC8& aResponseBuf);
       
    81 		
       
    82 	/**
       
    83 	 * This call id is must an active call id
       
    84 	 * 
       
    85 	 */
       
    86 	TInt SetCallId(TInt aCallId);
       
    87 	
       
    88 	/**
       
    89 	 * Must be invoke when Execucommand
       
    90 	 * 
       
    91 	 */
       
    92 	TInt SetDtmfString(const TDesC& aDtmfString);
       
    93 	
       
    94 	/**
       
    95 	 * Check if the char is the DTMF tones
       
    96 	 * 
       
    97 	 */
       
    98 	TBool CharIsDtmf(const TChar& aDtmfChar);
       
    99 	
       
   100 	/**
       
   101 	 * Check if the string are DTMF tones
       
   102 	 * 
       
   103 	 */
       
   104 	TBool StringIsDtmf(const TDesC& aDtmfString);
       
   105 	
       
   106 	/**
       
   107      * Reset the all the flag
       
   108 	 * 
       
   109 	 */
       
   110 	void InitVariable();		
       
   111 public:
       
   112 	/**
       
   113 	 * Define the DTMF type
       
   114 	 * 
       
   115 	 */
       
   116 	enum TDtmfWorkType
       
   117 		{
       
   118 		EDtmfUnknow,
       
   119 		EDtmfSendOneTone,   //Send One Char
       
   120 		EDtmfSendMoreTones, //Send string tones
       
   121 		EDtmfStopOneTone,   //Stop One char
       
   122 		EDtmfCancelMoreTones //Cancel More Tones
       
   123 		};
       
   124 	
       
   125 	/**
       
   126 	 * 
       
   127      * Set the DTMF Type
       
   128 	 */
       
   129 	void SetDtmfWorkType(TDtmfWorkType aDtmfWorkType);
       
   130 protected:	
       
   131 	/**
       
   132 	 * Constructor
       
   133 	 * 
       
   134 	 */
       
   135 	CATDtmfVts(CGlobalPhonemanager& aGloblePhone,
       
   136 			   CCtsyDispatcherCallback& aCtsyDispatcherCallback);
       
   137 	
       
   138 	/**
       
   139 	 * 2nd constructor
       
   140 	 * 
       
   141 	 */
       
   142 	void ConstructL();	
       
   143 private:
       
   144 	/**
       
   145 	 * Overwite the Parent's complete
       
   146 	 * 
       
   147 	 */
       
   148 	virtual void Complete();
       
   149 	
       
   150 	/**
       
   151 	 * Checck if there is any active call current
       
   152 	 * 
       
   153 	 */
       
   154 	TBool IsHaveActiveCall(TInt aActiveCallId);	
       
   155 	
       
   156 	/**
       
   157 	 * From MTimerObserver 
       
   158 	 * 
       
   159 	 */
       
   160     virtual void TimerRun(TInt aError);
       
   161     
       
   162     /**
       
   163      * Start the timer
       
   164      * 
       
   165      */
       
   166     void StartTimer();	
       
   167     
       
   168 	/**
       
   169 	 * Handle IO errors
       
   170 	 * 
       
   171 	 */
       
   172 	void HandleIOError();
       
   173 	
       
   174 	/**
       
   175 	 * Handle response error
       
   176 	 * 
       
   177 	 */
       
   178 	void HandleResponseError();
       
   179 	
       
   180 	/**
       
   181 	 * Handle the complete event
       
   182 	 * 
       
   183 	 */
       
   184 	void HandleSendDtmfTonesSuccess();
       
   185 	
       
   186 private:
       
   187 	
       
   188 	/**
       
   189 	 * Define the state of sending the DTMF tone
       
   190 	 * 
       
   191 	 */
       
   192 	enum TATStep
       
   193 		{
       
   194 		EATNotInProgress,
       
   195 		EATWaitForWriteComplete,
       
   196 		EATReadComplete
       
   197 		};
       
   198 private:
       
   199 	/**
       
   200 	 * I/O error when Read or Write
       
   201 	 * include timeout
       
   202 	 */
       
   203 	TInt iIOStatus;
       
   204 	
       
   205 	/**
       
   206 	 * At command return errors
       
   207 	 * 
       
   208 	 */
       
   209 	TInt iATResult;
       
   210 	
       
   211 	/**
       
   212 	 * The sending is done successfully
       
   213 	 * 
       
   214 	 */
       
   215 	TBool iOKFounded;
       
   216 	
       
   217 	/**
       
   218 	 * Identifier step
       
   219 	 * 
       
   220 	 */
       
   221 	TATStep iAnswerStep;	
       
   222 	
       
   223 	/**
       
   224 	 * The calll Id
       
   225 	 * 
       
   226 	 */
       
   227 	TInt iCallId;
       
   228 	
       
   229 	/**
       
   230 	 * The DTMF type
       
   231 	 * 
       
   232 	 */
       
   233 	TDtmfWorkType iDtmfWorkType;
       
   234 	
       
   235 	/**
       
   236 	 * The timer active object
       
   237 	 * 
       
   238 	 */
       
   239 	CCallbackTimer* iCallbackTimer;	
       
   240 	};
       
   241 
       
   242 #endif /*ATDTMFVTS_H_*/