1 /* |
|
2 * Copyright (c) 2006-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: obexservicemanager client request class implementation |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 |
|
20 #include "ObexSMPlugin.h" |
|
21 #include "ObexSMRequester.h" |
|
22 #include "obexsmclient.h" |
|
23 #include "debug.h" |
|
24 |
|
25 // ======== MEMBER FUNCTIONS ======== |
|
26 |
|
27 // --------------------------------------------------------------------------- |
|
28 // NewL |
|
29 // --------------------------------------------------------------------------- |
|
30 // |
|
31 CObexSMRequester* CObexSMRequester::NewL(MObexSMRequestObserver* aObserver, TLocodBearer aBearer, TBool aStatus) |
|
32 { |
|
33 TRACE_FUNC |
|
34 CObexSMRequester* self = CObexSMRequester::NewLC(aObserver, aBearer,aStatus); |
|
35 CleanupStack::Pop( self ); |
|
36 return self; |
|
37 } |
|
38 |
|
39 // --------------------------------------------------------------------------- |
|
40 // NewLC |
|
41 // --------------------------------------------------------------------------- |
|
42 // |
|
43 CObexSMRequester* CObexSMRequester::NewLC(MObexSMRequestObserver* aObserver, TLocodBearer aBearer, TBool aStatus) |
|
44 { |
|
45 TRACE_FUNC |
|
46 CObexSMRequester* self = new( ELeave ) CObexSMRequester(aObserver,aBearer,aStatus); |
|
47 CleanupStack::PushL( self ); |
|
48 self->ConstructL(); |
|
49 return self; |
|
50 } |
|
51 |
|
52 // --------------------------------------------------------------------------- |
|
53 // destructor |
|
54 // --------------------------------------------------------------------------- |
|
55 // |
|
56 CObexSMRequester::~CObexSMRequester() |
|
57 { |
|
58 TRACE_FUNC |
|
59 Cancel(); |
|
60 } |
|
61 |
|
62 |
|
63 // --------------------------------------------------------------------------- |
|
64 // DoCancel |
|
65 // --------------------------------------------------------------------------- |
|
66 // |
|
67 void CObexSMRequester::DoCancel() |
|
68 { |
|
69 |
|
70 } |
|
71 // --------------------------------------------------------------------------- |
|
72 // RunL |
|
73 // --------------------------------------------------------------------------- |
|
74 // |
|
75 void CObexSMRequester::RunL() |
|
76 { |
|
77 TRACE_FUNC |
|
78 iObserver->RequestComplete(this,iStatus.Int()); |
|
79 } |
|
80 // --------------------------------------------------------------------------- |
|
81 // RunError |
|
82 // --------------------------------------------------------------------------- |
|
83 // |
|
84 TInt CObexSMRequester::RunError( TInt aError ) |
|
85 { |
|
86 TRACE_FUNC |
|
87 iObserver->RequestComplete(this,aError); |
|
88 return KErrNone; |
|
89 } |
|
90 // --------------------------------------------------------------------------- |
|
91 // ActivateRequest |
|
92 // --------------------------------------------------------------------------- |
|
93 // |
|
94 void CObexSMRequester::ActivateRequest() |
|
95 { |
|
96 TRACE_FUNC_ENTRY |
|
97 TInt err; |
|
98 RObexSMServer smServer; |
|
99 if(iObserver) |
|
100 { |
|
101 smServer=iObserver->GetServer(); |
|
102 iStatus = KRequestPending; |
|
103 err=smServer.ManageServices(iBearer, iBearStatus, iStatus ); |
|
104 if(err==KErrNone) |
|
105 { |
|
106 SetActive(); |
|
107 } |
|
108 else |
|
109 { |
|
110 iObserver->RequestComplete(this,err); |
|
111 } |
|
112 } |
|
113 TRACE_FUNC_EXIT |
|
114 } |
|
115 // --------------------------------------------------------------------------- |
|
116 // CObexSMRequester |
|
117 // --------------------------------------------------------------------------- |
|
118 // |
|
119 CObexSMRequester::CObexSMRequester(MObexSMRequestObserver* aObserver, |
|
120 TLocodBearer aBearer, TBool aBearStatus) |
|
121 : CActive(EPriorityStandard), |
|
122 iObserver(aObserver), |
|
123 iBearer(aBearer), |
|
124 iBearStatus(aBearStatus) |
|
125 { |
|
126 TRACE_FUNC |
|
127 CActiveScheduler::Add( this ); |
|
128 } |
|
129 |
|
130 |
|
131 // --------------------------------------------------------------------------- |
|
132 // ConstructL |
|
133 // --------------------------------------------------------------------------- |
|
134 // |
|
135 void CObexSMRequester::ConstructL() |
|
136 { |
|
137 TRACE_FUNC |
|
138 } |
|
139 |
|
140 // --------------------------------------------------------------------------- |
|
141 // GetStatus |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 TBool CObexSMRequester::GetStatus() |
|
145 { |
|
146 return iBearStatus; |
|
147 } |
|
148 |
|
149 // --------------------------------------------------------------------------- |
|
150 // GetBearer |
|
151 // --------------------------------------------------------------------------- |
|
152 // |
|
153 TLocodBearer CObexSMRequester::GetBearer() |
|
154 { |
|
155 return iBearer; |
|
156 } |
|
157 //End of file |
|
158 |
|
159 |
|
160 |
|