|
1 /* |
|
2 * Copyright (c) 2004 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: CPEngNWSessionSlotStorageProxy |
|
15 * |
|
16 */ |
|
17 |
|
18 // INCLUDE FILES |
|
19 #include "CPEngNWSessionSlotStorageProxy.h" |
|
20 #include "MPEngStorageManager.h" |
|
21 #include "PEngStorageManager.h" |
|
22 #include "CPEngNWSessionSlotID2Imp.h" |
|
23 #include "CPEngSessionSlotId.h" |
|
24 |
|
25 |
|
26 #include <E32Std.h> |
|
27 #include <CPEngNWSessionSlotID2.h> |
|
28 #include <CPEngNWSessionSlotManager2.h> |
|
29 |
|
30 |
|
31 |
|
32 // ================= MEMBER FUNCTIONS ======================= |
|
33 |
|
34 |
|
35 // ----------------------------------------------------------------------------- |
|
36 // CPEngNWSessionSlotStorageProxy::NewL() |
|
37 // Two-phased constructor. |
|
38 // ----------------------------------------------------------------------------- |
|
39 // |
|
40 CPEngNWSessionSlotStorageProxy* CPEngNWSessionSlotStorageProxy::NewL( |
|
41 const CPEngNWSessionSlotID2& aNWSessionSlotID ) |
|
42 { |
|
43 CPEngNWSessionSlotStorageProxy* self = |
|
44 new ( ELeave ) CPEngNWSessionSlotStorageProxy; |
|
45 CleanupStack::PushL( self ); |
|
46 self->ConstructL( aNWSessionSlotID ); |
|
47 CleanupStack::Pop( self ); |
|
48 return self; |
|
49 } |
|
50 |
|
51 |
|
52 |
|
53 // C++ default constructor can NOT contain any code, that |
|
54 // might leave. |
|
55 // |
|
56 CPEngNWSessionSlotStorageProxy::CPEngNWSessionSlotStorageProxy() |
|
57 { |
|
58 } |
|
59 |
|
60 |
|
61 // Destructor |
|
62 CPEngNWSessionSlotStorageProxy::~CPEngNWSessionSlotStorageProxy() |
|
63 { |
|
64 if ( iStorageManager ) |
|
65 { |
|
66 iStorageManager->Close(); |
|
67 } |
|
68 |
|
69 delete iAppId; |
|
70 } |
|
71 |
|
72 |
|
73 // ----------------------------------------------------------------------------- |
|
74 // CPEngNWSessionSlotStorageProxy::ConstructL() |
|
75 // ----------------------------------------------------------------------------- |
|
76 // |
|
77 void CPEngNWSessionSlotStorageProxy::ConstructL( |
|
78 const CPEngNWSessionSlotID2& aNWSessionSlotID ) |
|
79 { |
|
80 //Verify that NWSessionSlot fully exists in the storage |
|
81 //(Storage manager doesn't care about AppId registration, but it can |
|
82 //be checked with CPEngNWSessionSlotManager2.) |
|
83 CPEngNWSessionSlotManager2* slotMan = CPEngNWSessionSlotManager2::NewLC(); |
|
84 User::LeaveIfError( slotMan->ExistsNWSessionSlot( aNWSessionSlotID ) ); |
|
85 CleanupStack::PopAndDestroy( slotMan ); |
|
86 |
|
87 const CPEngSessionSlotId& ssBaseId = aNWSessionSlotID.Implementation()->BasePart(); |
|
88 iStorageManager = PEngStorageManager::GetStorageManagerL( ssBaseId ); |
|
89 iAppId = aNWSessionSlotID.AppId().AllocL(); |
|
90 } |
|
91 |
|
92 |
|
93 // ----------------------------------------------------------------------------- |
|
94 // CPEngNWSessionSlotStorageProxy::StorageManager() |
|
95 // ----------------------------------------------------------------------------- |
|
96 // |
|
97 MPEngStorageManager& CPEngNWSessionSlotStorageProxy::StorageManager() |
|
98 { |
|
99 return *iStorageManager; |
|
100 } |
|
101 |
|
102 |
|
103 // ----------------------------------------------------------------------------- |
|
104 // CPEngNWSessionSlotStorageProxy::BaseId() |
|
105 // ----------------------------------------------------------------------------- |
|
106 // |
|
107 const CPEngSessionSlotId& CPEngNWSessionSlotStorageProxy::BaseId() const |
|
108 { |
|
109 return iStorageManager->SessionSlotId(); |
|
110 } |
|
111 |
|
112 |
|
113 // ----------------------------------------------------------------------------- |
|
114 // CPEngNWSessionSlotStorageProxy::AppId() |
|
115 // ----------------------------------------------------------------------------- |
|
116 // |
|
117 const TDesC16& CPEngNWSessionSlotStorageProxy::AppId() const |
|
118 { |
|
119 return *iAppId; |
|
120 } |
|
121 |
|
122 |
|
123 // End of File |
|
124 |