|
1 /* |
|
2 * Copyright (c) 2008 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: |
|
15 * |
|
16 */ |
|
17 |
|
18 |
|
19 #include <atextcommonbase.h> |
|
20 #include "atextcommonobserver.h" |
|
21 #include "debug.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Instantiate the AT Extension Plugin via ECom framework. |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C CATExtCommonBase* CATExtCommonBase::NewL( |
|
28 TUid aImplementationUid, |
|
29 MATExtCommonObserver& aObserver, |
|
30 const TDesC8& aName ) |
|
31 { |
|
32 TInt32 keyOffset = _FOFF( CATExtCommonBase, iInstanceUid ); |
|
33 CATExtCommonBase* self = reinterpret_cast<CATExtCommonBase*>( |
|
34 REComSession::CreateImplementationL( aImplementationUid, keyOffset )); |
|
35 self->SetObserver( aObserver ); |
|
36 self->ReportConnectionName( aName ); |
|
37 return self; |
|
38 } |
|
39 |
|
40 // --------------------------------------------------------------------------- |
|
41 // Destructor |
|
42 // --------------------------------------------------------------------------- |
|
43 // |
|
44 EXPORT_C CATExtCommonBase::~CATExtCommonBase() |
|
45 { |
|
46 TRACE_FUNC_ENTRY |
|
47 REComSession::DestroyedImplementation( iInstanceUid ); |
|
48 if ( iObserver ) |
|
49 { |
|
50 iObserver->ATExtPluginClosed( this ); |
|
51 } |
|
52 TRACE_FUNC_EXIT |
|
53 } |
|
54 |
|
55 // --------------------------------------------------------------------------- |
|
56 // Called by concrete extension plugin to inform that mode status has changed. |
|
57 // Instructs ATEXT to complete client request message for |
|
58 // ReceiveModeStatusChange(). |
|
59 // --------------------------------------------------------------------------- |
|
60 // |
|
61 EXPORT_C TInt CATExtCommonBase::SendModeStatusChange( TUint aMode ) |
|
62 { |
|
63 TRACE_FUNC_ENTRY |
|
64 if ( !iObserver ) |
|
65 { |
|
66 return KErrGeneral; |
|
67 } |
|
68 iObserver->SendModeStatusChange( aMode ); |
|
69 TRACE_FUNC_EXIT |
|
70 return KErrNone; |
|
71 } |
|
72 |
|
73 // --------------------------------------------------------------------------- |
|
74 // Called by concrete extension plugin to inform that NVRAM status has |
|
75 // changed. Instructs ATEXT to complete client request message for |
|
76 // ReceiveNvramStatusChange(). |
|
77 // --------------------------------------------------------------------------- |
|
78 // |
|
79 EXPORT_C TInt CATExtCommonBase::SendNvramStatusChange( const TDesC8& aNvram ) |
|
80 { |
|
81 TRACE_FUNC_ENTRY |
|
82 if ( !iObserver ) |
|
83 { |
|
84 return KErrGeneral; |
|
85 } |
|
86 iObserver->SendNvramStatusChange( aNvram ); |
|
87 TRACE_FUNC_EXIT |
|
88 return KErrNone; |
|
89 } |
|
90 |
|
91 // --------------------------------------------------------------------------- |
|
92 // Sets the observer. |
|
93 // --------------------------------------------------------------------------- |
|
94 // |
|
95 EXPORT_C void CATExtCommonBase::SetObserver( MATExtCommonObserver& aObserver ) |
|
96 { |
|
97 TRACE_FUNC_ENTRY |
|
98 iObserver = &aObserver; |
|
99 TRACE_FUNC_EXIT |
|
100 } |