|
1 /* |
|
2 * Copyright (c) 2006-2008 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: State machine for DTMF payload format encoding and sending. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 #ifndef CDTMFENCSTATEMACHINE_H |
|
22 #define CDTMFENCSTATEMACHINE_H |
|
23 |
|
24 // INCLUDES |
|
25 #include <e32base.h> |
|
26 |
|
27 // DATA TYPES |
|
28 /** |
|
29 * Eventhandling state |
|
30 */ |
|
31 enum TDTMFSendingState |
|
32 { |
|
33 EStateSendingIdle = 0, |
|
34 EStateEncodeNextDigit = 1, |
|
35 EStateToneOn = 2, |
|
36 EStateToneOff = 3, |
|
37 EStateSendPaused = 4, |
|
38 EStateSendStopped = 5 |
|
39 }; |
|
40 |
|
41 // CLASS DECLARATION |
|
42 |
|
43 /** |
|
44 * Callback interface for state machine clients. |
|
45 * |
|
46 * @lib mmccdtmfplformat.dll |
|
47 * @since Series 60 3.2 |
|
48 */ |
|
49 class MDtmfEncClient |
|
50 { |
|
51 public: |
|
52 |
|
53 /** |
|
54 * Called when it's time to handle next digit in sequence |
|
55 * while sending DTMF string. |
|
56 * |
|
57 * @since Series 60 3.2 |
|
58 */ |
|
59 virtual void EncodeNextDigitL() = 0; |
|
60 |
|
61 /** |
|
62 * Does actions belonging to tone on state. Actions include |
|
63 * DTMF event update packets sending. |
|
64 * |
|
65 * @since Series 60 3.2 |
|
66 * @param aEntryToState Indicates is this transition to state |
|
67 */ |
|
68 virtual void DoToneOnActionsL( TBool aEntryToState ) = 0; |
|
69 |
|
70 /** |
|
71 * Does actions belonging to tone off state. |
|
72 * |
|
73 * @since Series 60 3.2 |
|
74 * @param aEntryToState Indicates is this transition to state |
|
75 */ |
|
76 virtual void DoToneOffActionsL( TBool aEntryToState ) = 0; |
|
77 }; |
|
78 |
|
79 /** |
|
80 * State machine for dtmf payload format encoding and sending. |
|
81 * |
|
82 * @lib mmccdtmfplformat.dll |
|
83 * @since Series 60 3.2 |
|
84 */ |
|
85 class CDtmfEncStateMachine : public CActive |
|
86 { |
|
87 public: // Constructors and destructor |
|
88 |
|
89 /** |
|
90 * Two-phased constructor. |
|
91 */ |
|
92 static CDtmfEncStateMachine* NewL( MDtmfEncClient& aClient ); |
|
93 |
|
94 /** |
|
95 * Destructor. |
|
96 */ |
|
97 virtual ~CDtmfEncStateMachine(); |
|
98 |
|
99 /** |
|
100 * Changes state to the new one if transition is acceptable. |
|
101 * |
|
102 * @since Series 60 3.2 |
|
103 * @param aNewState New state to proceed to |
|
104 */ |
|
105 void ChangeStateTo( TDTMFSendingState aNewState ); |
|
106 |
|
107 /** |
|
108 * Returns current state. |
|
109 * |
|
110 * @since Series 60 3.2 |
|
111 * @return Current state |
|
112 */ |
|
113 TDTMFSendingState State() const; |
|
114 |
|
115 /** |
|
116 * Resets the statemachine from any state. |
|
117 * |
|
118 * @since S60 3.2 |
|
119 */ |
|
120 void ResetStateMachine(); |
|
121 |
|
122 protected: // New functions |
|
123 |
|
124 /** |
|
125 * From CActive. |
|
126 */ |
|
127 void RunL(); |
|
128 |
|
129 /** |
|
130 * From CActive. |
|
131 */ |
|
132 void DoCancel(); |
|
133 |
|
134 /** |
|
135 * From CActive. |
|
136 */ |
|
137 TInt RunError( TInt aError ); |
|
138 |
|
139 private: |
|
140 |
|
141 /** |
|
142 * C++ default constructor. |
|
143 */ |
|
144 CDtmfEncStateMachine( MDtmfEncClient& aClient ); |
|
145 |
|
146 private: // Data |
|
147 |
|
148 /** |
|
149 * Client using state machine |
|
150 */ |
|
151 MDtmfEncClient& iClient; |
|
152 |
|
153 /** |
|
154 * Current state |
|
155 */ |
|
156 TDTMFSendingState iState; |
|
157 }; |
|
158 |
|
159 #endif // CDTMFENCSTATEMACHINE_H |
|
160 |
|
161 // End of File |