equal
deleted
inserted
replaced
28 #include "BTAccSession.h" // create server's session |
28 #include "BTAccSession.h" // create server's session |
29 #include "debug.h" |
29 #include "debug.h" |
30 #include "btmanclient.h" // TBTDevAddrPckgBug |
30 #include "btmanclient.h" // TBTDevAddrPckgBug |
31 #include "basrvaccman.h" |
31 #include "basrvaccman.h" |
32 #include "BTAccInfo.h" |
32 #include "BTAccInfo.h" |
|
33 #include "btaccpanic.h" |
33 |
34 |
34 /** PubSub key read and write policies */ |
35 /** PubSub key read and write policies */ |
35 _LIT_SECURITY_POLICY_C1( KBTEngPSKeyReadPolicy, |
36 _LIT_SECURITY_POLICY_C1( KBTEngPSKeyReadPolicy, |
36 ECapabilityLocalServices); |
37 ECapabilityLocalServices); |
37 _LIT_SECURITY_POLICY_C1( KBTEngPSKeyWritePolicy, |
38 _LIT_SECURITY_POLICY_C1( KBTEngPSKeyWritePolicy, |
76 RThread().SetPriority(EPriorityRealTime); |
77 RThread().SetPriority(EPriorityRealTime); |
77 return self; |
78 return self; |
78 } |
79 } |
79 |
80 |
80 void CBTAccServer::StartShutdownTimerIfNoSessions() |
81 void CBTAccServer::StartShutdownTimerIfNoSessions() |
81 { |
82 { |
82 if (iSessions.Count() == 0 && (!iTimer || !iTimer->IsActive())) |
83 TRACE_FUNC |
83 { |
84 __ASSERT_DEBUG(iTimer, BTACC_PANIC(ENoShutdownTimer)); |
84 if (!iTimer) |
85 if (iSessions.Count() == 0 && !iTimer->IsActive()) |
85 { |
86 { |
86 TRAP_IGNORE(iTimer = CPeriodic::NewL(CActive::EPriorityStandard)); |
87 iTimer->Start(KShutdownDelay, 0, TCallBack(CBTAccServer::TimerFired, this)); |
87 } |
88 } |
88 |
89 } |
89 if (iTimer) |
|
90 { |
|
91 iTimer->Start(KShutdownDelay, 0, TCallBack(CBTAccServer::TimerFired, this)); |
|
92 } |
|
93 |
|
94 TRACE_FUNC |
|
95 } |
|
96 } |
|
97 |
90 |
98 void CBTAccServer::ClientOpened(CBTAccSession& aSession) |
91 void CBTAccServer::ClientOpenedL(CBTAccSession& aSession) |
99 { |
92 { |
100 TRACE_FUNC |
93 TRACE_FUNC |
101 |
94 |
102 //cancel the timer to prevent the server from shutting down |
95 //add the session to the array of sessions |
|
96 iSessions.AppendL(&aSession); |
|
97 |
|
98 //cancel the timer to prevent the server from shutting down |
103 CancelShutdownTimer(); |
99 CancelShutdownTimer(); |
104 |
100 } |
105 //add the session to the array of sessions |
|
106 (void)iSessions.Append(&aSession); |
|
107 } |
|
108 |
101 |
109 void CBTAccServer::ClientClosed(CBTAccSession& aSession) |
102 void CBTAccServer::ClientClosed(CBTAccSession& aSession) |
110 { |
103 { |
111 TRACE_FUNC_ENTRY |
104 TRACE_FUNC_ENTRY |
112 |
105 |
146 } |
139 } |
147 |
140 |
148 void CBTAccServer::ConstructL() |
141 void CBTAccServer::ConstructL() |
149 { |
142 { |
150 iAccMan = CBasrvAccMan::NewL(); |
143 iAccMan = CBasrvAccMan::NewL(); |
151 iAccMan->LoadServicesL(); |
144 |
152 |
145 iTimer = CPeriodic::NewL(CActive::EPriorityStandard); |
|
146 |
153 User::LeaveIfError(RProperty::Define(KPSUidBluetoothEnginePrivateCategory, |
147 User::LeaveIfError(RProperty::Define(KPSUidBluetoothEnginePrivateCategory, |
154 KBTHfpATCommand, RProperty::EByteArray, |
148 KBTHfpATCommand, RProperty::EByteArray, |
155 KBTEngPSKeyReadPolicy, |
149 KBTEngPSKeyReadPolicy, |
156 KBTEngPSKeyWritePolicy)); |
150 KBTEngPSKeyWritePolicy)); |
157 User::LeaveIfError(RProperty::Define(KPSUidBluetoothEnginePrivateCategory, |
151 User::LeaveIfError(RProperty::Define(KPSUidBluetoothEnginePrivateCategory, |
160 KBTEngPSKeyWritePolicy)); |
154 KBTEngPSKeyWritePolicy)); |
161 } |
155 } |
162 |
156 |
163 void CBTAccServer::CancelShutdownTimer() |
157 void CBTAccServer::CancelShutdownTimer() |
164 { |
158 { |
165 delete iTimer; |
159 iTimer->Cancel(); |
166 iTimer = NULL; |
|
167 } |
160 } |
168 |
161 |
169 TInt CBTAccServer::TimerFired(TAny* /*aThis*/) |
162 TInt CBTAccServer::TimerFired(TAny* /*aThis*/) |
170 { |
163 { |
171 CActiveScheduler::Stop(); |
164 CActiveScheduler::Stop(); |