66
|
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: Implementation of VideoIadUpdateWrapper
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
// Version : %version:
|
|
19 |
|
|
20 |
#include <iaupdate.h>
|
|
21 |
#include <iaupdateparameters.h>
|
|
22 |
#include <iaupdateresult.h>
|
|
23 |
#include <featmgr.h>
|
|
24 |
|
|
25 |
#include "videoiadupdatewrapper.h"
|
|
26 |
#include "mpxvideo_debug.h"
|
|
27 |
|
|
28 |
const TUid KIadParamUid = { 0x200211FE }; // Uid from videoplayer.pkg
|
|
29 |
_LIT( KIadParamExec, "videoplayer.exe" ); // Executable of videoplayer
|
|
30 |
|
|
31 |
// -------------------------------------------------------------------------------------------------
|
|
32 |
// VideoIadUpdateWrapper::VideoIadUpdateWrapper()
|
|
33 |
// -------------------------------------------------------------------------------------------------
|
|
34 |
//
|
|
35 |
VideoIadUpdateWrapper::VideoIadUpdateWrapper() :
|
|
36 |
mUpdate(0),
|
|
37 |
mParameters(0)
|
|
38 |
{
|
|
39 |
MPX_DEBUG(_L("VideoIadUpdateWrapper::VideoIadUpdateWrapper()"));
|
|
40 |
}
|
|
41 |
|
|
42 |
// -------------------------------------------------------------------------------------------------
|
|
43 |
// VideoIadUpdateWrapper::~VideoIadUpdateWrapper()
|
|
44 |
// -------------------------------------------------------------------------------------------------
|
|
45 |
//
|
|
46 |
VideoIadUpdateWrapper::~VideoIadUpdateWrapper()
|
|
47 |
{
|
|
48 |
MPX_ENTER_EXIT(_L("VideoIadUpdateWrapper::~VideoIadUpdateWrapper()"));
|
|
49 |
cleanup();
|
|
50 |
}
|
|
51 |
|
|
52 |
// -------------------------------------------------------------------------------------------------
|
|
53 |
// VideoIadUpdateWrapper::checkForUpdates()
|
|
54 |
// -------------------------------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
void VideoIadUpdateWrapper::checkForUpdates()
|
|
57 |
{
|
|
58 |
MPX_ENTER_EXIT(_L("VideoIadUpdateWrapper::checkForUpdates()"));
|
|
59 |
|
|
60 |
TRAP_IGNORE( doCheckForUpdatesL() );
|
|
61 |
}
|
|
62 |
|
|
63 |
// -------------------------------------------------------------------------------------------------
|
|
64 |
// VideoIadUpdateWrapper::doCheckForUpdatesL()
|
|
65 |
// -------------------------------------------------------------------------------------------------
|
|
66 |
//
|
|
67 |
void VideoIadUpdateWrapper::doCheckForUpdatesL()
|
|
68 |
{
|
|
69 |
MPX_ENTER_EXIT(_L("VideoIadUpdateWrapper::doCheckForUpdatesL()"));
|
|
70 |
|
|
71 |
FeatureManager::InitializeLibL();
|
|
72 |
|
|
73 |
TBool isSupported = FeatureManager::FeatureSupported(KFeatureIdIAUpdate);
|
|
74 |
|
|
75 |
FeatureManager::UnInitializeLib();
|
|
76 |
|
|
77 |
if(isSupported)
|
|
78 |
{
|
|
79 |
if(!mUpdate)
|
|
80 |
{
|
|
81 |
mUpdate = CIAUpdate::NewL(*this);
|
|
82 |
}
|
|
83 |
if(!mParameters)
|
|
84 |
{
|
|
85 |
mParameters = CIAUpdateParameters::NewL();
|
|
86 |
}
|
|
87 |
|
|
88 |
mParameters->SetUid(KIadParamUid);
|
|
89 |
// We want Videos to be started after update is finished
|
|
90 |
mParameters->SetCommandLineExecutableL(KIadParamExec);
|
|
91 |
mParameters->SetShowProgress(EFalse);
|
|
92 |
|
|
93 |
// Check the updates
|
|
94 |
mUpdate->CheckUpdates(*mParameters);
|
|
95 |
}
|
|
96 |
else
|
|
97 |
{
|
|
98 |
MPX_DEBUG(_L("VideoIadUpdateWrapper::doCheckForUpdatesL() Feature not supported."));
|
|
99 |
}
|
|
100 |
}
|
|
101 |
|
|
102 |
// -------------------------------------------------------------------------------------------------
|
|
103 |
// VideoIadUpdateWrapper::CheckUpdatesComplete()
|
|
104 |
// -------------------------------------------------------------------------------------------------
|
|
105 |
//
|
|
106 |
void VideoIadUpdateWrapper::CheckUpdatesComplete(TInt errorCode, TInt availableUpdates)
|
|
107 |
{
|
|
108 |
MPX_ENTER_EXIT( _L("VideoIadUpdateWrapper::CheckUpdatesComplete()"),
|
|
109 |
_L("aErrorCode: %d, availableUpdates: %d"), errorCode, availableUpdates );
|
|
110 |
|
|
111 |
if(errorCode == KErrNone)
|
|
112 |
{
|
|
113 |
if(availableUpdates > 0 && mUpdate)
|
|
114 |
{
|
|
115 |
// There were some updates available and video list is active.
|
|
116 |
mUpdate->UpdateQuery();
|
|
117 |
}
|
|
118 |
else
|
|
119 |
{
|
|
120 |
// No updates available or playback ongoing.
|
|
121 |
cleanup();
|
|
122 |
}
|
|
123 |
}
|
|
124 |
}
|
|
125 |
|
|
126 |
// -------------------------------------------------------------------------------------------------
|
|
127 |
// VideoIadUpdateWrapper::UpdateComplete()
|
|
128 |
// -------------------------------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
void VideoIadUpdateWrapper::UpdateComplete(TInt errorCode, CIAUpdateResult* resultDetails)
|
|
131 |
{
|
|
132 |
MPX_ENTER_EXIT(_L("VideoIadUpdateWrapper::UpdateComplete()"), _L("aErrorCode: %d, SuccessCount: %d"),
|
|
133 |
errorCode, resultDetails->SuccessCount());
|
|
134 |
|
|
135 |
delete resultDetails; // Ownership was transferred, so this must be deleted by the client
|
|
136 |
|
|
137 |
// We do not need the client-server session anymore
|
|
138 |
cleanup();
|
|
139 |
}
|
|
140 |
|
|
141 |
// -------------------------------------------------------------------------------------------------
|
|
142 |
// VideoIadUpdateWrapper::UpdateQueryComplete()
|
|
143 |
// -------------------------------------------------------------------------------------------------
|
|
144 |
//
|
|
145 |
void VideoIadUpdateWrapper::UpdateQueryComplete(TInt errorCode, TBool updateNow)
|
|
146 |
{
|
|
147 |
MPX_ENTER_EXIT(_L("VideoIadUpdateWrapper::UpdateQueryComplete()"),
|
|
148 |
_L("aErrorCode: %d, updateNow: %d"), errorCode, updateNow);
|
|
149 |
|
|
150 |
if(errorCode == KErrNone)
|
|
151 |
{
|
|
152 |
if(updateNow && mUpdate)
|
|
153 |
{
|
|
154 |
// User choosed to update now, so let's launch the IAUpdate UI.
|
|
155 |
mUpdate->ShowUpdates(*mParameters);
|
|
156 |
}
|
|
157 |
else
|
|
158 |
{
|
|
159 |
// The answer was 'Later'.
|
|
160 |
cleanup();
|
|
161 |
}
|
|
162 |
}
|
|
163 |
}
|
|
164 |
|
|
165 |
// -------------------------------------------------------------------------------------------------
|
|
166 |
// VideoIadUpdateWrapper::cleanup()
|
|
167 |
// -------------------------------------------------------------------------------------------------
|
|
168 |
//
|
|
169 |
void VideoIadUpdateWrapper::cleanup()
|
|
170 |
{
|
|
171 |
MPX_ENTER_EXIT(_L("VideoIadUpdateWrapper::cleanup()"));
|
|
172 |
|
|
173 |
delete mUpdate;
|
|
174 |
mUpdate = 0;
|
|
175 |
|
|
176 |
delete mParameters;
|
|
177 |
mParameters = 0;
|
|
178 |
}
|
|
179 |
|
|
180 |
// End of file.
|