|
1 /* |
|
2 * Copyright (c) 2008-2009 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 Tv connection Observer class |
|
15 * |
|
16 */ |
|
17 |
|
18 #include "glxtv.h" // for CGlxTv |
|
19 #include "glxtvconnectionobserver.h" |
|
20 #include "glxtvoutwrapper_p.h" |
|
21 |
|
22 |
|
23 // ----------------------------------------------------------------------------- |
|
24 // NewL |
|
25 // ----------------------------------------------------------------------------- |
|
26 CGlxConnectionObserver* CGlxConnectionObserver::NewL(GlxTvOutWrapperPrivate* aTvWrapperPrivate) |
|
27 { |
|
28 CGlxConnectionObserver* self = new (ELeave)CGlxConnectionObserver(aTvWrapperPrivate); |
|
29 self->ConstructL(); |
|
30 return self; |
|
31 } |
|
32 |
|
33 // ----------------------------------------------------------------------------- |
|
34 // ConstructL |
|
35 // ----------------------------------------------------------------------------- |
|
36 void CGlxConnectionObserver::ConstructL() |
|
37 { |
|
38 iGlxTvOut = CGlxTv::NewL(*this); |
|
39 } |
|
40 |
|
41 // ----------------------------------------------------------------------------- |
|
42 // Constructor |
|
43 // ----------------------------------------------------------------------------- |
|
44 CGlxConnectionObserver::CGlxConnectionObserver(GlxTvOutWrapperPrivate* aTvWrapperPrivate): |
|
45 iTvWrapperPrivate(aTvWrapperPrivate) |
|
46 { |
|
47 // ctor |
|
48 } |
|
49 |
|
50 // ----------------------------------------------------------------------------- |
|
51 // Destructor |
|
52 // ----------------------------------------------------------------------------- |
|
53 CGlxConnectionObserver::~CGlxConnectionObserver() |
|
54 { |
|
55 if (iGlxTvOut){ |
|
56 delete iGlxTvOut; |
|
57 iGlxTvOut = NULL; |
|
58 } |
|
59 } |
|
60 |
|
61 // ----------------------------------------------------------------------------- |
|
62 // HandleTvStatusChangedL |
|
63 // ----------------------------------------------------------------------------- |
|
64 void CGlxConnectionObserver::HandleTvStatusChangedL(TTvChangeType aChangeType) |
|
65 { |
|
66 if ( aChangeType == ETvConnectionChanged ){ |
|
67 if ( iGlxTvOut->IsHDMIConnected() ){ |
|
68 iTvWrapperPrivate->HandleConnectionChange(ETrue); |
|
69 // emit HDMI connected signal |
|
70 } |
|
71 else{ |
|
72 iTvWrapperPrivate->HandleConnectionChange(EFalse); |
|
73 // emit HDMI disconnected |
|
74 } |
|
75 } |
|
76 } |