31
|
1 |
/*
|
|
2 |
* Copyright (c) 2006 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 the License "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: Factory for creating branding
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
// INCLUDE FILES
|
|
20 |
#include "cbsfactory.h"
|
|
21 |
#include "cbsaccess.h"
|
|
22 |
#include "cbsupdater.h"
|
|
23 |
#include "mbsaccess.h"
|
|
24 |
#include "mbsupdater.h"
|
|
25 |
#include "cbsclient.h"
|
|
26 |
#include "DebugTrace.h"
|
|
27 |
|
|
28 |
// ============================ MEMBER FUNCTIONS ===============================
|
|
29 |
|
|
30 |
// -----------------------------------------------------------------------------
|
|
31 |
// BrandingFactory::NewL
|
|
32 |
// Two-phased constructor.
|
|
33 |
// -----------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
EXPORT_C CBSFactory* CBSFactory::NewL( const TDesC8& aDefaultBrandId,
|
|
36 |
const TDesC8& aApplicationId )
|
|
37 |
{
|
|
38 |
TRACE( T_LIT("CBSFactory::NewL begin") );
|
|
39 |
CBSFactory* self = new ( ELeave ) CBSFactory() ;
|
|
40 |
CleanupStack::PushL( self );
|
|
41 |
self->ConstructL( aDefaultBrandId, aApplicationId );
|
|
42 |
CleanupStack::Pop( self ); //self
|
|
43 |
TRACE( T_LIT("CBSFactory::NewL end") );
|
|
44 |
return self;
|
|
45 |
}
|
|
46 |
|
|
47 |
|
|
48 |
// C++ default constructor can NOT contain any code, that
|
|
49 |
// might leave.
|
|
50 |
//
|
|
51 |
CBSFactory::CBSFactory()
|
|
52 |
{
|
|
53 |
}
|
|
54 |
|
|
55 |
// destructor
|
|
56 |
CBSFactory::~CBSFactory()
|
|
57 |
{
|
|
58 |
delete iDefaultBrand;
|
|
59 |
delete iApplicationId;
|
|
60 |
if( iServerKeepAlive )
|
|
61 |
{
|
|
62 |
iServerKeepAlive->Close();
|
|
63 |
}
|
|
64 |
delete iServerKeepAlive;
|
|
65 |
}
|
|
66 |
|
|
67 |
// Symbian OS default constructor can leave.
|
|
68 |
void CBSFactory::ConstructL( const TDesC8& aDefaultBrandId,
|
|
69 |
const TDesC8& aApplicationId )
|
|
70 |
{
|
|
71 |
iDefaultBrand = aDefaultBrandId.AllocL();
|
|
72 |
iApplicationId = aApplicationId.AllocL();
|
|
73 |
iServerKeepAlive = new(ELeave) RBSClient(); // CSI: 74 # this needs to be like this
|
|
74 |
User::LeaveIfError( iServerKeepAlive->Connect() );
|
|
75 |
}
|
|
76 |
|
|
77 |
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
// CBSFactory::CreateAccessL()
|
|
80 |
// -----------------------------------------------------------------------------
|
|
81 |
//
|
|
82 |
EXPORT_C MBSAccess* CBSFactory::CreateAccessL( const TDesC8& aBrandId,
|
|
83 |
TLanguage aLanguageId,
|
|
84 |
TBool aCacheData, /* = EFalse */
|
|
85 |
TInt aReserved /*= 0*/ )
|
|
86 |
{
|
|
87 |
TRACE( T_LIT("CBSFactory::CreateAccessL begin") );
|
|
88 |
CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand,
|
|
89 |
aLanguageId, aCacheData, aReserved );
|
|
90 |
TRACE( T_LIT("CBSFactory::CreateAccessL end") );
|
|
91 |
return access;
|
|
92 |
}
|
|
93 |
|
|
94 |
// -----------------------------------------------------------------------------
|
|
95 |
// CBSFactory::CreateAccessL()
|
|
96 |
// -----------------------------------------------------------------------------
|
|
97 |
//
|
|
98 |
EXPORT_C MBSAccess* CBSFactory::CreateAccessLC( const TDesC8& aBrandId,
|
|
99 |
TLanguage aLanguageId,
|
|
100 |
TBool aCacheData, /* = EFalse */
|
|
101 |
TInt aReserved /*= 0 */)
|
|
102 |
{
|
|
103 |
CBSAccess* access = CBSAccess::NewL( aBrandId, *iApplicationId, *iDefaultBrand,
|
|
104 |
aLanguageId, aCacheData, aReserved );
|
|
105 |
CleanupClosePushL( *access );
|
|
106 |
return access;
|
|
107 |
}
|
|
108 |
|
|
109 |
// -----------------------------------------------------------------------------
|
|
110 |
// CBSFactory::CreateUpdaterL()
|
|
111 |
// -----------------------------------------------------------------------------
|
|
112 |
//
|
|
113 |
EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterL()
|
|
114 |
{
|
|
115 |
CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId );
|
|
116 |
return updater;
|
|
117 |
}
|
|
118 |
|
|
119 |
// -----------------------------------------------------------------------------
|
|
120 |
// CBSFactory::CreateUpdaterLC()
|
|
121 |
// -----------------------------------------------------------------------------
|
|
122 |
//
|
|
123 |
EXPORT_C MBSUpdater* CBSFactory::CreateUpdaterLC()
|
|
124 |
{
|
|
125 |
CBSUpdater* updater = CBSUpdater::NewL( *iApplicationId );
|
|
126 |
CleanupClosePushL( *updater );
|
|
127 |
return updater;
|
|
128 |
}
|
|
129 |
|
|
130 |
// End of File
|
|
131 |
|