|
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 <atextpluginbase.h> |
|
20 #include "atextpluginobserver.h" |
|
21 #include "debug.h" |
|
22 |
|
23 // --------------------------------------------------------------------------- |
|
24 // Instantiate the AT Extension Plugin via ECom framework. |
|
25 // --------------------------------------------------------------------------- |
|
26 // |
|
27 EXPORT_C CATExtPluginBase* CATExtPluginBase::NewL( |
|
28 TUid aImplementationUid, |
|
29 MATExtPluginObserver& aObserver, |
|
30 const TDesC8& aName ) |
|
31 { |
|
32 TInt32 keyOffset = _FOFF( CATExtPluginBase, iInstanceUid ); |
|
33 CATExtPluginBase* self = reinterpret_cast<CATExtPluginBase*>( |
|
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 CATExtPluginBase::~CATExtPluginBase() |
|
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 // Reports change to quiet mode. |
|
57 // The quiet mode is off by default. |
|
58 // --------------------------------------------------------------------------- |
|
59 // |
|
60 EXPORT_C void CATExtPluginBase::ReportQuietModeChange( TBool aMode ) |
|
61 { |
|
62 TRACE_FUNC_ENTRY |
|
63 iQuietMode = aMode; |
|
64 TRACE_FUNC_EXIT |
|
65 } |
|
66 |
|
67 // --------------------------------------------------------------------------- |
|
68 // Reports change to verbose mode. |
|
69 // The verbose mode is on by default. |
|
70 // --------------------------------------------------------------------------- |
|
71 // |
|
72 EXPORT_C void CATExtPluginBase::ReportVerboseModeChange( TBool aMode ) |
|
73 { |
|
74 TRACE_FUNC_ENTRY |
|
75 iVerboseMode = aMode; |
|
76 TRACE_FUNC_EXIT |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // Reports change to a value of a character |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 EXPORT_C TInt CATExtPluginBase::ReportCharacterChange( |
|
84 TATExtensionCharType aCharType, |
|
85 TInt8 aNewChar ) |
|
86 { |
|
87 TRACE_FUNC_ENTRY |
|
88 TInt retVal = KErrNone; |
|
89 switch ( aCharType ) |
|
90 { |
|
91 case ECharTypeCarriage: |
|
92 iCarriageReturn = aNewChar; |
|
93 break; |
|
94 case ECharTypeLineFeed: |
|
95 iLineFeed = aNewChar; |
|
96 break; |
|
97 case ECharTypeBackspace: |
|
98 iBackspace = aNewChar; |
|
99 break; |
|
100 default: |
|
101 retVal = KErrNotSupported; |
|
102 break; |
|
103 } |
|
104 TRACE_FUNC_EXIT |
|
105 return retVal; |
|
106 } |
|
107 |
|
108 // --------------------------------------------------------------------------- |
|
109 // Called by concrete extension plugin when there is an unsolicited result |
|
110 // code should be sent to remote device. Instructs ATEXT to complete client |
|
111 // request message for ReceiveUnsolicitedResult(). |
|
112 // --------------------------------------------------------------------------- |
|
113 // |
|
114 EXPORT_C TInt CATExtPluginBase::SendUnsolicitedResult( const TDesC8& aAT ) |
|
115 { |
|
116 TRACE_FUNC_ENTRY |
|
117 TInt retVal = iObserver->SendUnsolicitedResult( this, aAT ); |
|
118 TRACE_FUNC_EXIT |
|
119 return retVal; |
|
120 } |
|
121 |
|
122 // --------------------------------------------------------------------------- |
|
123 // Called by concrete extension plugin to inform that a command handling has |
|
124 // been completed or rejected. Instructs ATEXT to complete client request |
|
125 // message for HandleCommand(). |
|
126 // --------------------------------------------------------------------------- |
|
127 // |
|
128 EXPORT_C TInt CATExtPluginBase::HandleCommandCompleted( |
|
129 TInt aError, |
|
130 TATExtensionReplyType aReplyType ) |
|
131 { |
|
132 TRACE_FUNC_ENTRY |
|
133 TInt retVal = iObserver->HandleCommandCompleted( this, aError, aReplyType ); |
|
134 TRACE_FUNC_EXIT |
|
135 return retVal; |
|
136 } |
|
137 |
|
138 |
|
139 // --------------------------------------------------------------------------- |
|
140 // Called by concrete extension plugin to inform the array of supported |
|
141 // commands should be returned |
|
142 // --------------------------------------------------------------------------- |
|
143 // |
|
144 EXPORT_C TInt CATExtPluginBase::GetSupportedCommands( |
|
145 RPointerArray<HBufC8>& aCmds ) |
|
146 { |
|
147 TRACE_FUNC_ENTRY |
|
148 TInt retVal = iObserver->GetSupportedCommands( this, aCmds ); |
|
149 TRACE_FUNC_EXIT |
|
150 return retVal; |
|
151 } |
|
152 |
|
153 // --------------------------------------------------------------------------- |
|
154 // Sets the observer. |
|
155 // --------------------------------------------------------------------------- |
|
156 // |
|
157 EXPORT_C void CATExtPluginBase::SetObserver( MATExtPluginObserver& aObserver ) |
|
158 { |
|
159 TRACE_FUNC_ENTRY |
|
160 iObserver = &aObserver; |
|
161 TRACE_FUNC_EXIT |
|
162 } |