|
1 /* |
|
2 * Copyright (c) 2002-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 the License "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 the WlanWsaWriteMib class |
|
15 * |
|
16 */ |
|
17 |
|
18 /* |
|
19 * %version: 13 % |
|
20 */ |
|
21 |
|
22 #include "config.h" |
|
23 #include "UmacWsaWriteMib.h" |
|
24 #include "UmacContextImpl.h" |
|
25 |
|
26 #ifndef NDEBUG |
|
27 const TInt8 WlanWsaWriteMib::iName[] = "wsa-writemib"; |
|
28 #endif |
|
29 |
|
30 // ======== MEMBER FUNCTIONS ======== |
|
31 |
|
32 // --------------------------------------------------------------------------- |
|
33 // |
|
34 // --------------------------------------------------------------------------- |
|
35 // |
|
36 void WlanWsaWriteMib::Entry( WlanContextImpl& aCtxImpl ) |
|
37 { |
|
38 // mark WSA cmd active |
|
39 aCtxImpl.ActivateWsaCmd(); |
|
40 |
|
41 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
42 ("UMAC: WlanWsaWriteMib::Entry: MIB ID: 0x%04x"), iMib); |
|
43 |
|
44 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
45 ("UMAC: WlanWsaWriteMib::Entry: total mib length: %d"), iLength); |
|
46 |
|
47 OsTracePrint( KWsaCmdStateDetails, (TUint8*) |
|
48 ("UMAC: WlanWsaWriteMib::Entry: complete mib contents:"), |
|
49 reinterpret_cast<const TUint8*>(iData), |
|
50 reinterpret_cast<const TUint8*>(iData) + iLength ); |
|
51 |
|
52 OsTracePrint( KWsaCmdState, (TUint8*) |
|
53 ("UMAC: WHA-CMD-WriteMib") ); |
|
54 |
|
55 // execute the command |
|
56 // for now we will always set the aMore field to false |
|
57 const WHA::TStatus status( |
|
58 aCtxImpl.Wha().WriteMib( iMib, iLength, iData, EFalse ) ); |
|
59 |
|
60 if ( status == WHA::KSuccess ) |
|
61 { |
|
62 // command was executed synchronously |
|
63 // and no command response event is pending |
|
64 // we shall request a dfc in order to break the context |
|
65 |
|
66 OsTracePrint( KWsaCmdState, (TUint8*) |
|
67 ("UMAC: WlanWsaWriteMib::Entry: command executed synchronously: request dfc: status %d"), |
|
68 status); |
|
69 DfcPending( ETrue ); |
|
70 aCtxImpl.iUmac.RegisterDfc( &aCtxImpl ); |
|
71 } |
|
72 else |
|
73 { |
|
74 // command is executed asynchronously |
|
75 // and command response event is pending |
|
76 } |
|
77 } |
|
78 |
|
79 // --------------------------------------------------------------------------- |
|
80 // |
|
81 // --------------------------------------------------------------------------- |
|
82 // |
|
83 void WlanWsaWriteMib::Exit( WlanContextImpl& aCtxImpl) |
|
84 { |
|
85 // mark WSA cmd inactive |
|
86 aCtxImpl.DeActivateWsaCmd(); |
|
87 |
|
88 if ( DfcPending() ) |
|
89 { |
|
90 // dfc is pending and we are departing this state |
|
91 // only valid use case for taking this path is |
|
92 // that we have received an error indication |
|
93 |
|
94 // no we just must cancel the pending dfc so |
|
95 // that it won't get executed in a wrong state |
|
96 |
|
97 OsTracePrint( KWarningLevel, (TUint8*) |
|
98 ("UMAC: WlanWsaWriteMib::Exit: state exit while dfc pending -> canceling dfc")); |
|
99 |
|
100 DfcPending( EFalse ); |
|
101 aCtxImpl.iUmac.CancelDfc(); |
|
102 } |
|
103 } |
|
104 |
|
105 // --------------------------------------------------------------------------- |
|
106 // |
|
107 // --------------------------------------------------------------------------- |
|
108 // |
|
109 void WlanWsaWriteMib::CommandResponse( |
|
110 WlanContextImpl& aCtxImpl, |
|
111 WHA::TCommandId aCommandId, |
|
112 WHA::TStatus aStatus, |
|
113 const WHA::UCommandResponseParams& aCommandResponseParams ) |
|
114 { |
|
115 OsTracePrint( KWsaCmdState, (TUint8*) |
|
116 ("UMAC: WlanWsaWriteMib::CommandResponse") ); |
|
117 |
|
118 if ( aCommandId != WHA::EWriteMIBResponse ) |
|
119 { |
|
120 OsTracePrint( KErrorLevel, |
|
121 (TUint8*)("UMAC: aCommandId: %d"), aCommandId ); |
|
122 OsAssert( (TUint8*)("UMAC: panic"), (TUint8*)(WLAN_FILE), __LINE__ ); |
|
123 } |
|
124 |
|
125 TraverseToHistoryState( aCtxImpl, |
|
126 aCommandId, aStatus, aCommandResponseParams ); |
|
127 } |
|
128 |
|
129 // --------------------------------------------------------------------------- |
|
130 // |
|
131 // --------------------------------------------------------------------------- |
|
132 // |
|
133 void WlanWsaWriteMib::OnDfc( TAny* aCtx ) |
|
134 { |
|
135 // only valid reason for us to land here is, |
|
136 // that we have executed a synchronous MIB write |
|
137 |
|
138 OsTracePrint( KWsaCmdState, (TUint8*)("UMAC: WlanWsaWriteMib:OnDfc")); |
|
139 |
|
140 DfcPending( EFalse ); // mark dfc non pending |
|
141 |
|
142 WHA::UCommandResponseParams dont_care; |
|
143 CommandResponse( *(static_cast<WlanContextImpl*>(aCtx)), |
|
144 WHA::EWriteMIBResponse, WHA::KSuccess, dont_care ); |
|
145 } |
|
146 |
|
147 // --------------------------------------------------------------------------- |
|
148 // |
|
149 // --------------------------------------------------------------------------- |
|
150 // |
|
151 #ifndef NDEBUG |
|
152 const TInt8* WlanWsaWriteMib::GetStateName( TUint8& aLength ) const |
|
153 { |
|
154 aLength = sizeof( iName ); |
|
155 return iName; |
|
156 } |
|
157 #endif |