|
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: Source file for CUpnpTask base class. |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 // INCLUDE FILES |
|
20 // upnpframework / command api |
|
21 #include "upnpcommand.h" |
|
22 #include "upnpcommandcallback.h" |
|
23 |
|
24 // command internal |
|
25 #include "upnptask.h" |
|
26 #include "upnptaskhandler.h" |
|
27 #include "upnpcommandparameters.h" |
|
28 #include "upnpfilepipe.h" |
|
29 #include "upnpnotehandler.h" |
|
30 |
|
31 _LIT( KComponentLogfile, "upnpcommand.log"); |
|
32 #include "upnplog.h" |
|
33 |
|
34 |
|
35 |
|
36 // -------------------------------------------------------------------------- |
|
37 // CUpnpTask::CUpnpTask |
|
38 // First phase construction. |
|
39 // -------------------------------------------------------------------------- |
|
40 // |
|
41 CUpnpTask::CUpnpTask() |
|
42 { |
|
43 } |
|
44 |
|
45 // -------------------------------------------------------------------------- |
|
46 // Destructor. |
|
47 // -------------------------------------------------------------------------- |
|
48 // |
|
49 CUpnpTask::~CUpnpTask() |
|
50 { |
|
51 } |
|
52 |
|
53 // -------------------------------------------------------------------------- |
|
54 // CUpnpTask::CommandEvent |
|
55 // Notifies the client of an asynchronous command related event |
|
56 // -------------------------------------------------------------------------- |
|
57 void CUpnpTask::CommandEvent( |
|
58 UpnpCommand::TUpnpCommandEvent aEventType, |
|
59 TInt aStatus, |
|
60 TBool aKillTask ) |
|
61 { |
|
62 __ASSERTD( iParameters!=0, __FILE__, __LINE__ ); |
|
63 |
|
64 // the callback interface |
|
65 MUpnpCommandCallback* callback = NULL; |
|
66 if( iParameters && |
|
67 iParameters->Observer() ) |
|
68 { |
|
69 callback = iParameters->Observer(); |
|
70 } |
|
71 |
|
72 // kill the task if instructed |
|
73 if ( aKillTask ) |
|
74 { |
|
75 TaskHandler()->DestroyTask(); |
|
76 } |
|
77 |
|
78 // notify |
|
79 if ( callback ) |
|
80 { |
|
81 callback->CommandEvent( aEventType, aStatus ); |
|
82 } |
|
83 } |
|
84 |
|
85 // -------------------------------------------------------------------------- |
|
86 // CUpnpTask::SetTaskHandlerL |
|
87 // Sets the pointer to the task handler. |
|
88 // -------------------------------------------------------------------------- |
|
89 void CUpnpTask::SetTaskHandlerL( MUpnpTaskHandler* aTaskHandler ) |
|
90 { |
|
91 // Check parameter |
|
92 if( !aTaskHandler ) |
|
93 { |
|
94 User::Leave( KErrArgument ); |
|
95 } |
|
96 |
|
97 iTaskHandler = aTaskHandler; |
|
98 } |
|
99 |
|
100 // -------------------------------------------------------------------------- |
|
101 // CUpnpTask::TaskHandler |
|
102 // Returns the pointer to the task handler. |
|
103 // -------------------------------------------------------------------------- |
|
104 MUpnpTaskHandler* CUpnpTask::TaskHandler() |
|
105 { |
|
106 return iTaskHandler; |
|
107 } |
|
108 |
|
109 // -------------------------------------------------------------------------- |
|
110 // CUpnpTask::SetCommandParametersL |
|
111 // Sets the pointer to the parameters. |
|
112 // -------------------------------------------------------------------------- |
|
113 void CUpnpTask::SetCommandParametersL( CUpnpCommandParameters* aParameters ) |
|
114 { |
|
115 // Check parameter |
|
116 if( !aParameters ) |
|
117 { |
|
118 User::Leave( KErrArgument ); |
|
119 } |
|
120 |
|
121 iParameters = aParameters; |
|
122 } |
|
123 |
|
124 // -------------------------------------------------------------------------- |
|
125 // CUpnpTask::CommandParameters |
|
126 // Returns the pointer to the parameters. |
|
127 // -------------------------------------------------------------------------- |
|
128 CUpnpCommandParameters* CUpnpTask::CommandParameters() |
|
129 { |
|
130 return iParameters; |
|
131 } |
|
132 |
|
133 // -------------------------------------------------------------------------- |
|
134 // CUpnpTask::SetFilePipeL |
|
135 // Sets the pointer to the file pipe. |
|
136 // -------------------------------------------------------------------------- |
|
137 void CUpnpTask::SetFilePipeL( CUpnpFilePipe* aFilePipe ) |
|
138 { |
|
139 // Check parameter |
|
140 if( !aFilePipe ) |
|
141 { |
|
142 User::Leave( KErrArgument ); |
|
143 } |
|
144 |
|
145 iFilePipe = aFilePipe; |
|
146 } |
|
147 |
|
148 // -------------------------------------------------------------------------- |
|
149 // CUpnpTask::FilePipeL |
|
150 // Returns the pointer to the file pipe. |
|
151 // -------------------------------------------------------------------------- |
|
152 CUpnpFilePipe* CUpnpTask::FilePipe() |
|
153 { |
|
154 return iFilePipe; |
|
155 } |
|
156 |
|
157 // -------------------------------------------------------------------------- |
|
158 // CUpnpTask::SetNoteHandlerL |
|
159 // Sets the pointer to the note handler. |
|
160 // -------------------------------------------------------------------------- |
|
161 void CUpnpTask::SetNoteHandlerL( CUpnpNoteHandler* aNoteHandler ) |
|
162 { |
|
163 // Check parameter |
|
164 if( !aNoteHandler ) |
|
165 { |
|
166 User::Leave( KErrArgument ); |
|
167 } |
|
168 |
|
169 iNoteHandler = aNoteHandler; |
|
170 } |
|
171 |
|
172 // -------------------------------------------------------------------------- |
|
173 // CUpnpTask::NoteHandler |
|
174 // Returns the pointer to the note handler. |
|
175 // -------------------------------------------------------------------------- |
|
176 CUpnpNoteHandler* CUpnpTask::NoteHandler() |
|
177 { |
|
178 return iNoteHandler; |
|
179 } |
|
180 |
|
181 |
|
182 |
|
183 |
|
184 // End of File |