28
|
1 |
/*
|
|
2 |
* Copyright (c) 2007-2010 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:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
#include <e32base.h>
|
|
20 |
#include <crcseprofileregistry.h>
|
|
21 |
|
|
22 |
#include "cscsvcpluginlogger.h"
|
|
23 |
#include "cscsvcpluginrcsehandler.h"
|
|
24 |
|
|
25 |
|
|
26 |
// ======== MEMBER FUNCTIONS ========
|
|
27 |
|
|
28 |
|
|
29 |
// ---------------------------------------------------------------------------
|
|
30 |
// ---------------------------------------------------------------------------
|
|
31 |
//
|
|
32 |
CCSCSvcPluginRcseHandler::CCSCSvcPluginRcseHandler()
|
|
33 |
{
|
|
34 |
}
|
|
35 |
|
|
36 |
|
|
37 |
// ---------------------------------------------------------------------------
|
|
38 |
// ---------------------------------------------------------------------------
|
|
39 |
//
|
|
40 |
void CCSCSvcPluginRcseHandler::ConstructL()
|
|
41 |
{
|
|
42 |
CSCSVCPLUGINDEBUG("CCSCSvcPluginRcseHandler::ConstructL - begin");
|
|
43 |
|
|
44 |
iRcseProfileRegistry = CRCSEProfileRegistry::NewL();
|
|
45 |
|
|
46 |
CSCSVCPLUGINDEBUG("CCSCSvcPluginRcseHandler::ConstructL - end");
|
|
47 |
}
|
|
48 |
|
|
49 |
|
|
50 |
// ---------------------------------------------------------------------------
|
|
51 |
// ---------------------------------------------------------------------------
|
|
52 |
//
|
|
53 |
CCSCSvcPluginRcseHandler* CCSCSvcPluginRcseHandler::NewL()
|
|
54 |
{
|
|
55 |
CCSCSvcPluginRcseHandler* self =
|
|
56 |
new ( ELeave ) CCSCSvcPluginRcseHandler();
|
|
57 |
CleanupStack::PushL( self );
|
|
58 |
self->ConstructL();
|
|
59 |
CleanupStack::Pop( self );
|
|
60 |
return self;
|
|
61 |
}
|
|
62 |
|
|
63 |
|
|
64 |
// ---------------------------------------------------------------------------
|
|
65 |
// ---------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
CCSCSvcPluginRcseHandler::~CCSCSvcPluginRcseHandler()
|
|
68 |
{
|
|
69 |
CSCSVCPLUGINDEBUG(
|
|
70 |
"CCSCSvcPluginRcseHandler::~CCSCSvcPluginRcseHandler - begin");
|
|
71 |
|
|
72 |
delete iRcseProfileRegistry;
|
|
73 |
|
|
74 |
CSCSVCPLUGINDEBUG(
|
|
75 |
"CCSCSvcPluginRcseHandler::~CCSCSvcPluginRcseHandler - end");
|
|
76 |
}
|
|
77 |
|
|
78 |
|
|
79 |
// ---------------------------------------------------------------------------
|
|
80 |
// Returns VoIP profile id for corresponding EasyVoIP plugin.
|
|
81 |
// Also returns SIP profile reference ids if any
|
|
82 |
// was found from VoIP profile entry.
|
|
83 |
// ---------------------------------------------------------------------------
|
|
84 |
//
|
|
85 |
void CCSCSvcPluginRcseHandler::GetProfileIdsL(
|
|
86 |
TUint32 aServiceId,
|
|
87 |
TUint32& aProfileId,
|
|
88 |
RArray<TUint32>& aSipProfileIds )
|
|
89 |
{
|
|
90 |
CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::GetProfileIdsL - begin");
|
|
91 |
|
|
92 |
CleanupClosePushL( aSipProfileIds );
|
|
93 |
|
|
94 |
RPointerArray<CRCSEProfileEntry> entries;
|
|
95 |
TCleanupItem clItem( ResetAndDestroy, &entries );
|
|
96 |
CleanupStack::PushL( clItem );
|
|
97 |
|
|
98 |
// Get VoIP setting id
|
|
99 |
iRcseProfileRegistry->FindByServiceIdL( aServiceId, entries );
|
|
100 |
|
|
101 |
if ( entries.Count() )
|
|
102 |
{
|
|
103 |
aProfileId = entries[ 0 ]->iId;
|
|
104 |
|
|
105 |
// Check profile for SIP references and append ids to array.
|
|
106 |
for ( TInt j = 0; j < entries[ 0 ]->iIds.Count(); j++ )
|
|
107 |
{
|
|
108 |
TUint32 id = entries[ 0 ]->iIds[ j ].iProfileId;
|
|
109 |
User::LeaveIfError( aSipProfileIds.Append( id ) );
|
|
110 |
}
|
|
111 |
}
|
|
112 |
else
|
|
113 |
{
|
|
114 |
User::Leave( KErrNotFound );
|
|
115 |
}
|
|
116 |
|
|
117 |
CleanupStack::PopAndDestroy(); // clItem
|
|
118 |
CleanupStack::Pop();
|
|
119 |
|
|
120 |
CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::GetProfileIdsL - end");
|
|
121 |
}
|
|
122 |
|
|
123 |
|
|
124 |
// ---------------------------------------------------------------------------
|
|
125 |
// Destroys VoIP profile from RCSE based on VoIP profile id.
|
|
126 |
// ---------------------------------------------------------------------------
|
|
127 |
//
|
|
128 |
void CCSCSvcPluginRcseHandler::RemoveProfileL(
|
|
129 |
TUint32 aProfileId )
|
|
130 |
{
|
|
131 |
CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::RemoveProfileL - begin");
|
|
132 |
|
|
133 |
// Destroy VoIP profile from RCSE.
|
|
134 |
CRCSEProfileEntry* entry = CRCSEProfileEntry::NewLC();
|
|
135 |
iRcseProfileRegistry->FindL( aProfileId, *entry );
|
|
136 |
iRcseProfileRegistry->DeleteL( aProfileId );
|
|
137 |
CleanupStack::PopAndDestroy( entry );
|
|
138 |
|
|
139 |
CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::RemoveProfileL - end");
|
|
140 |
}
|
|
141 |
|
|
142 |
|
|
143 |
// ---------------------------------------------------------------------------
|
|
144 |
// For deleting RPointerArray in case of leave
|
|
145 |
// ---------------------------------------------------------------------------
|
|
146 |
//
|
|
147 |
void CCSCSvcPluginRcseHandler::ResetAndDestroy( TAny* aPointerArray )
|
|
148 |
{
|
|
149 |
CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::ResetAndDestroy - begin");
|
|
150 |
|
|
151 |
if ( aPointerArray )
|
|
152 |
{
|
|
153 |
RPointerArray<CRCSEProfileEntry>* array =
|
|
154 |
static_cast<RPointerArray<CRCSEProfileEntry>*>( aPointerArray );
|
|
155 |
array->ResetAndDestroy();
|
|
156 |
array->Close();
|
|
157 |
}
|
|
158 |
|
|
159 |
CSCSVCPLUGINDEBUG( "CCSCSvcPluginRcseHandler::ResetAndDestroy - end");
|
|
160 |
}
|
|
161 |
|