|
1 /* |
|
2 * Copyright (c) 2002-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: Request Notification parameters |
|
15 * |
|
16 * |
|
17 */ |
|
18 |
|
19 #include "hspsdefinitionrepository.h" |
|
20 #include "hspsreqnotifparam.h" |
|
21 |
|
22 #include <s32mem.h> |
|
23 |
|
24 // ============================ MEMBER FUNCTIONS =============================== |
|
25 |
|
26 // ----------------------------------------------------------------------------- |
|
27 // ChspsRequestNotificationParams::ChspsRequestNotificationParams() |
|
28 // C++ default constructor can NOT contain any code, that |
|
29 // might leave. |
|
30 // ----------------------------------------------------------------------------- |
|
31 // |
|
32 ChspsRequestNotificationParams::ChspsRequestNotificationParams() |
|
33 { |
|
34 } |
|
35 |
|
36 // ----------------------------------------------------------------------------- |
|
37 // ChspsRequestNotificationParams::ConstructL() |
|
38 // Symbian 2nd phase constructor can leave. |
|
39 // ----------------------------------------------------------------------------- |
|
40 // |
|
41 void ChspsRequestNotificationParams::ConstructL() |
|
42 { |
|
43 ResetData(); |
|
44 } |
|
45 |
|
46 // ----------------------------------------------------------------------------- |
|
47 // ChspsRequestNotificationParams::NewL() |
|
48 // Two-phased constructor. |
|
49 // ----------------------------------------------------------------------------- |
|
50 // |
|
51 EXPORT_C ChspsRequestNotificationParams* ChspsRequestNotificationParams::NewL() |
|
52 { |
|
53 ChspsRequestNotificationParams* self = new( ELeave ) ChspsRequestNotificationParams; |
|
54 |
|
55 CleanupStack::PushL( self ); |
|
56 self->ConstructL(); |
|
57 CleanupStack::Pop(); |
|
58 |
|
59 return self; |
|
60 } |
|
61 |
|
62 // Destructor |
|
63 ChspsRequestNotificationParams::~ChspsRequestNotificationParams() |
|
64 { |
|
65 iPluginIds.Close(); |
|
66 delete iName; |
|
67 } |
|
68 |
|
69 // ----------------------------------------------------------------------------- |
|
70 // ChspsRequestNotificationParams::ExternalizeL |
|
71 // (other items were commented in a header). |
|
72 // ----------------------------------------------------------------------------- |
|
73 // |
|
74 EXPORT_C void ChspsRequestNotificationParams::ExternalizeL( RDesWriteStream& aStream ) const |
|
75 { |
|
76 aStream.WriteUint32L( (TUint)iEvent ); |
|
77 aStream.WriteUint32L( (TUint)iAppUid ); |
|
78 aStream.WriteUint32L( (TUint)iAppConfUid ); |
|
79 aStream.WriteUint32L( (TUint)iOrigUid ); |
|
80 aStream.WriteUint32L( (TUint)iPluginUid ); |
|
81 aStream.WriteUint32L( (TUint)iCount ); |
|
82 |
|
83 for(TInt i =0; i < iCount; i++) |
|
84 { |
|
85 aStream.WriteUint32L( (TUint)iPluginIds[i] ); |
|
86 } |
|
87 |
|
88 if ( iName ) |
|
89 { |
|
90 aStream << *iName; |
|
91 } |
|
92 else |
|
93 { |
|
94 aStream << KNullDesC; |
|
95 } |
|
96 } |
|
97 |
|
98 // ----------------------------------------------------------------------------- |
|
99 // ChspsRequestNotificationParams::InternalizeL |
|
100 // (other items were commented in a header). |
|
101 // ----------------------------------------------------------------------------- |
|
102 // |
|
103 EXPORT_C void ChspsRequestNotificationParams::InternalizeL( RDesReadStream& aStream ) |
|
104 { |
|
105 iEvent = (TInt)aStream.ReadUint32L(); |
|
106 iAppUid = (TInt)aStream.ReadUint32L(); |
|
107 iAppConfUid = (TInt)aStream.ReadUint32L(); |
|
108 iOrigUid = (TInt)aStream.ReadUint32L(); |
|
109 iPluginUid = (TInt)aStream.ReadUint32L(); |
|
110 iCount = (TInt)aStream.ReadUint32L(); |
|
111 iPluginIds.Reset(); |
|
112 for(TInt i=0; i < iCount; i++ ) |
|
113 { |
|
114 iPluginIds.AppendL((TInt)aStream.ReadUint32L()); |
|
115 } |
|
116 delete iName; |
|
117 iName = NULL; |
|
118 iName = HBufC::NewL(aStream, KMaxFileName ); |
|
119 } |
|
120 |
|
121 // ----------------------------------------------------------------------------- |
|
122 // ChspsRequestNotificationParams::GetDataLength() |
|
123 // Returns data length of ChspsRequestNotificationParams-object for streamin functions. |
|
124 // (other items were commented in a header). |
|
125 // ----------------------------------------------------------------------------- |
|
126 // |
|
127 EXPORT_C TInt ChspsRequestNotificationParams::GetDataLength() const |
|
128 { |
|
129 TInt len = sizeof( iEvent ); |
|
130 len += sizeof(iAppUid); |
|
131 len += sizeof(iAppConfUid); |
|
132 len += sizeof(iPluginUid); |
|
133 len += sizeof(iCount); |
|
134 for(TInt i = 0; i < 0; i++) |
|
135 { |
|
136 len += sizeof(iPluginIds[i]); |
|
137 } |
|
138 |
|
139 |
|
140 if(iName) |
|
141 { |
|
142 len += KMaxFileName; |
|
143 } |
|
144 return len; |
|
145 } |
|
146 |
|
147 // ----------------------------------------------------------------------------- |
|
148 // ChspsRequestNotificationParams::ResetData() |
|
149 // Resets ChspsRequestNotificationParams's data members. |
|
150 // (other items were commented in a header). |
|
151 // ----------------------------------------------------------------------------- |
|
152 // |
|
153 EXPORT_C void ChspsRequestNotificationParams::ResetData() |
|
154 { |
|
155 iEvent = EhspsNoEvent; |
|
156 iAppUid = 0; |
|
157 iAppConfUid = 0; |
|
158 iOrigUid = 0; |
|
159 iPluginUid = 0; |
|
160 iCount = 0; |
|
161 iPluginIds.Reset(); |
|
162 delete iName; |
|
163 iName = NULL; |
|
164 } |
|
165 // ----------------------------------------------------------------------------- |
|
166 // ChspsRequestNotificationParams::SetNameL |
|
167 // Set Name |
|
168 // (other items were commented in a header). |
|
169 // ----------------------------------------------------------------------------- |
|
170 EXPORT_C void ChspsRequestNotificationParams::SetNameL( const TDesC& aName ) |
|
171 { |
|
172 delete iName; |
|
173 iName = NULL; |
|
174 iName = aName.AllocL(); |
|
175 } |
|
176 |
|
177 // ----------------------------------------------------------------------------- |
|
178 // ChspsRequestNotificationParams::Name() |
|
179 // Get Name |
|
180 // (other items were commented in a header). |
|
181 // ----------------------------------------------------------------------------- |
|
182 EXPORT_C const TDesC& ChspsRequestNotificationParams::Name() const |
|
183 { |
|
184 if ( iName ) |
|
185 { |
|
186 return *iName; |
|
187 } |
|
188 else |
|
189 { |
|
190 return KNullDesC; |
|
191 } |
|
192 } |
|
193 |
|
194 // End of File |