|
1 /* |
|
2 * Copyright (c) 2007 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: Concrete search operation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include <ximpprotocolconnection.h> |
|
21 #include <protocolsearchfeature.h> |
|
22 #include <protocolsearch.h> |
|
23 #include "searchelementimp.h" |
|
24 #include "operationsearch.h" |
|
25 #include "ximpobjecthelpers.h" |
|
26 #include <ximprestrictedobjectcollection.h> |
|
27 #include "ximphost.h" |
|
28 |
|
29 #include <ximprequestcompleteevent.h> |
|
30 #include "protocolsearchdatahostimp.h" |
|
31 #include "searchlogutils.h" |
|
32 #include <badesca.h> |
|
33 |
|
34 #include <ximpidentityimp.h> |
|
35 |
|
36 // ======== MEMBER FUNCTIONS ======== |
|
37 |
|
38 // --------------------------------------------------------------------------- |
|
39 // COperationSearch::COperationSearch() |
|
40 // --------------------------------------------------------------------------- |
|
41 // |
|
42 EXPORT_C COperationSearch::COperationSearch() |
|
43 { |
|
44 } |
|
45 // --------------------------------------------------------------------------- |
|
46 // COperationSearch::ConstructL |
|
47 // --------------------------------------------------------------------------- |
|
48 // |
|
49 void COperationSearch::ConstructL( const TDesC8& aParamPck ) |
|
50 { |
|
51 XSearchLogger::Log(_L("COperationSearch::ConstructL Started")); |
|
52 |
|
53 RDesReadStream rs; |
|
54 CleanupClosePushL( rs ); |
|
55 rs.Open( aParamPck ); // CSI: 65 # |
|
56 |
|
57 |
|
58 iSearchId = CXIMPIdentityImp::NewLC(); |
|
59 CleanupStack::Pop( iSearchId ); |
|
60 iSearchId->InternalizeL( rs ); |
|
61 |
|
62 // read the object count |
|
63 TInt objCount( rs.ReadInt32L() ); |
|
64 |
|
65 for ( TInt count = 0; count < objCount; count++ ) |
|
66 { |
|
67 // instantiate new object |
|
68 CSearchElementImp* theObject = CSearchElementImp::NewLC(); |
|
69 // extract its data |
|
70 theObject->InternalizeL( rs ); |
|
71 // append it to the object array |
|
72 iSearchList.AppendL( theObject ); |
|
73 CleanupStack::Pop( theObject ); // theObject |
|
74 } |
|
75 |
|
76 iSearchLimit = rs.ReadInt32L(); |
|
77 CleanupStack::PopAndDestroy(); // rs |
|
78 |
|
79 |
|
80 XSearchLogger::Log(_L("COperationSearch::ConstructL Completed")); |
|
81 } |
|
82 |
|
83 // --------------------------------------------------------------------------- |
|
84 // COperationSearch::~COperationSearch() |
|
85 // --------------------------------------------------------------------------- |
|
86 // |
|
87 COperationSearch::~COperationSearch() |
|
88 { |
|
89 XSearchLogger::Log(_L("COperationSearch::~COperationSearch Started")); |
|
90 delete iSearchId; |
|
91 iSearchList.ResetAndDestroy(); |
|
92 XSearchLogger::Log(_L("COperationSearch::~COperationSearch Completed")); |
|
93 } |
|
94 |
|
95 |
|
96 // --------------------------------------------------------------------------- |
|
97 // COperationSearch::ProcessL() |
|
98 // --------------------------------------------------------------------------- |
|
99 // |
|
100 void COperationSearch::ProcessL() |
|
101 { |
|
102 XSearchLogger::Log(_L("COperationSearch::ProcessL Started")); |
|
103 CXIMPOperationBase::ProcessL(); |
|
104 // Call to Adaptation. |
|
105 MProtocolSearchFeature* srhFeature =static_cast< MProtocolSearchFeature*> |
|
106 (iMyHost->GetConnection().GetProtocolInterface(MProtocolSearchFeature::KInterfaceId)); |
|
107 if( srhFeature ) |
|
108 { |
|
109 srhFeature->Search().DoSearchL(*iSearchId, iSearchList,iSearchLimit,iReqId ); |
|
110 } |
|
111 else |
|
112 { |
|
113 User::Leave( KErrNotSupported ); // if NULL leave : not supported by protocol plugin |
|
114 } |
|
115 XSearchLogger::Log(_L("COperationSearch::ProcessL Completed")); |
|
116 } |
|
117 |
|
118 // --------------------------------------------------------------------------- |
|
119 // COperationSearch::RequestCompleted() |
|
120 // --------------------------------------------------------------------------- |
|
121 // |
|
122 void COperationSearch::RequestCompletedL() |
|
123 { |
|
124 XSearchLogger::Log(_L("COperationSearch::RequestCompletedL Started")); |
|
125 CXIMPOperationBase::RequestCompletedL(); |
|
126 XSearchLogger::Log(_L("COperationSearch::RequestCompletedL Completed")); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // COperationSearch::Type() |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 TInt COperationSearch::Type() const |
|
134 { |
|
135 return NSearchOps::ESearch; |
|
136 } |
|
137 |
|
138 |
|
139 // End of file |