24
|
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
|
|
46 |
iIdentityServiceStatusV1Pckg package.
|
|
47 |
*/
|
|
48 |
void CIdentityServiceStatus::DoStartRequestL()
|
|
49 |
{
|
|
50 |
_LIT(KDummyAnswerPanic, "CIdentityServiceStatus Get Method");
|
|
51 |
__ASSERT_ALWAYS(!IsActive(), User::Panic(KDummyAnswerPanic, 1));
|
|
52 |
iRequestNotify = EFalse;
|
|
53 |
CTelephony::TIdentityService condition = CTelephony::EIdServiceCallerPresentation;
|
|
54 |
|
|
55 |
// Interrogate the current status of the identity services.
|
|
56 |
iTelephony->GetIdentityServiceStatus(iStatus,
|
|
57 |
condition,
|
|
58 |
iIdentityServiceStatusV1Pckg);
|
|
59 |
SetActive();
|
|
60 |
}
|
|
61 |
|
|
62 |
/**
|
|
63 |
Constructor.
|
|
64 |
|
|
65 |
@param aController Pointer to an MExecAsync object passed to constructor of
|
|
66 |
CISVAPIBase
|
|
67 |
*/
|
|
68 |
CIdentityServiceStatus::CIdentityServiceStatus(MExecAsync* aController)
|
|
69 |
: CISVAPIAsync(aController, KIdentityServiceStatus),
|
|
70 |
iIdentityServiceStatusV1Pckg(iIdentityServiceStatusV1)
|
|
71 |
{
|
|
72 |
// Empty method
|
|
73 |
}
|
|
74 |
|
|
75 |
/**
|
|
76 |
Second phase constructor.
|
|
77 |
*/
|
|
78 |
void CIdentityServiceStatus::ConstructL()
|
|
79 |
{
|
|
80 |
// Empty method
|
|
81 |
}
|
|
82 |
|
|
83 |
/**
|
|
84 |
Checks the status of the active object and prints the identity service status
|
|
85 |
to the console if there is no error.
|
|
86 |
*/
|
|
87 |
void CIdentityServiceStatus::RunL()
|
|
88 |
{
|
|
89 |
if(iStatus != KErrNone)
|
|
90 |
{
|
|
91 |
iConsole->Printf(KError);
|
|
92 |
|
|
93 |
// Print the error status code
|
|
94 |
iConsole->Printf(_L("%d\n"), iStatus.Int());
|
|
95 |
}
|
|
96 |
else
|
|
97 |
{
|
|
98 |
// Print call identity service status.
|
|
99 |
iConsole->Printf(KIdentityServiceStatusMsg);
|
|
100 |
switch(iIdentityServiceStatusV1.iIdentityStatus)
|
|
101 |
{
|
|
102 |
case CTelephony::EIdServiceActivePermanent:
|
|
103 |
iConsole->Printf(_L("Provisioned and permanently active.\n"));
|
|
104 |
break;
|
|
105 |
case CTelephony::EIdServiceActiveDefaultRestricted:
|
|
106 |
iConsole->Printf(_L("Provisioned and active. By default, the number is restricted unless overridden by the user.\n"));
|
|
107 |
break;
|
|
108 |
case CTelephony::EIdServiceActiveDefaultAllowed :
|
|
109 |
iConsole->Printf(_L("Provisioned and active. By default, the number is displayed unless specifically restricted by the user.\n"));
|
|
110 |
break;
|
|
111 |
case CTelephony::EIdServiceNotProvisioned:
|
|
112 |
iConsole->Printf(_L("Not provisioned.\n"));
|
|
113 |
break;
|
|
114 |
case CTelephony::EIdServiceUnknown:
|
|
115 |
iConsole->Printf(_L("Unknown.\n"));
|
|
116 |
break;
|
|
117 |
}
|
|
118 |
}
|
|
119 |
ExampleComplete();
|
|
120 |
}
|
|
121 |
|
|
122 |
/**
|
|
123 |
Cancels the asynchronous request to CTelephony::GetIdentityServiceStatus().
|
|
124 |
*/
|
|
125 |
void CIdentityServiceStatus::DoCancel()
|
|
126 |
{
|
|
127 |
// Cancels an outstanding asynchronous request.
|
|
128 |
iTelephony->CancelAsync(CTelephony::EGetIdentityServiceStatusCancel);
|
|
129 |
}
|
|
130 |
|