175 // --------------------------------------------------------- |
175 // --------------------------------------------------------- |
176 // |
176 // |
177 void CSrcsServiceManager::RealDoManageServiceL(TSrcsTransport aTransport, TBool aState) |
177 void CSrcsServiceManager::RealDoManageServiceL(TSrcsTransport aTransport, TBool aState) |
178 { |
178 { |
179 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RealDoManageServiceL")); |
179 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: RealDoManageServiceL")); |
180 CArrayPtr<CSrcsTransport>* connectionArray=NULL; |
|
181 TPtrC8 transportName; |
|
182 |
180 |
183 switch(aTransport) |
181 switch(aTransport) |
184 { |
182 { |
185 case ESrcsTransportBT: |
183 case ESrcsTransportBT: |
186 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Bluetooth)")); |
184 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Bluetooth)")); |
187 transportName.Set(KSrcsTransportBT); |
185 iTransportName.Set(KSrcsTransportBT); |
188 connectionArray = iBTConnectionArray; |
186 ServiceArray(*iBTConnectionArray, aState); |
189 break; |
187 break; |
190 case ESrcsTransportUSB: |
188 case ESrcsTransportUSB: |
191 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(USB)")); |
189 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(USB)")); |
192 transportName.Set(KSrcsTransportUSB); |
190 iTransportName.Set(KSrcsTransportUSB); |
193 connectionArray = iUSBConnectionArray; |
191 ServiceArray(*iUSBConnectionArray, aState); |
194 break; |
192 break; |
195 case ESrcsTransportIrDA: |
193 case ESrcsTransportIrDA: |
196 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(IrDA)")); |
194 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(IrDA)")); |
197 transportName.Set(KSrcsTransportIrDA); |
195 iTransportName.Set(KSrcsTransportIrDA); |
198 connectionArray = iIrDAConnectionArray; |
196 ServiceArray(*iIrDAConnectionArray, aState); |
199 break; |
197 break; |
200 default: |
198 default: |
201 FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport not supported."))); |
199 FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Transport not supported."))); |
202 iErrorState = KErrNotSupported; |
200 User::Leave(KErrNotSupported); |
203 } |
201 } |
|
202 |
|
203 } |
|
204 |
|
205 // --------------------------------------------------------- |
|
206 // CSrcsServiceManager |
|
207 // Method to manage Service arrays |
|
208 // --------------------------------------------------------- |
|
209 // |
|
210 void CSrcsServiceManager::ServiceArray(CArrayPtr<CSrcsTransport> &aTransport, TBool aState) |
|
211 { |
|
212 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ServiceArray")); |
|
213 |
204 // We start and stop services by aState value |
214 // We start and stop services by aState value |
205 if ( aState ) // trun on service |
215 if ( aState ) // trun on service |
206 { |
216 { |
207 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Turn ON)")); |
217 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL(Turn ON)")); |
208 // We do not re-start services if they have been started |
218 // We do not re-start services if they have been started |
209 if ( connectionArray && !(connectionArray->Count()) ) |
219 if (!(aTransport.Count())) |
210 { |
220 { |
211 //Declare array of service controllers |
221 //Declare array of service controllers |
212 RImplInfoPtrArray infoArrayServiceController; |
222 RImplInfoPtrArray infoArrayServiceController; |
213 |
223 |
214 //Declare array of SRCS transport plugins |
224 //Declare array of SRCS transport plugins |
217 |
227 |
218 CleanupClosePushL(infoArrayServiceController); |
228 CleanupClosePushL(infoArrayServiceController); |
219 |
229 |
220 //List all SRCS transport plugin implementations |
230 //List all SRCS transport plugin implementations |
221 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL about to list Transport Impl")); |
231 FLOG(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL about to list Transport Impl")); |
222 CSrcsTransport::ListImplementationsL(transportName,infoArrayTranport); |
232 CSrcsTransport::ListImplementationsL(iTransportName,infoArrayTranport); |
223 |
233 |
224 //Found SRCS transport plugin. Then start to enumerate service controller and make connections. |
234 //Found SRCS transport plugin. Then start to enumerate service controller and make connections. |
225 if(infoArrayTranport.Count()) |
235 if(infoArrayTranport.Count()) |
226 { |
236 { |
227 //There should be only one transport plugin of each type. Others are just ignored. |
237 //There should be only one transport plugin of each type. Others are just ignored. |
231 } |
241 } |
232 |
242 |
233 FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Using Transport ImplementationUid %x"), infoArrayTranport[0]->ImplementationUid())); |
243 FTRACE(FPrint(_L("[SRCS]\tserver\tCSrcsServiceManager: ManageServicesL. Using Transport ImplementationUid %x"), infoArrayTranport[0]->ImplementationUid())); |
234 |
244 |
235 //enumerate service controllers |
245 //enumerate service controllers |
236 CSrcsInterface::ListImplementationsL(transportName,infoArrayServiceController); |
246 CSrcsInterface::ListImplementationsL(iTransportName,infoArrayServiceController); |
237 |
247 |
238 // Loop through each found service controller, |
248 // Loop through each found service controller, |
239 // create SRCS transport connection for each found service controller |
249 // create SRCS transport connection for each found service controller |
240 // and instantiate the service controller. |
250 // and instantiate the service controller. |
241 CSrcsTransport *cm; |
251 CSrcsTransport *cm; |