1 /* |
|
2 * Copyright (c) 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: Client side access to emergency number information |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #ifndef CPHCLTEMERGENCYCALL_H |
|
20 #define CPHCLTEMERGENCYCALL_H |
|
21 |
|
22 // INCLUDES |
|
23 #include <e32base.h> |
|
24 |
|
25 // FORWARD DECLARATIONS |
|
26 class MPhCltEmergencyCallObserver; |
|
27 |
|
28 // CONSTANTS |
|
29 const TInt KPhCltEmergencyNumberSize = 100; |
|
30 |
|
31 // DATA TYPES |
|
32 typedef TBuf< KPhCltEmergencyNumberSize > TPhCltEmergencyNumber; |
|
33 |
|
34 // CLASS DECLARATION |
|
35 /** |
|
36 * Phone Client Emergency Call Api for emergency number query |
|
37 * and emergency dialing. |
|
38 * |
|
39 * Example: |
|
40 * |
|
41 * // Creates an instance of the class |
|
42 * CPhCltEmergencyCall* emergencyCall = CPhCltEmergencyCall::NewL( this ); |
|
43 * |
|
44 * CleanupStack::PushL( emergencyCall ); |
|
45 * TPhCltEmergencyNumber emNumber; |
|
46 * |
|
47 * // Number contains DTMF code |
|
48 * _LIT( KTestNumber, "112p123" ); |
|
49 * emNumber.Copy( KTestNumber ); |
|
50 * TBool isEmergency( EFalse ); |
|
51 * |
|
52 * // Check if this number is considered as an emergency number |
|
53 * TInt error = emergencyCall->IsEmergencyPhoneNumber( emNumber, isEmergency ); |
|
54 * |
|
55 * // Dial |
|
56 * if ( isEmergency && !error ) |
|
57 * { |
|
58 * emergencyCall->DialEmergencyCallL( emNumber ); |
|
59 * } |
|
60 * |
|
61 * // Deletes emergencyCall |
|
62 * CleanupStack::PopAndDestroy( emergencyCall ); |
|
63 * |
|
64 * |
|
65 * @lib phoneclient.lib |
|
66 * @since SeriesS60_3.2 |
|
67 */ |
|
68 class CPhCltEmergencyCall : public CActive |
|
69 { |
|
70 public: // Constructors and destructor |
|
71 |
|
72 /** |
|
73 * Create an instance that implements the interface. |
|
74 * |
|
75 * @param aObserver It is the observer for the instance. |
|
76 * @return Returns the created instance. |
|
77 */ |
|
78 IMPORT_C static CPhCltEmergencyCall* NewL( |
|
79 MPhCltEmergencyCallObserver* aObserver ); |
|
80 |
|
81 public: // New functions |
|
82 |
|
83 /** |
|
84 * Returns information whether the number specified was an emergency number. |
|
85 * |
|
86 * @param aNumber Number to be queried. aNumber might contain prefix (SS code) |
|
87 * and/or postfix (DTMF part). |
|
88 * The aNumber parameter should be a buffer and the |
|
89 * clients are provided with a typedef called |
|
90 * TPhCltEmergencyNumber. |
|
91 * |
|
92 * @param aIsEmergencyNumber If ETrue, then the aNumber |
|
93 * parameter included emergency number. |
|
94 * @return Returns error code of the success of the operation. |
|
95 */ |
|
96 IMPORT_C virtual TInt IsEmergencyPhoneNumber( |
|
97 const TDesC& aNumber, |
|
98 TBool& aIsEmergencyNumber ) = 0; |
|
99 |
|
100 /** |
|
101 * Method can be used to check if the number specified contains |
|
102 * a valid emergency number in the end of the number. |
|
103 * |
|
104 * @param aNumber Number to be queried, matched emergency number |
|
105 * is returned in this parameter. |
|
106 * The aNumber parameter should be a buffer and the |
|
107 * clients are provided with a typedef called |
|
108 * TPhCltTelephoneNumber. |
|
109 * |
|
110 * @param aIsEmergencyNumber If ETrue, then the aNumber parameter |
|
111 * was emergency number. |
|
112 * @return Returns error code of the success of the operation. |
|
113 */ |
|
114 IMPORT_C virtual TInt FindEmergencyPhoneNumber( |
|
115 TDes& aNumber, |
|
116 TBool& aIsEmergencyNumber ) = 0; |
|
117 |
|
118 /** |
|
119 * Initiates an emergency call. |
|
120 * |
|
121 * @param aNumber Emergency number to be dialed. |
|
122 * The aNumber parameter should be a buffer and the |
|
123 * clients are provided with a typedef called |
|
124 * TPhCltEmergencyNumber. |
|
125 * |
|
126 * If the aNumber parameter supplies an "empty" buffer |
|
127 * the call is created either dialing the default emergency |
|
128 * phone number or use the SET UP EMERGENCY request |
|
129 * that does not contain a dialling number. |
|
130 * |
|
131 * Leaves with KErrArgument, if parameter aNumber was |
|
132 * not an emergency number. |
|
133 * |
|
134 * @pre IsActive() returns EFalse, otherwise leaves with KErrInUse. |
|
135 */ |
|
136 virtual void DialEmergencyCallL( const TDesC& aNumber ) = 0; |
|
137 |
|
138 /** |
|
139 * Returns information whether the number specified was an emergency |
|
140 * number and also returns the plain emergency number. |
|
141 * |
|
142 * @param aNumber Number to be queried.aNumber might contain prefix (SS code) |
|
143 * and/or postfix (DTMF part). |
|
144 * The aNumber parameter should be a buffer and the |
|
145 * clients are provided with a typedef called |
|
146 * TPhCltEmergencyNumber. |
|
147 * |
|
148 * @param aMatchedEmergencyNumber Matched emergencynumber without prefix or |
|
149 * postfix is returned in this parameter. The aMatchedEmergencyNumber |
|
150 * parameter should be a buffer and the clients are |
|
151 * provided with atypedef called TPhCltEmergencyNumber. |
|
152 * |
|
153 * @param aIsEmergencyNumber If ETrue, then the aNumber |
|
154 * parameter included emergency number. |
|
155 * |
|
156 * @return Returns error code of the success of the operation. |
|
157 */ |
|
158 IMPORT_C virtual TInt IsEmergencyPhoneNumber( |
|
159 const TDesC& aNumber, |
|
160 TDes& aMatchedEmergencyNumber, |
|
161 TBool& aIsEmergencyNumber ) = 0; |
|
162 |
|
163 protected: |
|
164 |
|
165 /** |
|
166 * C++ constructor. |
|
167 */ |
|
168 CPhCltEmergencyCall( MPhCltEmergencyCallObserver* aObserver ); |
|
169 |
|
170 |
|
171 protected: // Data |
|
172 |
|
173 // Observer to handle events. |
|
174 MPhCltEmergencyCallObserver* iObserver; |
|
175 |
|
176 }; |
|
177 |
|
178 #endif // CPHCLTEMERGENCYCALL_H |
|
179 |
|
180 // End of File |
|