equal
deleted
inserted
replaced
35 #include "btengsdpdbhandler.h" |
35 #include "btengsdpdbhandler.h" |
36 #include "btengclientserver.h" |
36 #include "btengclientserver.h" |
37 #include "btengsecpolicy.h" |
37 #include "btengsecpolicy.h" |
38 #include "btengprivatepskeys.h" |
38 #include "btengprivatepskeys.h" |
39 #include "btengplugin.h" |
39 #include "btengplugin.h" |
40 #include "btengpairman.h" |
|
41 #include "debug.h" |
40 #include "debug.h" |
42 |
41 |
43 /** Bluetooth Engine server thread name */ |
42 /** Bluetooth Engine server thread name */ |
44 _LIT( KBTEngThreadName, "BTEngine" ); |
43 _LIT( KBTEngThreadName, "BTEngine" ); |
45 /** Timeout (3 sec) for shutting down the server (when power is off and no clients connected). */ |
44 /** Timeout (3 sec) for shutting down the server (when power is off and no clients connected). */ |
165 iWatcher = CBTEngSrvKeyWatcher::NewL( this ); |
164 iWatcher = CBTEngSrvKeyWatcher::NewL( this ); |
166 iSettingsMgr = CBTEngSrvSettingsMgr::NewL( this ); |
165 iSettingsMgr = CBTEngSrvSettingsMgr::NewL( this ); |
167 iPluginMgr = CBTEngSrvPluginMgr::NewL( this ); |
166 iPluginMgr = CBTEngSrvPluginMgr::NewL( this ); |
168 iBBConnMgr = CBTEngSrvBBConnMgr::NewL( this, iSocketServ ); |
167 iBBConnMgr = CBTEngSrvBBConnMgr::NewL( this, iSocketServ ); |
169 |
168 |
170 User::LeaveIfError( iBTRegServ.Connect() ); |
169 iSdpDbHandler = NULL; |
171 iPairMan = CBTEngPairMan::NewL( *this ); |
|
172 |
170 |
173 TCallBack idleCb( IdleTimerCallBack, this ); |
171 TCallBack idleCb( IdleTimerCallBack, this ); |
174 iIdleCallBack.Set( idleCb ); |
172 iIdleCallBack.Set( idleCb ); |
175 TCallBack sspCb( DebugModeTimerCallBack, this ); |
173 TCallBack sspCb( DebugModeTimerCallBack, this ); |
176 iDebugModeCallBack.Set( sspCb ); |
174 iDebugModeCallBack.Set( sspCb ); |
217 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTOutgoingPairing ); |
215 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTOutgoingPairing ); |
218 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTConnectionTimeStamp ); |
216 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTConnectionTimeStamp ); |
219 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTTurnBTOffQueryOn ); |
217 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTTurnBTOffQueryOn ); |
220 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ); |
218 RProperty::Delete( KPSUidBluetoothEnginePrivateCategory, KBTNotifierLocks ); |
221 delete iTimer; |
219 delete iTimer; |
222 delete iSdpDbHandler; |
220 if ( iSdpDbHandler ) |
|
221 { |
|
222 delete iSdpDbHandler; |
|
223 } |
223 delete iWatcher; |
224 delete iWatcher; |
224 delete iSettingsMgr; |
225 delete iSettingsMgr; |
225 delete iPluginMgr; |
226 delete iPluginMgr; |
226 delete iBBConnMgr; |
227 delete iBBConnMgr; |
227 delete iServerState; |
228 delete iServerState; |
228 delete iPairMan; |
|
229 iSocketServ.Close(); |
229 iSocketServ.Close(); |
230 iBTRegServ.Close(); |
|
231 } |
230 } |
232 |
231 |
233 // --------------------------------------------------------------------------- |
232 // --------------------------------------------------------------------------- |
234 // Turn BT on or off. |
233 // Turn BT on or off. |
235 // --------------------------------------------------------------------------- |
234 // --------------------------------------------------------------------------- |
313 TRACE_FUNC_ENTRY |
312 TRACE_FUNC_ENTRY |
314 TRACE_INFO( ( _L( "[CBTEngServer]\t aAutoOff %d"), aAutoOff )) |
313 TRACE_INFO( ( _L( "[CBTEngServer]\t aAutoOff %d"), aAutoOff )) |
315 TRACE_INFO( ( _L( "[CBTEngServer]\t iSessionCount %d"), iSessionCount )) |
314 TRACE_INFO( ( _L( "[CBTEngServer]\t iSessionCount %d"), iSessionCount )) |
316 iSessionCount--; |
315 iSessionCount--; |
317 iSettingsMgr->SessionClosed( aSession ); |
316 iSettingsMgr->SessionClosed( aSession ); |
318 iPairMan->SessionClosed( aSession ); |
|
319 if( aAutoOff ) |
317 if( aAutoOff ) |
320 { |
318 { |
321 TRAP_IGNORE( SetPowerStateL( EBTOff, ETrue ) ); |
319 TRAP_IGNORE( SetPowerStateL( EBTOff, ETrue ) ); |
322 } |
320 } |
323 else |
321 else |
600 // Main function of the executable. |
598 // Main function of the executable. |
601 // --------------------------------------------------------------------------- |
599 // --------------------------------------------------------------------------- |
602 // |
600 // |
603 GLDEF_C TInt E32Main() |
601 GLDEF_C TInt E32Main() |
604 { |
602 { |
605 __UHEAP_MARK; |
603 //TODO uncomment UHEAP macros after orbit memory leaks are resolved till then it should be commented. |
|
604 // __UHEAP_MARK; |
606 TRACE_FUNC_ENTRY |
605 TRACE_FUNC_ENTRY |
607 CTrapCleanup* cleanup = CTrapCleanup::New(); |
606 CTrapCleanup* cleanup = CTrapCleanup::New(); |
608 TInt err = KErrNoMemory; |
607 TInt err = KErrNoMemory; |
609 if ( cleanup ) |
608 if ( cleanup ) |
610 { |
609 { |
611 TRAP( err, RunServerL() ); |
610 TRAP( err, RunServerL() ); |
612 delete cleanup; |
611 delete cleanup; |
613 } |
612 } |
614 __UHEAP_MARKEND; |
613 // __UHEAP_MARKEND; |
615 return err; |
614 return err; |
616 } |
615 } |