1 /* |
1 /* |
2 * Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies). |
2 * Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies). |
3 * All rights reserved. |
3 * All rights reserved. |
4 * This component and the accompanying materials are made available |
4 * This component and the accompanying materials are made available |
5 * under the terms of "Eclipse Public License v1.0" |
5 * under the terms of "Eclipse Public License v1.0" |
6 * which accompanies this distribution, and is available |
6 * which accompanies this distribution, and is available |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
76 // --------------------------------------------------------------------------- |
76 // --------------------------------------------------------------------------- |
77 // |
77 // |
78 TInt CDunAtModeListen::IssueRequest() |
78 TInt CDunAtModeListen::IssueRequest() |
79 { |
79 { |
80 FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest()" ))); |
80 FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest()" ))); |
81 if ( iModeListenState != EDunStateIdle ) |
81 if ( IsActive() ) |
82 { |
82 { |
83 FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() (not ready) complete" ) )); |
83 FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() (not ready) complete" ) )); |
84 return KErrNotReady; |
84 return KErrNotReady; |
85 } |
85 } |
86 iStatus = KRequestPending; |
|
87 iModeListenState = EDunStateModeListening; |
|
88 iAtCmdExtCommon->ReceiveModeStatusChange( iStatus, iModePckg ); |
86 iAtCmdExtCommon->ReceiveModeStatusChange( iStatus, iModePckg ); |
89 SetActive(); |
87 SetActive(); |
90 FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() complete" ))); |
88 FTRACE(FPrint( _L("CDunAtModeListen::IssueRequest() complete" ))); |
91 return KErrNone; |
89 return KErrNone; |
92 } |
90 } |
93 |
91 |
94 // --------------------------------------------------------------------------- |
92 // --------------------------------------------------------------------------- |
95 // Stops monitoring for mode status changes |
93 // Stops monitoring for mode status changes |
96 // --------------------------------------------------------------------------- |
94 // --------------------------------------------------------------------------- |
97 // |
95 // |
98 TInt CDunAtModeListen::Stop() |
96 void CDunAtModeListen::Stop() |
99 { |
97 { |
100 FTRACE(FPrint( _L("CDunAtModeListen::Stop()" ))); |
98 FTRACE(FPrint( _L("CDunAtModeListen::Stop()" ))); |
101 if ( iModeListenState != EDunStateModeListening ) |
|
102 { |
|
103 FTRACE(FPrint( _L("CDunAtModeListen::Stop() (not ready) complete" ) )); |
|
104 return KErrNotReady; |
|
105 } |
|
106 iAtCmdExtCommon->CancelReceiveModeStatusChange(); |
|
107 Cancel(); |
99 Cancel(); |
108 iModeListenState = EDunStateIdle; |
|
109 FTRACE(FPrint( _L("CDunAtModeListen::Stop() complete" ))); |
100 FTRACE(FPrint( _L("CDunAtModeListen::Stop() complete" ))); |
110 return KErrNone; |
|
111 } |
101 } |
112 |
102 |
113 // --------------------------------------------------------------------------- |
103 // --------------------------------------------------------------------------- |
114 // CDunAtModeListen::CDunAtModeListen |
104 // CDunAtModeListen::CDunAtModeListen |
115 // --------------------------------------------------------------------------- |
105 // --------------------------------------------------------------------------- |
145 // |
135 // |
146 void CDunAtModeListen::Initialize() |
136 void CDunAtModeListen::Initialize() |
147 { |
137 { |
148 // Don't initialize iAtCmdExtCommon here (it is set through NewL) |
138 // Don't initialize iAtCmdExtCommon here (it is set through NewL) |
149 // Don't initialize iCallback here (it is set through NewL) |
139 // Don't initialize iCallback here (it is set through NewL) |
150 iModeListenState = EDunStateIdle; |
|
151 iMode = 0; |
140 iMode = 0; |
152 } |
141 } |
153 |
142 |
154 // --------------------------------------------------------------------------- |
143 // --------------------------------------------------------------------------- |
155 // From class CActive. |
144 // From class CActive. |
157 // --------------------------------------------------------------------------- |
146 // --------------------------------------------------------------------------- |
158 // |
147 // |
159 void CDunAtModeListen::RunL() |
148 void CDunAtModeListen::RunL() |
160 { |
149 { |
161 FTRACE(FPrint( _L("CDunAtModeListen::RunL()") )); |
150 FTRACE(FPrint( _L("CDunAtModeListen::RunL()") )); |
162 iModeListenState = EDunStateIdle; |
|
163 TInt retTemp = iStatus.Int(); |
151 TInt retTemp = iStatus.Int(); |
164 if ( retTemp != KErrNone ) |
152 if ( retTemp != KErrNone ) |
165 { |
153 { |
166 FTRACE(FPrint( _L("CDunAtModeListen::RunL() (ERROR) complete (%d)"), retTemp )); |
154 FTRACE(FPrint( _L("CDunAtModeListen::RunL() (ERROR) complete (%d)"), retTemp )); |
167 return; |
155 return; |
178 // --------------------------------------------------------------------------- |
166 // --------------------------------------------------------------------------- |
179 // |
167 // |
180 void CDunAtModeListen::DoCancel() |
168 void CDunAtModeListen::DoCancel() |
181 { |
169 { |
182 FTRACE(FPrint( _L("CDunAtModeListen::DoCancel()") )); |
170 FTRACE(FPrint( _L("CDunAtModeListen::DoCancel()") )); |
|
171 iAtCmdExtCommon->CancelReceiveModeStatusChange(); |
183 FTRACE(FPrint( _L("CDunAtModeListen::DoCancel() complete") )); |
172 FTRACE(FPrint( _L("CDunAtModeListen::DoCancel() complete") )); |
184 } |
173 } |