|
1 // Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). |
|
2 // All rights reserved. |
|
3 // This component and the accompanying materials are made available |
|
4 // under the terms of "Eclipse Public License v1.0" |
|
5 // which accompanies this distribution, and is available |
|
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 // |
|
8 // Initial Contributors: |
|
9 // Nokia Corporation - initial contribution. |
|
10 // |
|
11 // Contributors: |
|
12 // |
|
13 // Description: |
|
14 // |
|
15 |
|
16 #include "mediaclientpolicyserverclient.h" |
|
17 #include <e32std.h> |
|
18 #include "mediaclientvideotrace.h" |
|
19 |
|
20 CMediaClientPolicyServerClient* CMediaClientPolicyServerClient::NewL() |
|
21 { |
|
22 DEBUG_PRINTF("CMediaClientPolicyServerClient::NewL +++"); |
|
23 |
|
24 CMediaClientPolicyServerClient* self = new( ELeave ) CMediaClientPolicyServerClient(); |
|
25 |
|
26 DEBUG_PRINTF("CMediaClientPolicyServerClient::NewL ---"); |
|
27 return self; |
|
28 } |
|
29 |
|
30 CMediaClientPolicyServerClient::~CMediaClientPolicyServerClient() |
|
31 { |
|
32 DEBUG_PRINTF("CMediaClientPolicyServerClient::~CMediaClientPolicyServerClient +++"); |
|
33 iSession.Close(); |
|
34 DEBUG_PRINTF("CMediaClientPolicyServerClient::~CMediaClientPolicyServerClient ---"); |
|
35 } |
|
36 |
|
37 void CMediaClientPolicyServerClient::SetSurface(const TSurfaceId& aSurfaceId) |
|
38 { |
|
39 DEBUG_PRINTF("CMediaClientPolicyServerClient::SetSurface +++"); |
|
40 |
|
41 if( aSurfaceId.IsNull() ) |
|
42 { |
|
43 DEBUG_PRINTF("CMediaClientPolicyServerClient::SetSurface NULL SurfaceId received"); |
|
44 } |
|
45 else |
|
46 { |
|
47 iSurfaceId = aSurfaceId; |
|
48 DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 0 0x%x", iSurfaceId.iInternal[0]); |
|
49 DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 1 0x%x", iSurfaceId.iInternal[1]); |
|
50 DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 2 0x%x", iSurfaceId.iInternal[2]); |
|
51 DEBUG_PRINTF2("CMediaClientPolicyServerClient::SetSurface - SurfaceId 3 0x%x", iSurfaceId.iInternal[3]); |
|
52 } |
|
53 |
|
54 DEBUG_PRINTF(" CMediaClientPolicyServerClient::SetSurface ---"); |
|
55 } |
|
56 |
|
57 void CMediaClientPolicyServerClient::FocusChanged(TBool aForeground) |
|
58 { |
|
59 DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged +++"); |
|
60 |
|
61 DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 0 0x%x", iSurfaceId.iInternal[0]); |
|
62 DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 1 0x%x", iSurfaceId.iInternal[1]); |
|
63 DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 2 0x%x", iSurfaceId.iInternal[2]); |
|
64 DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - SurfaceId 3 0x%x", iSurfaceId.iInternal[3]); |
|
65 DEBUG_PRINTF2("CMediaClientPolicyServerClient::FocusChanged - Focus %d", aForeground); |
|
66 |
|
67 if( iSurfaceId.IsNull() ) |
|
68 { |
|
69 DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged SurfaceId is NULL ... ignore focus change event"); |
|
70 } |
|
71 else |
|
72 { |
|
73 DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged Send focus change event to PS"); |
|
74 TFocusSurfaceChangedEvent focusChangedMessage; |
|
75 focusChangedMessage.iSurfaceId = iSurfaceId; |
|
76 focusChangedMessage.iForeground = aForeground; |
|
77 TPckgBuf<TFocusSurfaceChangedEvent> buffer(focusChangedMessage); |
|
78 TIpcArgs messageArguments(&buffer); |
|
79 |
|
80 TInt error = iSession.SendMessage(KFocusSurfaceChanged, messageArguments); |
|
81 |
|
82 if(error) |
|
83 { |
|
84 DEBUG_PRINTF2(" CMediaClientPolicyServerClient::FocusChanged SendMessage failed, error = %d", error); |
|
85 } |
|
86 } |
|
87 DEBUG_PRINTF(" CMediaClientPolicyServerClient::FocusChanged ---"); |
|
88 } |
|
89 |
|
90 TBool CMediaClientPolicyServerClient::IgnoreProcess(TSecureId aId) |
|
91 { |
|
92 DEBUG_PRINTF("CMediaClientPolicyServerClient::IgnoreProcess +++"); |
|
93 |
|
94 TBool ignore = ( |
|
95 (aId == 0x10281EF2) || // aknnfysrv |
|
96 (aId == 0x10207218) || // akncapserver |
|
97 (aId == 0x10003a4a) // eiksrvs |
|
98 ); |
|
99 |
|
100 DEBUG_PRINTF2("CMediaClientPolicyServerClient::IgnoreProcess --- return %d", ignore); |
|
101 return ignore; |
|
102 } |
|
103 |
|
104 TInt CMediaClientPolicyServerClient::Connect() |
|
105 { |
|
106 DEBUG_PRINTF(" CMediaClientPolicyServerClient::Connect +++"); |
|
107 TInt error = iSession.Connect(); |
|
108 DEBUG_PRINTF2(" CMediaClientPolicyServerClient::Connect --- return %d", error); |
|
109 return error; |
|
110 } |
|
111 |
|
112 void CMediaClientPolicyServerClient::Close() |
|
113 { |
|
114 DEBUG_PRINTF(" CMediaClientPolicyServerClient::Close +++"); |
|
115 iSession.Close(); |
|
116 DEBUG_PRINTF(" CMediaClientPolicyServerClient::Close ---"); |
|
117 } |
|
118 |
|
119 CMediaClientPolicyServerClient::CMediaClientPolicyServerClient() |
|
120 { |
|
121 DEBUG_PRINTF(" CMediaClientPolicyServerClient::CMediaClientPolicyServerClient +++"); |
|
122 iSurfaceId = TSurfaceId::CreateNullId(); |
|
123 DEBUG_PRINTF(" CMediaClientPolicyServerClient::CMediaClientPolicyServerClient ---"); |
|
124 } |