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