20 #include <ecom/ecomresolverparams.h> |
20 #include <ecom/ecomresolverparams.h> |
21 |
21 |
22 #include "btengsrvstate.h" |
22 #include "btengsrvstate.h" |
23 #include "btengserver.h" |
23 #include "btengserver.h" |
24 #include "btengsrvpluginmgr.h" |
24 #include "btengsrvpluginmgr.h" |
|
25 #include "btengsrvsettingsmgr.h" |
25 #include "debug.h" |
26 #include "debug.h" |
26 |
27 |
27 |
28 |
28 // ======== MEMBER FUNCTIONS ======== |
29 // ======== MEMBER FUNCTIONS ======== |
29 |
30 |
91 |
92 |
92 // --------------------------------------------------------------------------- |
93 // --------------------------------------------------------------------------- |
93 // ?implementation_description |
94 // ?implementation_description |
94 // --------------------------------------------------------------------------- |
95 // --------------------------------------------------------------------------- |
95 // |
96 // |
96 void CBTEngSrvState::StartStateMachineL( TBool aState ) |
97 void CBTEngSrvState::StartStateMachineL( TBTPowerState aState ) |
97 { |
98 { |
98 TRACE_FUNC_ENTRY |
99 TRACE_FUNC_ENTRY |
99 if( aState ) |
100 if( aState == EBTOn ) |
100 { |
101 { |
101 // Power on; starting state is initializing the stack |
102 // Power on; starting state is initializing the stack |
102 iState = EInitBTStack; |
103 iState = EInitBTStack; |
103 iOperation = EPowerOn; |
104 iOperation = EPowerOn; |
104 } |
105 } |
105 else |
106 else |
106 { |
107 { |
107 // Power off, starting state is to disconnect the plug-ins |
108 // Power off, starting state is to disconnect the plug-ins |
108 iState = EDisconnectPlugins; |
109 iState = EDisconnectPlugins; |
109 iOperation = EPowerOff; |
110 iOperation = EPowerOff; |
110 iServer->UpdateCenRepPowerKeyL( EBTPowerOff ); |
111 iServer->SettingsManager()->UpdateCenRepPowerKeyL( EBTOff ); |
111 iServer->SetUiIndicatorsL(); |
112 iServer->SettingsManager()->SetUiIndicatorsL(); |
112 } |
113 } |
113 ChangeState(); |
114 ChangeState(); |
114 } |
115 } |
115 |
116 |
116 |
117 |
119 // --------------------------------------------------------------------------- |
120 // --------------------------------------------------------------------------- |
120 // |
121 // |
121 void CBTEngSrvState::ChangeState() |
122 void CBTEngSrvState::ChangeState() |
122 { |
123 { |
123 TRACE_FUNC_ENTRY |
124 TRACE_FUNC_ENTRY |
124 if(!iAsyncCallback->IsActive()) |
125 iAsyncCallback->CallBack(); |
125 { |
|
126 iAsyncCallback->CallBack(); |
|
127 } |
|
128 } |
126 } |
129 |
127 |
130 // --------------------------------------------------------------------------- |
128 // --------------------------------------------------------------------------- |
131 // ?implementation_description |
129 // ?implementation_description |
132 // --------------------------------------------------------------------------- |
130 // --------------------------------------------------------------------------- |
164 break; |
162 break; |
165 case ELoadPlugins: |
163 case ELoadPlugins: |
166 { |
164 { |
167 iState = ELoadNextPlugin; |
165 iState = ELoadNextPlugin; |
168 TEComResolverParams params; |
166 TEComResolverParams params; |
169 iServer->iPluginMgr->LoadProfilePluginsL( params ); |
167 iServer->PluginManager()->LoadProfilePluginsL( params ); |
170 } |
168 } |
171 break; |
169 break; |
172 case ELoadNextPlugin: |
170 case ELoadNextPlugin: |
173 { |
171 { |
174 // Only change the state when all plug-ins are loaded |
172 // Only change the state when all plug-ins are loaded |
175 if( iServer->iPluginMgr->LoadPluginL() <= 0 ) |
173 if( iServer->PluginManager()->LoadPluginL() <= 0 ) |
176 { |
174 { |
177 iState = EIdle; |
175 iState = EIdle; |
178 } |
176 } |
179 } |
177 } |
180 break; |
178 break; |
181 case EStopBTStack: |
179 case EStopBTStack: |
182 { |
180 { |
183 iState = EWaitingForPowerOff; |
181 iState = EWaitingForPowerOff; |
184 iServer->StopBTStackL(); |
182 iServer->SettingsManager()->StopBTStackL(); |
185 } |
183 } |
186 break; |
184 break; |
187 case EUnloadDIService: |
185 case EUnloadDIService: |
188 { |
186 { |
189 iState = EStopBTStack; |
187 iState = EStopBTStack; |
212 } // Fall through |
210 } // Fall through |
213 case EIdle: |
211 case EIdle: |
214 { |
212 { |
215 if( iOperation == EPowerOn ) |
213 if( iOperation == EPowerOn ) |
216 { |
214 { |
217 iServer->UpdateCenRepPowerKeyL( EBTPowerOn ); |
215 iServer->SettingsManager()->UpdateCenRepPowerKeyL( EBTOn ); |
218 iServer->SetUiIndicatorsL(); |
216 iServer->SettingsManager()->SetUiIndicatorsL(); |
219 } |
217 } |
220 iOperation = ESrvOpIdle; |
218 iOperation = ESrvOpIdle; |
221 iServer->CheckIdle(); |
219 iServer->CheckIdle(); |
222 } |
220 } |
223 case EInit: |
221 case EInit: |