|
1 // Copyright (c) 2005-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 // |
|
15 |
|
16 |
|
17 #include "CIdentityServiceStatus.h" |
|
18 |
|
19 /** |
|
20 Factory constructor. |
|
21 |
|
22 @param aController Pointer to MExecAsync object passed to constructor of |
|
23 CISVAPIBase |
|
24 @return Instance of CIdentityServiceStatus class |
|
25 */ |
|
26 CIdentityServiceStatus* CIdentityServiceStatus::NewL(MExecAsync* aController) |
|
27 { |
|
28 CIdentityServiceStatus* self = new(ELeave) CIdentityServiceStatus(aController); |
|
29 CleanupStack::PushL(self); |
|
30 self->ConstructL(); |
|
31 CleanupStack::Pop(self); |
|
32 return self; |
|
33 } |
|
34 |
|
35 /** |
|
36 Destructor. |
|
37 Cancels outstanding requests. |
|
38 */ |
|
39 CIdentityServiceStatus::~CIdentityServiceStatus() |
|
40 { |
|
41 Cancel(); |
|
42 } |
|
43 |
|
44 /** |
|
45 Gets the identity service status and stores it in the iIdentityServiceStatusV1Pckg package. |
|
46 */ |
|
47 void CIdentityServiceStatus::DoStartRequestL() |
|
48 { |
|
49 _LIT(KDummyAnswerPanic, "CIdentityServiceStatus Get Method"); |
|
50 __ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1)); |
|
51 iRequestNotify = EFalse; |
|
52 CTelephony::TIdentityService condition = CTelephony::EIdServiceCallerPresentation; |
|
53 |
|
54 // Interrogate the current status of the identity services. |
|
55 iTelephony->GetIdentityServiceStatus( iStatus, |
|
56 condition, |
|
57 iIdentityServiceStatusV1Pckg); |
|
58 SetActive(); |
|
59 } |
|
60 |
|
61 /** |
|
62 Constructor. |
|
63 |
|
64 @param aController Pointer to an MExecAsync object passed to constructor of |
|
65 CISVAPIBase. |
|
66 */ |
|
67 CIdentityServiceStatus::CIdentityServiceStatus(MExecAsync* aController) |
|
68 : CISVAPIAsync(aController, KIdentityServiceStatus), |
|
69 iIdentityServiceStatusV1Pckg(iIdentityServiceStatusV1) |
|
70 { |
|
71 // |
|
72 } |
|
73 |
|
74 /** |
|
75 Second phase constructor. |
|
76 */ |
|
77 void CIdentityServiceStatus::ConstructL() |
|
78 { |
|
79 // Empty method |
|
80 } |
|
81 |
|
82 /** |
|
83 Checks the status of the active object and prints the identity service status |
|
84 to the console if there is no error. |
|
85 */ |
|
86 void CIdentityServiceStatus::RunL() |
|
87 { |
|
88 if(iStatus != KErrNone) |
|
89 { |
|
90 iConsole->Printf(KError); |
|
91 |
|
92 // Print the error status code |
|
93 iConsole->Printf(_L("%d\n"), iStatus.Int()); |
|
94 } |
|
95 else |
|
96 { |
|
97 // Print the console output message if there is no error |
|
98 iConsole->Printf(KIdentityServiceStatusMsg); |
|
99 switch(iIdentityServiceStatusV1.iIdentityStatus) |
|
100 { |
|
101 case CTelephony::EIdServiceActivePermanent: |
|
102 case CTelephony::EIdServiceActiveDefaultAllowed: |
|
103 iConsole->Printf(_L("Incoming Callers number Displayed\n")); |
|
104 break; |
|
105 case CTelephony::EIdServiceActiveDefaultRestricted: |
|
106 case CTelephony::EIdServiceNotProvisioned: |
|
107 case CTelephony::EIdServiceUnknown: |
|
108 iConsole->Printf(_L("Incoming Caller's number NOT Displayed\n")); |
|
109 break; |
|
110 } |
|
111 } |
|
112 ExampleComplete(); |
|
113 } |
|
114 |
|
115 /** |
|
116 Cancels the asynchronous request to CTelephony::GetIdentityServiceStatus(). |
|
117 */ |
|
118 void CIdentityServiceStatus::DoCancel() |
|
119 { |
|
120 // Cancels an outstanding asynchronous request. |
|
121 iTelephony->CancelAsync(CTelephony::EGetIdentityServiceStatusCancel); |
|
122 } |