// --------------------------------------------------------- // CT_LbsInstallPsyTp273::NotifyPositionUpdate // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsInstallPsyTp273::NotifyPositionUpdate( TPositionInfoBase& aPosInfo, TRequestStatus& aStatus) { TInt err = KErrNone; TTime tt; tt.UniversalTime(); //Request ID must be unique, use universalime as seed // to give a random number TInt64 seed = tt.Int64(); TReal lat = 90 * Math::FRand(seed); TReal lon = 90 * Math::FRand(seed); TReal32 alt = (TReal32)(90 * Math::FRand(seed)); TPositionInfo* position = static_cast<TPositionInfo*> (&aPosInfo); TUid implUid = { KPosImplementationUid }; position->SetModuleId(implUid); TTime now; now.UniversalTime(); TPosition posse; posse.SetCoordinate(lat, lon, alt); posse.SetTime(now); position->SetPosition(posse); TRequestStatus* status = &aStatus; User::RequestComplete(status, err); }
// --------------------------------------------------------- // CT_LbsTestTimerPsy::NotifyPositionUpdate // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsTestTimerPsy::NotifyPositionUpdate( TPositionInfoBase& aPosInfo, TRequestStatus& aStatus) { TPositionInfo* position = NULL; position = static_cast<TPositionInfo*> (&aPosInfo); iStatus = &aStatus; *iStatus = KRequestPending; TUid implUid = { KPosImplementationUid }; position->SetModuleId(implUid); if (iTrackingEnabled) { // Set this position when tracking is enabled (on-going) TCoordinate coor(55.0, 55.0, 55.0); TLocality loc (coor, 1.0, 1.0); TPosition pos (loc, TTime(0)); position -> SetPosition(pos); } else { // Set a dummy position TCoordinate coor(20.0, 20.0, 20.0); TLocality loc (coor, 1.0, 1.0); TPosition pos (loc, TTime(0)); position -> SetPosition(pos); User::RequestComplete(iStatus, KErrNone); } }
// --------------------------------------------------------- // CT_LbsTestPsySimulateIsa::NotifyPositionUpdate // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsTestPsySimulateIsa::NotifyPositionUpdate( TPositionInfoBase& aPosInfo, TRequestStatus& /*aStatus*/) { TPositionInfo* iPosition = static_cast<TPositionInfo*> (&aPosInfo); TUid implUid = { KPosImplementationUid }; iPosition->SetModuleId(implUid); }
// --------------------------------------------------------- // CT_LbsStubPositioner::NotifyPositionUpdate // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsStubPositioner::NotifyPositionUpdate( TPositionInfoBase& aPosInfo, TRequestStatus& aStatus) { TPositionInfo* position = static_cast<TPositionInfo*> (&aPosInfo); TUid implUid = { KPosImplementationUid }; position->SetModuleId(implUid); TRequestStatus* status = &aStatus; User::RequestComplete(status, KErrNone); }
void CLcfPsyDummy1::GetBasicPositionInfoL(TPositionInfoBase& aPosInfo) { // The position info object is at least a TPositionInfo TPositionInfo* posInfo = static_cast<TPositionInfo*>(&aPosInfo); TPosition pos; // Calculate the position and fill in the position info // object // Latitude, Longtitude, altitude pos.SetCoordinate(57.1, 11.3, 32.5); // set horizontal and vertical accuracy pos.SetAccuracy(40.0, 40.0); // set time of fix pos.SetCurrentTime(); // Set position in position info. posInfo->SetPosition(pos); // Set the implementation uid posInfo->SetModuleId(ImplementationUid()); }
void CLcfPsyDummy3::GetBasicPositionInfoL(TPositionInfoBase& aPosInfo) { // The position info object is at least a TPositionInfo TPositionInfo* posInfo = static_cast<TPositionInfo*>(&aPosInfo); TPosition pos; // Calculate the position and fill in the position info // object pos.SetCoordinate(67.567, -12.34, 45.32); // set horizontal and vertical accuracy pos.SetAccuracy(150.0, 500.0); // set time of fix pos.SetCurrentTime(); // Set position in position info. posInfo->SetPosition(pos); // Set the implementation uid posInfo->SetModuleId(ImplementationUid()); }
// --------------------------------------------------------- // CTestPsy2Positioner::NotifyPositionUpdate // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsTestProxyPsy2Positioner::NotifyPositionUpdate(TPositionInfoBase& aPosInfo, TRequestStatus& aStatus) { TBuf<256> buf; OpenFileForAppend(); _LIT(KTestProxyPsy2Positioner, " Request issued to TestProxyPsy2Positioner"); buf.Append(KTestProxyPsy2Positioner); _LIT(KAppend, "\r"); buf.Append(KAppend); iFileText.Write(buf); iFile.Close(); TRequestStatus* status = &aStatus; TPositionInfo* posInfo = static_cast<TPositionInfo*> (&aPosInfo); TPosition pos; pos.SetCoordinate(10, 20, 30); posInfo->SetPosition(pos); TUid implUid = { KPosImplementationUid }; posInfo->SetModuleId(implUid); TUint32 request = posInfo->UpdateType(); switch (request) { // case 1-10 - TC269 // case 11-15 - TC270 // case 21-26 - TC271 case 1: case 5: case 12: case 13: case 14: case 21: case 23: case 24: User::RequestComplete( status, KPositionPartialUpdate); break; case 2: case 3: case 4: case 11: case 15: case 22: User::RequestComplete( status, KErrLocked); break; case 6: case 9: case 10: case 25: User::RequestComplete( status, KErrDied); break; case 7: case 8: case 26: User::RequestComplete( status, KErrBadPower); break; case 4701: iRequestHandler->SetErrorCode(KErrNone); iRequestHandler->SetTimerDelay(2000000); iRequestHandler->NotifyPositionUpdate(posInfo, status); break; case 4702: iRequestHandler->SetErrorCode(KErrNone); iRequestHandler->SetTimerDelay(3000000); iRequestHandler->NotifyPositionUpdate(posInfo, status); break; case 4703: iRequestHandler->SetErrorCode(KErrNone); iRequestHandler->SetTimerDelay(2000000); iRequestHandler->NotifyPositionUpdate(posInfo, status); break; case 4704: iRequestHandler->SetErrorCode(KErrNone); iRequestHandler->SetTimerDelay(3000000); iRequestHandler->NotifyPositionUpdate(posInfo, status); break; case 4708: case 304: iRequestHandler->SetErrorCode(KErrNone); iRequestHandler->SetTimerDelay(1000000); // 1 second iRequestHandler->NotifyPositionUpdate(posInfo, status); break; case 100: iRequestHandler->ReportStatus( TPositionModuleStatus::EDeviceInitialising, TPositionModuleStatus::EDataQualityUnknown); User::RequestComplete( status, KErrNone ); break; case 200: iRequestHandler->ReportStatus( TPositionModuleStatus::EDeviceActive, TPositionModuleStatus::EDataQualityUnknown); User::RequestComplete( status, KErrNone ); break; default: User::RequestComplete( status, KErrDied); break; } }
TVerdict ClbsinternalapiTest3Step::doTestStepL() /** * @return - TVerdict code * Override of base class pure virtual * Our implementation only gets called if the base class doTestStepPreambleL() did * not leave. That being the case, the current test result value will be EPass. */ { if (TestStepResult()==EPass) { //Let's test! TPositionExtendedSatelliteInfo posSatInfo; RLbsPositionUpdates::InitializeL(posSatInfo); RLbsPositionUpdates posUpdates; //First Open, Close, re-Open to check for handle leaks etc. posUpdates.OpenL(KLbsGpsLocManagerUid); CleanupClosePushL(posUpdates); CleanupStack::PopAndDestroy(&posUpdates); posUpdates.OpenL(KLbsGpsLocManagerUid); CleanupClosePushL(posUpdates); //First, check the default data is OK. //Should be a default TPositionExtendedSatelliteInfo. TPositionExtendedSatelliteInfo satInfo; //Put some non-default data in it, then check we get the default data back. satInfo.SetSatelliteTime(TTime(500)); TInt error=1; TTime targetTime(100); TTime actualTime(200); TBool conflictControl; error = posUpdates.GetPositionInfo(conflictControl, &satInfo, sizeof(satInfo),targetTime, actualTime); //Now check we got deviuce not ready if(error!=KErrNotReady) User::Leave(KErrGeneral); //Now check that the same for TPositionInfo and TPositionCourseInfo TPositionInfo posInfo; posInfo.SetModuleId(KLbsGpsLocManagerUid); error = posUpdates.GetPositionInfo(conflictControl, &posInfo, sizeof(posInfo),targetTime, actualTime); if(error!=KErrNotReady) User::Leave(KErrGeneral); TPositionCourseInfo courseInfo; TCourse course; course.SetSpeed(TReal32(100)); courseInfo.SetCourse(course); error = posUpdates.GetPositionInfo(conflictControl, &courseInfo, sizeof(courseInfo),targetTime, actualTime); if(error!=KErrNotReady) User::Leave(KErrGeneral); //OK - we are now reasonably happy with Getting - it donsn't mash up the class size/type data //and it seems to be doing the data copying OK. //Next move onto the set method... //Choose some dummy values. error = KErrGeneral; targetTime = 1000; actualTime = 1001; satInfo.SetSatelliteTime(TTime(4020)); User::LeaveIfError(posUpdates.SetPositionInfo(error, EFalse, &satInfo, sizeof(satInfo),targetTime, actualTime)); error = posUpdates.GetPositionInfo(conflictControl, &satInfo, sizeof(satInfo),targetTime, actualTime); if(error!=KErrGeneral) User::Leave(KErrGeneral); if(conflictControl!=EFalse) User::Leave(KErrGeneral); if(targetTime!=1000) User::Leave(KErrGeneral); if(actualTime!=1001) User::Leave(KErrGeneral); if(satInfo.SatelliteTime()!=TTime(4020)) User::Leave(KErrGeneral); //Go on to check out notifications. //Open another handle. RLbsPositionUpdates posUpdates2; //First Open, Close, re-Open to check for handle leaks etc. posUpdates2.OpenL(KLbsGpsLocManagerUid); CleanupClosePushL(posUpdates2); TRequestStatus stat; posUpdates2.NotifyPositionUpdate(stat); User::LeaveIfError(posUpdates.SetPositionInfo(error, EFalse, &satInfo, sizeof(satInfo),targetTime, actualTime)); User::WaitForRequest(stat); if(stat.Int()!=KErrNone) User::Leave(KErrGeneral); //Now check the cancel. posUpdates2.NotifyPositionUpdate(stat); posUpdates2.CancelNotifyPositionUpdate(); User::WaitForRequest(stat); if(stat.Int()!=KErrCancel) User::Leave(KErrGeneral); CleanupStack::PopAndDestroy(2, &posUpdates); SetTestStepResult(EPass); } return TestStepResult(); }