33
|
1 |
/*
|
|
2 |
* Copyright (c) 2005-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: Provides events to mediator event consumer.
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
#include <featmgr.h>
|
|
19 |
#include <centralrepository.h>
|
|
20 |
#include <MediatorDomainUIDs.h>
|
|
21 |
#include <MediatorEventProvider.h>
|
|
22 |
#include <SecondaryDisplay/secondarydisplaysatapi.h>
|
|
23 |
|
|
24 |
#include "SATPrivateCRKeys.h"
|
|
25 |
#include "csatmediatoreventprovider.h"
|
|
26 |
#include "SatLog.h"
|
|
27 |
|
|
28 |
using namespace MediatorService;
|
|
29 |
|
|
30 |
// ======== MEMBER FUNCTIONS ========
|
|
31 |
|
|
32 |
// -----------------------------------------------------------------------------
|
|
33 |
// CSatMediatorEventProvider::NewL
|
|
34 |
// Two-phased constructor.
|
|
35 |
// -----------------------------------------------------------------------------
|
|
36 |
//
|
|
37 |
CSatMediatorEventProvider* CSatMediatorEventProvider::NewL()
|
|
38 |
{
|
|
39 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::NewL calling" )
|
|
40 |
|
|
41 |
CSatMediatorEventProvider* self =
|
|
42 |
new ( ELeave ) CSatMediatorEventProvider();
|
|
43 |
CleanupStack::PushL( self );
|
|
44 |
self->ConstructL();
|
|
45 |
CleanupStack::Pop();
|
|
46 |
|
|
47 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::NewL exiting" )
|
|
48 |
return self;
|
|
49 |
}
|
|
50 |
|
|
51 |
// -----------------------------------------------------------------------------
|
|
52 |
// CSatMediatorEventProvider::~CSatMediatorEventProvider
|
|
53 |
// Destructor.
|
|
54 |
// -----------------------------------------------------------------------------
|
|
55 |
//
|
|
56 |
CSatMediatorEventProvider::~CSatMediatorEventProvider()
|
|
57 |
{
|
|
58 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::\
|
|
59 |
~CSatMediatorEventProvider calling" )
|
|
60 |
|
|
61 |
if ( iEventProvider )
|
|
62 |
{
|
|
63 |
iEventProvider->UnregisterEvent( KMediatorSecondaryDisplayDomain,
|
|
64 |
KCatSAT,
|
|
65 |
EMsgAnySatCommand );
|
|
66 |
delete iEventProvider;
|
|
67 |
iEventProvider = NULL;
|
|
68 |
}
|
|
69 |
|
|
70 |
LOG( NORMAL,
|
|
71 |
"SATENGINE: CSatMediatorEventProvider::\
|
|
72 |
~CSatMediatorEventProvider exiting" )
|
|
73 |
}
|
|
74 |
|
|
75 |
// -----------------------------------------------------------------------------
|
|
76 |
// CSatMediatorEventProvider::RaiseSatEvent
|
|
77 |
//
|
|
78 |
// -----------------------------------------------------------------------------
|
|
79 |
//
|
|
80 |
TInt CSatMediatorEventProvider::RaiseSatEvent( const TDesC8& aData )
|
|
81 |
{
|
|
82 |
|
|
83 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider \
|
|
84 |
::RaiseSatEvent calling" )
|
|
85 |
TInt retVal( KErrNone );
|
|
86 |
// If SAT Event is registered, raise SAT event
|
|
87 |
if ( iRegistered )
|
|
88 |
{
|
|
89 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider \
|
|
90 |
::RaiseSatEvent iRegistered true" )
|
|
91 |
#ifdef ENABLE_SAT_LOGGING
|
|
92 |
const TSatCommandPckg* eventPckg =
|
|
93 |
reinterpret_cast<const TSatCommandPckg*> ( aData.Ptr() );
|
|
94 |
const TSatCommandData& eventData =
|
|
95 |
reinterpret_cast<const TSatCommandData&> ( *eventPckg );
|
|
96 |
|
|
97 |
LOG2( DETAILED,
|
|
98 |
"SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: \
|
|
99 |
cmdNumber: 0x%2X", eventData.iPCmdNumber )
|
|
100 |
LOG2( DETAILED,
|
|
101 |
"SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: AlphaId: %S",
|
|
102 |
&eventData.iAlphaId )
|
|
103 |
LOG2( DETAILED,
|
|
104 |
"SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: \
|
|
105 |
duration[s]: 0x%2X", eventData.iDuration.iNumOfUnits )
|
|
106 |
LOG2( DETAILED,
|
|
107 |
"SATENGINE: CSatMediatorEventProvider::RaiseSatEvent: IconID: 0x%2X",
|
|
108 |
eventData.iIconID.iIdentifier )
|
|
109 |
#endif
|
|
110 |
retVal = iEventProvider->RaiseEvent(
|
|
111 |
KMediatorSecondaryDisplayDomain,
|
|
112 |
KCatSAT,
|
|
113 |
EMsgAnySatCommand,
|
|
114 |
TVersion( KVersionMajor,
|
|
115 |
KVersionMinor,
|
|
116 |
KVersionBuild ),
|
|
117 |
aData );
|
|
118 |
}
|
|
119 |
|
|
120 |
LOG2( NORMAL, "SATENGINE: CSatMediatorEventProvider\
|
|
121 |
::RaiseSatEvent exiting, retVal: %d", retVal )
|
|
122 |
return retVal;
|
|
123 |
}
|
|
124 |
|
|
125 |
// -----------------------------------------------------------------------------
|
|
126 |
// CSatMediatorEventProvider::CoverUiSupported
|
|
127 |
//
|
|
128 |
// -----------------------------------------------------------------------------
|
|
129 |
//
|
|
130 |
TBool CSatMediatorEventProvider::CoverUiSupported()
|
|
131 |
{
|
|
132 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider \
|
|
133 |
::CoverUiSupported calling-exiting" )
|
|
134 |
return iCoverUiSupported;
|
|
135 |
}
|
|
136 |
|
|
137 |
// -----------------------------------------------------------------------------
|
|
138 |
// CSatMediatorEventProvider::CSatMediatorEventProvider
|
|
139 |
// C++ default constructor can NOT contain any code, that might leave.
|
|
140 |
// -----------------------------------------------------------------------------
|
|
141 |
//
|
|
142 |
CSatMediatorEventProvider::CSatMediatorEventProvider() :
|
|
143 |
iRegistered( EFalse ),
|
|
144 |
iCoverUiSupported( EFalse ),
|
|
145 |
iEventProvider( NULL )
|
|
146 |
{
|
|
147 |
LOG( NORMAL,
|
|
148 |
"SATENGINE: CSatMediatorEventProvider::CSatMediatorEventProvider \
|
|
149 |
calling-exiting" )
|
|
150 |
}
|
|
151 |
|
|
152 |
// -----------------------------------------------------------------------------
|
|
153 |
// CSatMediatorEventProvider::ConstructL
|
|
154 |
// Two-phased constructor.
|
|
155 |
// -----------------------------------------------------------------------------
|
|
156 |
//
|
|
157 |
void CSatMediatorEventProvider::ConstructL()
|
|
158 |
{
|
|
159 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::ConstructL calling" )
|
|
160 |
|
|
161 |
// Store Cover UI supported information
|
|
162 |
CUiSupportedL();
|
|
163 |
|
|
164 |
// If Cover UI is supported, register SAT Event
|
|
165 |
if ( iCoverUiSupported )
|
|
166 |
{
|
|
167 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::ConstructL \
|
|
168 |
iCoverUiSupported true" )
|
|
169 |
iEventProvider = CMediatorEventProvider::NewL();
|
|
170 |
|
|
171 |
User::LeaveIfError( iEventProvider->RegisterEvent(
|
|
172 |
KMediatorSecondaryDisplayDomain,
|
|
173 |
KCatSAT,
|
|
174 |
EMsgAnySatCommand,
|
|
175 |
TVersion( KVersionMajor, KVersionMinor, KVersionBuild ),
|
|
176 |
TCapabilitySet( ECapabilitySwEvent ) ) );
|
|
177 |
|
|
178 |
iRegistered = ETrue;
|
|
179 |
}
|
|
180 |
|
|
181 |
LOG( NORMAL, "SATENGINE: CSatMediatorEventProvider::ConstructL exiting" )
|
|
182 |
}
|
|
183 |
|
|
184 |
// -----------------------------------------------------------------------------
|
|
185 |
// CSatMediatorEventProvider::CUiSupportedL
|
|
186 |
//
|
|
187 |
// -----------------------------------------------------------------------------
|
|
188 |
//
|
|
189 |
void CSatMediatorEventProvider::CUiSupportedL()
|
|
190 |
{
|
|
191 |
LOG( NORMAL,
|
|
192 |
"SATENGINE: CSatMediatorEventProvider::CoverUiSupported calling" )
|
|
193 |
|
|
194 |
TBool coverui( EFalse );
|
|
195 |
|
|
196 |
// Check if Cover UI presents from Feature Manager
|
|
197 |
FeatureManager::InitializeLibL();
|
|
198 |
coverui = FeatureManager::FeatureSupported( KFeatureIdCoverDisplay );
|
|
199 |
FeatureManager::UnInitializeLib();
|
|
200 |
|
|
201 |
// Check SAT internal flag for Cover UI
|
|
202 |
TInt satCoverUi( 0 );
|
|
203 |
CRepository* repository = CRepository::NewL( KCRUidSatServer );
|
|
204 |
repository->StartTransaction( CRepository::EReadTransaction );
|
|
205 |
repository->Get( KSatSecondaryDisplaySupport, satCoverUi );
|
|
206 |
delete repository;
|
|
207 |
repository = NULL;
|
|
208 |
|
|
209 |
// Store Supported information
|
|
210 |
iCoverUiSupported = TBool( coverui & satCoverUi );
|
|
211 |
LOG2( SIMPLE,"CSatMediatorEventProvider::CUiSupportedL \
|
|
212 |
KSatSecondaryDisplaySupport:%d", satCoverUi )
|
|
213 |
LOG( NORMAL,
|
|
214 |
"SATENGINE: CSatMediatorEventProvider::CoverUiSupported exiting" )
|
|
215 |
}
|
|
216 |
|