|
1 /** |
|
2 * Copyright (c) 2010 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: CUpnpIconConversionActive class implementation. |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "upnpiconconversionactive.h" |
|
19 #include "OstTraceDefinitions.h" |
|
20 #ifdef OST_TRACE_COMPILER_IN_USE |
|
21 #include "upnpiconconversionactiveTraces.h" |
|
22 #endif |
|
23 |
|
24 // Literal |
|
25 _LIT8(KBmpMimeType, "image/bmp"); |
|
26 |
|
27 |
|
28 // ============================ MEMBER FUNCTIONS =================================== |
|
29 |
|
30 // --------------------------------------------------------------------------------- |
|
31 // CUpnpIconConversionActive::NewL |
|
32 // Two-phased constructor. |
|
33 // --------------------------------------------------------------------------------- |
|
34 // |
|
35 CUpnpIconConversionActive* CUpnpIconConversionActive::NewL( RFile& aBitmapFile ) |
|
36 { |
|
37 OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_NEWL_ENTRY ); |
|
38 CUpnpIconConversionActive* self = new (ELeave) CUpnpIconConversionActive( ); |
|
39 CleanupStack::PushL(self); |
|
40 self->ConstructL( aBitmapFile ); |
|
41 CleanupStack::Pop(self); |
|
42 return self; |
|
43 } |
|
44 |
|
45 // --------------------------------------------------------------------------------- |
|
46 // CUpnpIconConversionActive::CUpnpIconConversionActive |
|
47 // C++ default constructor can NOT contain any code, that might leave. |
|
48 // --------------------------------------------------------------------------------- |
|
49 // |
|
50 CUpnpIconConversionActive::CUpnpIconConversionActive( ) |
|
51 :CActive(EPriorityStandard) |
|
52 { |
|
53 OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_ENTRY ); |
|
54 CActiveScheduler::Add(this); |
|
55 OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_EXIT ); |
|
56 } |
|
57 |
|
58 // --------------------------------------------------------------------------------- |
|
59 // CUpnpIconConversionActive::ConstructL |
|
60 // Symbian 2nd phase constructor can leave. |
|
61 // --------------------------------------------------------------------------------- |
|
62 // |
|
63 void CUpnpIconConversionActive::ConstructL( RFile& aBitmapFile ) |
|
64 { |
|
65 OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_CONSTRUCTL_ENTRY ); |
|
66 // Provides access to the ICL (image conversion library) encoders. |
|
67 iEncoder = CImageEncoder::FileNewL( aBitmapFile,KBmpMimeType()); |
|
68 OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_CONSTRUCTL_EXIT ); |
|
69 } |
|
70 |
|
71 // --------------------------------------------------------------------------------- |
|
72 // CUpnpIconConversionActive::~CUpnpIconConversionActive |
|
73 // Destructor |
|
74 // --------------------------------------------------------------------------------- |
|
75 // |
|
76 CUpnpIconConversionActive::~CUpnpIconConversionActive() |
|
77 { |
|
78 OstTraceFunctionEntry0( DUP1_CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_ENTRY ); |
|
79 Cancel(); |
|
80 delete iEncoder; |
|
81 OstTraceFunctionExit0( DUP1_CUPNPICONCONVERSIONACTIVE_CUPNPICONCONVERSIONACTIVE_EXIT ); |
|
82 } |
|
83 |
|
84 // --------------------------------------------------------------------------------- |
|
85 // CUpnpIconConversionActive::Convert |
|
86 // Place where actual image conversion is invoked. |
|
87 // Its an asynchronous conversion. |
|
88 // @param aBitmap Reference to Bitmap object |
|
89 // --------------------------------------------------------------------------------- |
|
90 // |
|
91 void CUpnpIconConversionActive::Convert( CFbsBitmap& aBitmap ) |
|
92 { |
|
93 OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_CONVERT_ENTRY ); |
|
94 TRequestStatus* status = &iStatus; |
|
95 // Converts image data held in CFbsBitmap object |
|
96 iEncoder->Convert( status,aBitmap); //Actual conversion API |
|
97 SetActive(); |
|
98 OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_CONVERT_EXIT ); |
|
99 } |
|
100 |
|
101 // --------------------------------------------------------------------------------- |
|
102 // CUpnpIconConversionActive::RunL |
|
103 // Event handler. Stops the active scheduler. |
|
104 // --------------------------------------------------------------------------------- |
|
105 // |
|
106 void CUpnpIconConversionActive::RunL() |
|
107 { |
|
108 OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_RUNL_ENTRY ); |
|
109 CActiveScheduler::Stop(); |
|
110 OstTraceFunctionExit0( CUPNPICONCONVERSIONACTIVE_RUNL_EXIT ); |
|
111 } |
|
112 |
|
113 // --------------------------------------------------------------------------------- |
|
114 // CUpnpIconConversionActive::DoCancel |
|
115 // --------------------------------------------------------------------------------- |
|
116 // |
|
117 void CUpnpIconConversionActive::DoCancel() |
|
118 { |
|
119 |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------------- |
|
123 // CUpnpIconConversionActive::FetchError |
|
124 // Returns the completion status. |
|
125 // @return Returns completion code. |
|
126 // --------------------------------------------------------------------------------- |
|
127 // |
|
128 TInt CUpnpIconConversionActive::FetchError() |
|
129 { |
|
130 OstTraceFunctionEntry0( CUPNPICONCONVERSIONACTIVE_FETCHERROR_ENTRY ); |
|
131 return ( iStatus.Int() ); |
|
132 } |