135 // ----------------------------------------------------------------------------- |
135 // ----------------------------------------------------------------------------- |
136 // |
136 // |
137 void CCellbasedtriggerOperations::Delete() |
137 void CCellbasedtriggerOperations::Delete() |
138 { |
138 { |
139 |
139 |
|
140 } |
|
141 |
|
142 |
|
143 // ----------------------------------------------------------------------------- |
|
144 // CCellbasedtriggerOperations::GetCurrentCellInfo |
|
145 // ----------------------------------------------------------------------------- |
|
146 void CCellbasedtriggerOperations::GetCurrentCellInfoL( |
|
147 RMobilePhone::TMobilePhoneNetworkMode& aNetworkMode, |
|
148 CTelephony::TNetworkInfoV1& aNwInfo ) |
|
149 { |
|
150 iLog->Log(_L("+GetCurrentCellInfoL")); |
|
151 CLbtEventObserver* notifier= CLbtEventObserver::NewL(); |
|
152 CleanupStack::PushL( notifier ); |
|
153 CActiveSchedulerWait* wait = new( ELeave ) CActiveSchedulerWait; |
|
154 // Ownership of wait is taken by notifier |
|
155 iLog->Log(_L("+GetCurrentCGIInfo")); |
|
156 notifier->GetCurrentCGIInfo( aNwInfo,wait ); |
|
157 iLog->Log(_L("-GetCurrentCGIInfo")); |
|
158 wait->Start(); |
|
159 iLog->Log(_L("WaitStart")); |
|
160 switch( aNwInfo.iMode ) |
|
161 { |
|
162 case CTelephony::ENetworkModeGsm: |
|
163 aNetworkMode = RMobilePhone::ENetworkModeGsm; |
|
164 break; |
|
165 |
|
166 case CTelephony::ENetworkModeWcdma: |
|
167 aNetworkMode = RMobilePhone::ENetworkModeWcdma; |
|
168 break; |
|
169 |
|
170 default: |
|
171 aNetworkMode = RMobilePhone::ENetworkModeUnknown; |
|
172 } |
|
173 |
|
174 CleanupStack::PopAndDestroy( notifier ); |
|
175 iLog->Log(_L("-GetCurrentCellInfoL")); |
140 } |
176 } |
141 |
177 |
142 // ----------------------------------------------------------------------------- |
178 // ----------------------------------------------------------------------------- |
143 // CCellbasedtriggerOperations::RunMethodL |
179 // CCellbasedtriggerOperations::RunMethodL |
144 // Run specified method. Contains also table of test mothods and their names. |
180 // Run specified method. Contains also table of test mothods and their names. |
6065 TSecureId secureid; |
6101 TSecureId secureid; |
6066 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
6102 trig->SetProcessId(KMyTriggerHandlingProcessName,secureid); |
6067 |
6103 |
6068 // set condition |
6104 // set condition |
6069 |
6105 |
6070 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
6106 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
6071 CActiveSchedulerWait* wait2=new(ELeave)CActiveSchedulerWait; |
6107 CActiveSchedulerWait* wait2=new(ELeave)CActiveSchedulerWait; |
6072 CLbtEventObserver* notifier= CLbtEventObserver::NewL( lbt); |
6108 CLbtEventObserver* notifier= CLbtEventObserver::NewL( lbt); |
6073 CleanupStack::PushL( notifier ); |
6109 CleanupStack::PushL( notifier ); |
6074 CTriggerFireObserver* notifier2= CTriggerFireObserver::NewL( lbt); |
6110 CTriggerFireObserver* notifier2= CTriggerFireObserver::NewL( lbt); |
6075 CleanupStack::PushL( notifier2 ); |
6111 CleanupStack::PushL( notifier2 ); |
6076 |
6112 |
6077 TBuf<4> Networkcountrycode = _L("404"); |
6113 |
6078 TBuf<8> Networkidentitycode = _L("45"); |
6114 RMobilePhone::TMobilePhoneNetworkMode networkMode; |
6079 TUint Locationareacode = 1627; |
6115 CTelephony::TNetworkInfoV1 nwInfo; |
6080 TUint CellId = 11681; |
6116 GetCurrentCellInfoL( networkMode,nwInfo ); |
6081 |
6117 |
6082 CLbtGeoCell* Cellarea = CLbtGeoCell::NewL(RMobilePhone :: ENetworkModeGsm, |
6118 CLbtGeoCell* Cellarea = CLbtGeoCell::NewL( networkMode, |
6083 Networkcountrycode, |
6119 nwInfo.iCountryCode, |
6084 Networkidentitycode, |
6120 nwInfo.iNetworkId, |
6085 Locationareacode, |
6121 nwInfo.iLocationAreaCode, |
6086 CellId |
6122 nwInfo.iCellId ); |
6087 ); |
|
6088 |
6123 |
6089 |
6124 |
6090 // ownership of Cellarea object transferred to the condition object |
6125 // ownership of Cellarea object transferred to the condition object |
6091 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
6126 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
6092 Cellarea, |
6127 Cellarea, |
6162 } |
6195 } |
6163 |
6196 |
6164 //Firing of CGI based Cellular Session trigger |
6197 //Firing of CGI based Cellular Session trigger |
6165 TInt CCellbasedtriggerOperations::TC_LBT_034_62_testL( CStifItemParser& /* aItem */ ) |
6198 TInt CCellbasedtriggerOperations::TC_LBT_034_62_testL( CStifItemParser& /* aItem */ ) |
6166 { |
6199 { |
6167 |
6200 |
6168 RLbtServer lbtserver; |
6201 RLbtServer lbtserver; |
6169 RLbt lbt; |
6202 RLbt lbt; |
6170 iLog->Log(_L("Before connecting")); |
6203 iLog->Log(_L("Before connecting")); |
6171 User::LeaveIfError( lbtserver.Connect() ); |
6204 User::LeaveIfError( lbtserver.Connect() ); |
6172 CleanupClosePushL( lbtserver ); |
6205 CleanupClosePushL( lbtserver ); |
6173 iLog->Log(_L("Connection to RLbtServer Passed ")); |
6206 iLog->Log(_L("Connection to RLbtServer Passed ")); |
6174 User::LeaveIfError( lbt.Open(lbtserver)); |
6207 User::LeaveIfError( lbt.Open(lbtserver)); |
6175 iLog->Log(_L("Subsession opened ")); |
6208 iLog->Log(_L("Subsession opened ")); |
6176 CleanupClosePushL( lbt ); |
6209 CleanupClosePushL( lbt ); |
6177 |
6210 |
6178 |
6211 |
6179 //Construct a startup trigger |
6212 //Construct a startup trigger |
6180 CLbtSessionTrigger* trig = CLbtSessionTrigger::NewL(); |
6213 CLbtSessionTrigger* trig = CLbtSessionTrigger::NewL(); |
6181 |
6214 |
6182 //Push to cleanup stack |
6215 //Push to cleanup stack |
6183 CleanupStack::PushL( trig ); |
6216 CleanupStack::PushL( trig ); |
6184 iLog->Log(_L("Startup Trigger Entry Created ")); |
6217 iLog->Log(_L("Session Trigger Entry Created ")); |
6185 |
6218 |
6186 // Set Name |
6219 // Set Name |
6187 trig->SetNameL(_L("Trigger1")); |
6220 trig->SetNameL(_L("Trigger1")); |
6188 |
6221 // set condition |
6189 |
6222 |
6190 // set condition |
6223 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
6191 |
6224 CActiveSchedulerWait* wait2=new(ELeave)CActiveSchedulerWait; |
6192 CActiveSchedulerWait* wait=new(ELeave)CActiveSchedulerWait; |
6225 CLbtEventObserver* notifier= CLbtEventObserver::NewL( lbt); |
6193 CActiveSchedulerWait* wait2=new(ELeave)CActiveSchedulerWait; |
6226 CleanupStack::PushL( notifier ); |
6194 CLbtEventObserver* notifier= CLbtEventObserver::NewL( lbt); |
6227 CTriggerFireObserver* notifier2= CTriggerFireObserver::NewL( lbt); |
6195 CleanupStack::PushL( notifier ); |
6228 CleanupStack::PushL( notifier2 ); |
6196 CTriggerFireObserver* notifier2= CTriggerFireObserver::NewL( lbt); |
6229 |
6197 CleanupStack::PushL( notifier2 ); |
6230 |
6198 |
6231 RMobilePhone::TMobilePhoneNetworkMode networkMode; |
6199 TBuf<4> Networkcountrycode = _L("404"); |
6232 CTelephony::TNetworkInfoV1 nwInfo; |
6200 TBuf<8> Networkidentitycode = _L("45"); |
6233 GetCurrentCellInfoL( networkMode,nwInfo ); |
6201 TUint Locationareacode = 1627; |
6234 |
6202 TUint CellId = 11681; |
6235 CLbtGeoCell* Cellarea = CLbtGeoCell::NewL( networkMode, |
6203 |
6236 nwInfo.iCountryCode, |
6204 CLbtGeoCell* Cellarea = CLbtGeoCell::NewL(RMobilePhone :: ENetworkModeGsm, |
6237 nwInfo.iNetworkId, |
6205 Networkcountrycode, |
6238 nwInfo.iLocationAreaCode, |
6206 Networkidentitycode, |
6239 nwInfo.iCellId ); |
6207 Locationareacode, |
6240 |
6208 CellId |
6241 |
6209 ); |
6242 // ownership of Cellarea object transferred to the condition object |
6210 |
6243 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
6211 |
6244 Cellarea, |
6212 // ownership of Cellarea object transferred to the condition object |
6245 CLbtTriggerConditionArea::EFireOnEnter); |
6213 CLbtTriggerConditionArea* condition=CLbtTriggerConditionArea::NewL( |
|
6214 Cellarea, |
|
6215 CLbtTriggerConditionArea::EFireOnEnter); |
|
6216 |
|
6217 trig->SetCondition(condition); // ownership transferred to object |
|
6218 |
|
6219 //set Requestor |
|
6220 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
|
6221 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
|
6222 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
|
6223 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
|
6224 TLbtTriggerId trigId; |
|
6225 |
6246 |
6226 notifier->CreateTriggers( lbt,*trig,trigId,EFalse,wait ); |
6247 trig->SetCondition(condition); // ownership transferred to object |
6227 wait->Start( ); |
6248 //set Requestor |
6228 |
6249 CRequestorBase::TRequestorType ReqType=CRequestorBase::ERequestorUnknown; |
6229 iLog->Log(_L("Trigger Created")); |
6250 CRequestorBase::_TRequestorFormat ReqFormat=CRequestorBase::EFormatUnknown; |
6230 notifier->StartCidNotification(wait); |
6251 TBuf<KLbtMaxNameLength> ReqData=_L(""); |
6231 iLog->Log(_L("Cell id change notification requested")); |
6252 trig->SetRequestorL(ReqType,ReqFormat,ReqData); |
6232 notifier2->StartNotification( wait2 ); |
6253 TLbtTriggerId trigId; |
6233 wait2->Start( ); |
6254 |
6234 iLog->Log(_L("Trigger Fired")); |
6255 notifier->CreateTriggers( lbt,*trig,trigId,ETrue,wait ); |
6235 |
6256 wait->Start( ); |
6236 notifier->Cancel(); |
6257 |
6237 TLbtTriggerFireInfo FireInfo; |
6258 notifier2->StartNotification( wait2 ); |
6238 FireInfo = notifier2->GetFiredTrigger(); |
6259 wait2->Start( ); |
6239 |
6260 iLog->Log(_L("Trigger Fired")); |
6240 CLbtTriggerInfo *Triginfo; |
6261 |
6241 iLog->Log(_L("Before GetTriggerLC ")); |
6262 notifier->Cancel(); |
6242 |
6263 TLbtTriggerFireInfo FireInfo; |
6243 Triginfo = lbt.GetTriggerLC(FireInfo.iTriggerId); |
6264 FireInfo = notifier2->GetFiredTrigger(); |
6244 CLbtTriggerEntry *TrigEntry = Triginfo->TriggerEntry(); |
6265 |
6245 |
6266 CLbtTriggerInfo *Triginfo; |
6246 //Check Condition of the trigger |
6267 iLog->Log(_L("Before GetTriggerLC ")); |
6247 CLbtTriggerConditionArea* Condition2 = static_cast <CLbtTriggerConditionArea*>(TrigEntry->GetCondition()); |
6268 |
6248 |
6269 Triginfo = lbt.GetTriggerLC(FireInfo.iTriggerId); |
6249 CLbtGeoAreaBase* area = Condition2->TriggerArea(); |
6270 //Triginfo = lbt.GetTriggerLC(trigId); |
6250 |
6271 CLbtTriggerEntry *TrigEntry = Triginfo->TriggerEntry(); |
6251 if(area->Type()==CLbtGeoAreaBase::ECellular) |
6272 |
6252 { |
6273 //Check Condition of the trigger |
6253 CLbtGeoCell* cell=NULL; |
6274 CLbtTriggerConditionArea* Condition2 = static_cast <CLbtTriggerConditionArea*>(TrigEntry->GetCondition()); |
6254 cell= static_cast<CLbtGeoCell*> (area); |
6275 |
6255 if(cell->CellId()==CellId) |
6276 CLbtGeoAreaBase* area = Condition2->TriggerArea(); |
6256 { |
6277 |
6257 CleanupStack::PopAndDestroy( Triginfo ); |
6278 if(area->Type()==CLbtGeoAreaBase::ECellular) |
6258 CleanupStack::PopAndDestroy( notifier2 ); |
6279 { |
6259 CleanupStack::PopAndDestroy( notifier ); |
6280 CLbtGeoCell* cell=NULL; |
6260 CleanupStack::PopAndDestroy( trig ); |
6281 cell= static_cast<CLbtGeoCell*> (area); |
6261 CleanupStack::Pop( &lbt ); |
6282 if(cell->CellId()==nwInfo.iCellId) |
6262 CleanupStack::PopAndDestroy( &lbtserver ); |
6283 { |
6263 //delete wait; |
6284 CleanupStack::PopAndDestroy( Triginfo ); |
6264 //delete wait2; |
6285 CleanupStack::PopAndDestroy( notifier2 ); |
6265 return KErrNone; |
6286 CleanupStack::PopAndDestroy( notifier ); |
6266 } |
6287 CleanupStack::PopAndDestroy( trig ); |
6267 else |
6288 CleanupStack::Pop( &lbt ); |
6268 { |
6289 CleanupStack::PopAndDestroy( &lbtserver ); |
6269 CleanupStack::PopAndDestroy( Triginfo ); |
6290 // //delete wait; |
6270 CleanupStack::PopAndDestroy( notifier2 ); |
6291 // //delete wait2; |
6271 CleanupStack::PopAndDestroy( notifier ); |
6292 return KErrNone; |
6272 CleanupStack::PopAndDestroy( trig ); |
6293 } |
6273 CleanupStack::Pop( &lbt ); |
6294 else |
6274 CleanupStack::PopAndDestroy( &lbtserver ); |
6295 { |
6275 //delete wait; |
6296 CleanupStack::PopAndDestroy( Triginfo ); |
6276 //delete wait2; |
6297 CleanupStack::PopAndDestroy( notifier2 ); |
6277 return -99; |
6298 CleanupStack::PopAndDestroy( notifier ); |
6278 } |
6299 CleanupStack::PopAndDestroy( trig ); |
6279 } |
6300 CleanupStack::Pop( &lbt ); |
6280 return KErrNone; |
6301 CleanupStack::PopAndDestroy( &lbtserver ); |
6281 } |
6302 // //delete wait; |
|
6303 // //delete wait2; |
|
6304 return -99; |
|
6305 } |
|
6306 } |
|
6307 |
|
6308 |
|
6309 return KErrNone; |
|
6310 |
|
6311 } |
6282 |
6312 |
6283 //Test case to check hysteresis condition for cell based triggers |
6313 //Test case to check hysteresis condition for cell based triggers |
6284 TInt CCellbasedtriggerOperations::TC_LBT_034_65_testL( CStifItemParser& /* aItem */ ) |
6314 TInt CCellbasedtriggerOperations::TC_LBT_034_65_testL( CStifItemParser& /* aItem */ ) |
6285 { |
6315 { |
6286 |
6316 |