// --------------------------------------------------------- // CPosTp4707::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp4707::StartL() { ConnectL(); SetupProxyPSYsL(); TInt err = OpenPositioner(); _LIT(KOpenErr, "Error when opening positioner, %d"); AssertTrueL(err == KErrNone, KOpenErr, err); _LIT(KServiceName, "TP4707"); iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); // Issue a pre position request TInt request = 100; TPositionInfo posInfo; RequestL(posInfo, request, KEspectedErrorCodePSY1); // // Request 1 // // Check that partial update is not supported TPositionUpdateOptions updateOptions; updateOptions.SetAcceptPartialUpdates(ETrue); iPositioner.SetUpdateOptions(updateOptions); request = 4707; RequestL(posInfo, request, KEspectedErrorCodePSY2); VerifyPositionFromL(posInfo, iUidTestPsyPartialUpdate); VerifyRequestTimeLessThanL(5001000); VerifyPositionL(posInfo, 30, 40, 50); }
// --------------------------------------------------------- // CPosTp4702::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp4702::StartL() { ConnectL(); SetupProxyPSYsL(); TInt err = OpenPositioner(); _LIT(KOpenErr, "Error when opening positioner, %d"); AssertTrueL(err == KErrNone, KOpenErr, err); _LIT(KServiceName, "TP4702"); iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); // // Request 1 // TInt request = 4702; TPositionInfo posInfo; RequestL(posInfo, request, KEspectedErrorCodePSY1); VerifyPositionFromL(posInfo, iUidTestProxyPsy1); VerifyRequestTimeLessThanL(7500000); /*Default proxy fallbacks to testproxypsy2 because of time-shift,fix will be given by TestProxyPsy1 first.*/ VerifyPsyLoadedL(iUidTestProxyPsy1); VerifyPsyLoadedL(iUidTestProxyPsy2); VerifyPositionL(posInfo, 5, 15, 25); }
// ----------------------------------------------------------------------------- // CHttpConnHandler::SetConnectionNameL // ?implementation_description // (other items were commented in a header). // ----------------------------------------------------------------------------- // void CHttpConnHandler::SetConnectionNameL( const TDesC& aConnName ) { CLOG_WRITE_1( "connName: %S", &aConnName ); if( !IsConnected() ) { if( aConnName.Length() ) { if( !iConnName ) { iConnName = HBufC::NewL( KMaxName ); } iConnName->Des().Copy( aConnName ); ConnectL(); } else // forget the connection name { delete iConnName; iConnName = NULL; } } else { CLOG_WRITE( "Connected!!!" ); User::Leave( KErrInUse ); } }
void CT_LbsSimulationPsyPosTp400::StartL() { // Setup test environment iNrOfRequests = 0; ConnectL(); SetupPsyL(iUidSimulationPsy); RunTestsL(iIndex); }
void CTcpSymbianEngine::ConnectL(const TDesC8& aServerName, TUint aPort, TInt aIAP, TBool aConsiderWLAN) { DBG("ConnectL(%*s, %u, %d)", aServerName.Length(), aServerName.Ptr(), aPort, aIAP); HBufC* wide = HBufC::NewLC(aServerName.Length() + 4); TPtr wide_p = wide->Des(); WFTextUtil::TDesWiden(wide_p, aServerName); ConnectL(*wide, aPort, aIAP, aConsiderWLAN); CleanupStack::PopAndDestroy(wide); }
/* void CRoadMapNativeSocket::ConnectL(int aAddress, int aPort) { TInetAddr address; address.SetPort(aPort); address.SetAddress(aAddress); m_Socket.Connect(address, iStatus); m_eNetStatus = ESockStatusConnecting; SetActive(); } */ void CRoadMapNativeSocket::ConnectL(const TDesC& aHostname, int aPort) { roadmap_net_mon_connect(); User::LeaveIfError(m_HostResolver.Open(*m_pSocketServer, KAfInet, KProtocolInetUdp)); // Issue DNS request TRequestStatus aStatus; m_HostResolver.GetByName(aHostname, m_NameEntry, aStatus); m_eNetStatus = ESockStatusDNSLookup; User::WaitForRequest(aStatus); m_eNetStatus = ESockStatusDNSDone; m_Addr = m_NameEntry().iAddr; m_Addr.SetPort(aPort); // And connect to the IP address ConnectL(m_Addr); }
// --------------------------------------------------------- // CPosTp4723::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp4723::StartL() { ConnectL(); SetupProxyPSYsL(); TPositionModuleId modId = iUidSatInfoPsy; CRepository* repos = CRepository::NewL( KCRUidDefaultProxyConfiguration ); TBuf<40> idBuf; idBuf.AppendNumFixedWidth( modId.iUid, EHex, 8); TInt error = repos->Set(KDefaultProxyLastWorkingGpsPsy, idBuf); delete repos; User::LeaveIfError(error); TInt err = OpenPositioner(); _LIT(KOpenErr, "Error when opening positioner, %d"); AssertTrueL(err == KErrNone, KOpenErr, err); _LIT(KServiceName, "TP4723"); iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); TPositionSatelliteInfo posInfo; // Request value should be 4722, even for TP4723... TInt request = 4722; // Default PSY won't pre-load Multi PSY since it is Internal VerifyPsyUnloadedL(iUidMultiPsy); // Default PSY should pre-load SetInfo PSY since it is External and supports GPS VerifyPsyLoadedL(iUidSatInfoPsy); // // Request 1 // RequestL(posInfo, request, KEspectedErrorCodePSY1); VerifyPositionFromL(posInfo, iUidSatInfoPsy); VerifyRequestTimeLessThanL(1200000); VerifyPsyLoadedL(iUidSatInfoPsy); VerifyPositionL(posInfo, 40, 50, 60); }
void CBBListenerImpl::SetFilterL() { CALLSTACKITEM_N(_CL("CBBListenerImpl"), _CL("SetFilterL")); Log(_L("CBBListener::SetFilterL()")); TInt errorcount=0, err=KErrNone; while (errorcount<5) { TRequestStatus s; iBBClient.AddNotificationL(KListener, s); User::WaitForRequest(s); err=s.Int(); if (err==KErrNone) { iBBClient.AddNotificationL(KLocaMessageStatusTuple, ETrue, EBBPriorityNormal, s); User::WaitForRequest(s); err=s.Int(); } if (err==KErrNone) { iBBClient.AddNotificationL(KLastKnownGpsTuple, ETrue, EBBPriorityNormal, s); User::WaitForRequest(s); err=s.Int(); } if (err==KErrNone) { iBBClient.AddNotificationL(KLocaErrorTuple, ETrue, EBBPriorityNormal, s); User::WaitForRequest(s); err=s.Int(); } if (err==KErrNone) return; ConnectL(); errorcount++; } User::Leave(err); }
// --------------------------------------------------------- // CT_LbsClientPosTp272::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp272::StartL() { _LIT(KOpenErr, "Error when opening MultiPSY, %d"); _LIT(KServiceName, "TP272"); SetupPsyL(iUidMultiPsy); ConnectL(); TInt err = OpenPositionerByName(iUidMultiPsy); AssertTrueSecL(err == KErrNone, KOpenErr, err); iPositioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceName); SetPeriodicUpdateL(KUpdateInterval); TInt request=0; // NotifyPositionUpdate should be called direct by the server on the first request // even if update interval is used RequestL(++request, KMinTimeLimitRequest1, KMaxTimeLimitRequest1); // Even if same update interval is set again should the first request complete direct SetPeriodicUpdateL(KUpdateInterval); RequestL(++request, KMinTimeLimitRequest2, KMaxTimeLimitRequest2); // NotifyPositionUpdate should be called after the update interval on the second request // but when the update interval is changed should it be called direct RequestL(++request, KMinTimeLimitRequest2, KMaxTimeLimitRequest2, KUpdateInterval2); // Now should the request time be about 10 sec RequestL(++request, KMinTimeLimitRequest3, KMaxTimeLimitRequest3); SetPeriodicUpdateL(KUpdateInterval3); // Should return direct since update interval changed again RequestL(++request, KMinTimeLimitRequest4, KMaxTimeLimitRequest4); }
// --------------------------------------------------------- // CT_LbsClientPosTp2::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp2::StartL() { SetupPsyL(iUidMultiPsy); //synchronous request ConnectL(); User::LeaveIfError(OpenPositionerByName(iUidMultiPsy)); TPositionInfo info = TPositionInfo(); RequestL(info); CheckPositionInfoL(info); TPositionCourseInfo courseInfo; RequestL(courseInfo); CheckPositionCourseInfoL(courseInfo); TPositionSatelliteInfo satelliteInfo; RequestL(satelliteInfo); CheckPositionSatelliteInfoL(satelliteInfo); HPositionGenericInfo* genericInfo = HPositionGenericInfo::NewLC(); RequestL(*genericInfo); CheckGenericInfoL(*genericInfo); CleanupStack::PopAndDestroy(); //genericInfo ClosePositioner(); Disconnect(); }
void CT_LbsClientPosTp178::TestOptionL() { SetupPsyL(iUidTestPsy3); RPositioner positioner; ConnectL(); User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3)); CleanupClosePushL(positioner); _LIT(KKalle, "Kalle"); positioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KKalle); TPositionUpdateOptions updateOptions; TTimeIntervalMicroSeconds timeoutInterval(4000000); TTimeIntervalMicroSeconds periodicInterval(7000000); updateOptions.SetUpdateTimeOut(timeoutInterval); updateOptions.SetUpdateInterval(periodicInterval); TInt err = positioner.SetUpdateOptions(updateOptions); if (err != KErrArgument) { _LIT(KErrArg, "Possible to set timout < update interval, error code = %d"); TBuf<100> buf; buf.Format(KErrArg, err); INFO_PRINTF1(buf); LogErrorAndLeaveL(buf); } //should never be runned; CleanupStack::PopAndDestroy(1); //positioner Disconnect(); }
// --------------------------------------------------------- // CT_LbsClientPosTp178::TestCancel // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp178::TestCancelL() { _LIT(KSTART, "TestCancel()"); _LIT(KEND, "TestCancel() passed"); // Setup verification stuff INFO_PRINTF1(KSTART); _LIT(KService, "SAAA"); ConnectL(); SetupPsyL(iUidTestPsy3); OpenPositionerByName(iUidTestPsy3); PerformRequestL(KService, CRequestor::ERequestorService, CRequestor::EFormatApplication); StartSchedulerForAWhile178L(2000000); iPositioner.CancelRequest(EPositionerNotifyPositionUpdate); CheckRequestResultL(KErrCancel); ClosePositioner(); Disconnect(); INFO_PRINTF1(KEND); }
void CTcpSymbianEngine::ConnectL(const TDesC& aServerName, TUint aPort, TInt aIAP, TBool aConsiderWLAN) { DBG("ConnectL(HOST, %u, %d)", aPort, aIAP); //see if state is EComplete. used several times below const TBool stateComplete = (EngineState() == EComplete); //The changeServer variable indicates that we must close the //current connection and open a new one. const TBool changeServer = !stateComplete && iHostName && (*iHostName != aServerName || iPort != aPort); DBG("stateComplete: %d, changeServer: %d", stateComplete, changeServer); if(changeServer){ WARN("Switching server, danger will robinson"); Stop(ESwitching); SetConnectionParamsL(aServerName, aPort, aIAP, aConsiderWLAN); } else { DBG("No need to change server"); if(stateComplete){ DBG("update params"); SetConnectionParamsL(aServerName, aPort, aIAP, aConsiderWLAN); } ConnectL(); } }
void CBBListenerImpl::ConstructL() { CALLSTACKITEM_N(_CL("CBBListenerImpl"), _CL("ConstructL")); iCurrentBuf=CXmlBufExternalizer::NewL(2048); iFreeBuf=CXmlBufExternalizer::NewL(2048); iSerializedData=HBufC8::NewL(2048); iTimer=CTimeOut::NewL(*this); iTimer->Wait(KInitialAckInterval); iFactory=BBDataFactory(); iTuple=new (ELeave) CBBTuple(iFactory); iToAck=CList<TUint>::NewL(); iSeenDb=CDb::NewL(AppContext(), _L("REMOTE_IDS"), EFileWrite); iSeenIds=CSeenIds::NewL(iSeenDb->Db()); ConnectL(); SetFilterL(); iGetState=EWaitForNotify; CActiveScheduler::Add(this); }
void CRoadMapNativeSocket::ConnectWithParamsL() { TInetAddr addr; TBuf<256> hostName; char *hostname = NULL; char *separator = NULL; char *separator_slash = NULL; bool isIPAddr = false; int port = -1; int err = 0; hostname = strdup(m_hostname); roadmap_check_allocated(hostname); isIPAddr = isdigit(m_hostname[0]); separator = strchr (m_hostname, ':'); // Get port number, either parsing or default to the one supplied if (separator != NULL) { //TODO fix //port = s->GetPortFromService(separator+1); if (port < 0) { if (isdigit(separator[1])) { port = atoi(separator+1); if (port == 0) { roadmap_log (ROADMAP_ERROR, "invalid port in '%s'", m_hostname); free(hostname); User::Leave(KErrArgument); // bad params } } else { roadmap_log (ROADMAP_ERROR, "invalid service in '%s'", m_hostname); free(hostname); User::Leave(KErrArgument); // bad params } } *(strchr(hostname, ':')) = 0; } else { port = m_port; } // init addr with port addr.SetPort(port); // init addr with hostname (if any) GSConvert::CharPtrToTDes16(hostname, hostName); free(hostname); if (isIPAddr == true) { addr.Input(hostName); ConnectL(addr); } else { ConnectL(hostName, port); } }
// --------------------------------------------------------- // CT_LbsClientPosTp261::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp261::StartL() { _LIT(KService1, "Service1"); _LIT(KService2, "Service2"); _LIT(KService3, "Service3"); _LIT(KContact1, "Contact1"); _LIT(KContact2, "Contact2"); _LIT(KContact3, "Contact3"); CRequestor* serviceId1 = CRequestor::NewL(CRequestor::ERequestorService, CRequestor::EFormatApplication, KService1); CRequestor* serviceId2 = CRequestor::NewL(CRequestor::ERequestorService, CRequestor::EFormatApplication, KService2); CRequestor* serviceId3 = CRequestor::NewL(CRequestor::ERequestorService, CRequestor::EFormatApplication, KService3); CRequestor* contactId1 = CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatTelephone, KContact1); CRequestor* contactId2 = CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatUrl, KContact2); CRequestor* contactId3 = CRequestor::NewL(CRequestor::ERequestorContact, CRequestor::EFormatMail, KContact3); RRequestorStack stack = RRequestorStack(); CleanupStack::PushL(TCleanupItem(CleanOp ,&stack)); CleanupStack::PushL(serviceId1); CleanupStack::PushL(serviceId2); CleanupStack::PushL(serviceId3); CleanupStack::PushL(contactId1); CleanupStack::PushL(contactId2); CleanupStack::PushL(contactId3); ConnectL(); OpenPositioner(); stack.Append(serviceId1); stack.Append(contactId1); stack.Append(contactId2); stack.Append(serviceId2); stack.Append(contactId3); stack.Append(serviceId3); CleanupStack::Pop(contactId3); CleanupStack::Pop(contactId2); CleanupStack::Pop(contactId1); CleanupStack::Pop(serviceId3); CleanupStack::Pop(serviceId2); CleanupStack::Pop(serviceId1); TInt err = iPositioner.SetRequestor(stack); if (err != KErrNone) { _LIT(KErrorAndLeave, "Problems setting requestorstack"); LogErrorAndLeaveL(KErrorAndLeave); } const TInt KPosBufFlatExpandSize = 100; //ExternalizeL CBufFlat* bufFlat = CBufFlat::NewL(KPosBufFlatExpandSize); CleanupStack::PushL(bufFlat); RBufWriteStream stream(*bufFlat); CleanupClosePushL(stream); stack.ExternalizeL(stream); TPtr8 dataPtr((TUint8*)NULL, 0); dataPtr.Set(bufFlat->Ptr(0)); CleanupStack::PopAndDestroy(&stream); HBufC8* tempBuf = HBufC8::NewLC(bufFlat->Size()); TPtr8 ptr = tempBuf->Des(); ptr = dataPtr; //Internalize bufFlat->InsertL(0, ptr); RBufReadStream rstream(*bufFlat); CleanupClosePushL(rstream); RRequestorStack stack2 = RRequestorStack(); CleanupStack::PushL(TCleanupItem(CleanOp ,&stack2)); stack2.InternalizeL(rstream); // Verify the requestor stack VerifyRequestorStackL(stack2); _LIT(KResult, "The RequestorStack is correct after Externalize/Internalize"); INFO_PRINTF1(KResult); CleanupStack::PopAndDestroy(1); // CleanupOp stack2 CleanupStack::PopAndDestroy(&rstream); CleanupStack::PopAndDestroy(tempBuf); CleanupStack::PopAndDestroy(bufFlat); CleanupStack::PopAndDestroy(1); // CleanupOp stack1 ClosePositioner(); Disconnect(); }
void CBBListenerImpl::CheckedRunL() { CALLSTACKITEM_N(_CL("CBBListenerImpl"), _CL("CheckedRunL")); #ifdef __WINS__ //User::Leave(KErrGeneral); #endif Log(_L("CheckedRunL()")); { if (iStatus.Int()!=KErrNone && iStatus.Int()!=EDeleteNotification) { if (iStatus.Int()==KClientBufferTooSmall) { iSerializedData->Des().Zero(); iSerializedData=iSerializedData->ReAllocL(iSerializedData->Des().MaxLength()*2); iAsyncErrorCount=0; GetOrWaitL(); return; } else if (iStatus.Int()==KErrNotFound) { if (iGetState==EWaitForNotify) { User::Leave(KErrNotFound); } else if (iGetState==EGettingListener) { GetLoca(); } else if (iGetState==EGettingLoca) { SetFilterL(); WaitForNotify(); } return; } if (iAsyncErrorCount>5) User::Leave(iStatus.Int()); ++iAsyncErrorCount; ConnectL(); SetFilterL(); WaitForNotify(); return; } } if (iFullArgs.iTupleName==KListenerStop) { TRequestStatus s; iBBClient.Delete(iFullArgs.iId, s); User::WaitForRequest(s); if (iUnackedCount>0 || iSent==0) { iPendingStop=ETrue; } else { if (!iStopTimer) iStopTimer=CTimeOut::NewL(*this); iStopTimer->Wait(10); } WaitForNotify(); return; } MBBData* d=0; if (iStatus!=EDeleteNotification) { RDesReadStream rs(*iSerializedData); CleanupClosePushL(rs); TTypeName read_type=TTypeName::IdFromStreamL(rs); { d=iFactory->CreateBBDataL(read_type, KEvent, iFactory); CleanupPushBBDataL(d); } { d->InternalizeL(rs); } CleanupStack::Pop(); CleanupStack::PopAndDestroy(); } { iTuple->iData.SetValue(d); iTuple->iTupleMeta.iModuleUid()=iFullArgs.iTupleName.iModule.iUid; iTuple->iTupleMeta.iModuleId()=iFullArgs.iTupleName.iId; iTuple->iTupleMeta.iSubName=iFullArgs.iSubName; if ( iFullArgs.iTupleName == KLastKnownGpsTuple ) { iTuple->iTupleId()=0; } else { iTuple->iTupleId()=iFullArgs.iId; } iTuple->iExpires()=iFullArgs.iLeaseExpires; iFreeBuf->Zero(); iTuple->IntoXmlL(iFreeBuf); iFreeBuf->Characters(_L("\n")); } iUnackedCount++; if (iReadyToWrite) { iWaiting[0]=iFreeBuf; WriteL(); GetOrWaitL(); } else { iWaiting[1]=iFreeBuf; iPendingWrite=ETrue; } }
// --------------------------------------------------------- // CT_LbsClientPosTp178::TestTimeout // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp178::TestTimeoutL() { _LIT(KSTART, "TestTimeout()"); _LIT(KEND, "TestTimeout() passed"); _LIT(KTIME, "Request took %d us"); // Setup verification stuff INFO_PRINTF1(KSTART); //TPrivDlgDiagnostics tmpdiag; TTime requestStartTime; TTime requestStopTime; TTimeIntervalMicroSeconds durationMicro; TBuf<100> buf; _LIT(KService, "SAAA"); TPositionUpdateOptions updateOptions; TTimeIntervalMicroSeconds longInterval(7000000); ConnectL(); SetupPsyL(iUidTestPsy3); OpenPositionerByName(iUidTestPsy3); updateOptions.SetUpdateTimeOut(longInterval); // Access protected member (iPositioner) here iPositioner.SetUpdateOptions(updateOptions); _LIT(KONE, "Perform first request, should NOT time out"); INFO_PRINTF1(KONE); requestStartTime.UniversalTime(); //Make one request to verify psy PerformRequestL(KService, CRequestor::ERequestorService, CRequestor::EFormatApplication); CheckRequestResultL(KErrNone); requestStopTime.UniversalTime(); durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); TInt duration = durationMicro.Int64(); buf.Format(KTIME, duration); INFO_PRINTF1(buf); ClosePositioner(); OpenPositionerByName(iUidTestPsy3); // ECancelButton means that the Automatised class should wait for a cancel call // before returning result updateOptions.SetUpdateTimeOut(longInterval); // Access protected (iPositioner) member here iPositioner.SetUpdateOptions(updateOptions); _LIT(KTWO, "Perform second request, should not time out"); INFO_PRINTF1(KTWO); //Make one request to verify psy TPositionInfo info = TPositionInfo(); requestStartTime.UniversalTime(); TInt err = PerformSyncRequest(KService, &info); requestStopTime.UniversalTime(); if (err != KErrNone) { _LIT(KError, "Wrong result from iStatus, should be KErrNone, was %d"); TBuf<100> buf; buf.Format(KError, err); LogErrorAndLeaveL(buf); } durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); duration = durationMicro.Int64(); buf.Format(KTIME, duration); INFO_PRINTF1(buf); ClosePositioner(); Disconnect(); INFO_PRINTF1(KEND); }
// --------------------------------------------------------- // CT_LbsClientPosTp1::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp1::StartL() { ConnectL(); CPosModules* db = CPosModules::OpenL(); CleanupStack::PushL(db); SetupPsyL(iUidMultiPsy); _LIT(KSetupPSY, "TP1: Has Setup Multi PSY"); INFO_PRINTF1(KSetupPSY); //setting priority TPositionModuleInfo moduleInfoHp;//Hp - high prio; TPositionModuleInfo moduleInfoLp;//Lp - low prio; CPosModuleIdList* prioList = db->ModuleIdListLC(); db->GetModuleInfoL(prioList->At(0), moduleInfoHp); CPosModuleUpdate* moduleUpdate = CPosModuleUpdate::NewLC(); moduleUpdate->SetUpdateAvailability(ETrue); if (iUidMultiPsy.iUid == moduleInfoHp.ModuleId().iUid) { // Case when Multi PSY has highest prio: // Ensuring it is enabled _LIT(KMultiHighest, "TP1: Case when Multi PSY has highest prio"); INFO_PRINTF1(KMultiHighest); db->UpdateModuleL((*prioList)[0], *moduleUpdate); } else { // Case when Multi PSY has not highest prio: // _LIT(KMultiNotHighest, "TP1: Case when Multi PSY has NOT highest prio"); INFO_PRINTF1(KMultiNotHighest); db->GetModuleInfoL(iUidMultiPsy, moduleInfoLp); // Ensuring it is enabled db->UpdateModuleL(iUidMultiPsy, *moduleUpdate); TUint hp = db->PriorityL(moduleInfoHp.ModuleId()); TUint lp = db->PriorityL(moduleInfoLp.ModuleId()); // Changing prio of highest prio PSY and Multi PSY. // Setting Multi PSY to highest prio db->SetModulePriorityL(iUidMultiPsy, hp); db->SetModulePriorityL((*prioList)[0], lp); } _LIT(KTestPSY1On, "TP1: Enabling Test PSY 1"); INFO_PRINTF1(KTestPSY1On); db -> UpdateModuleL(iUidTestPsy1, *moduleUpdate); _LIT(KTestPSY2On, "TP1: Enabling Test PSY 2"); INFO_PRINTF1(KTestPSY2On); db -> UpdateModuleL(iUidTestPsy2, *moduleUpdate); CleanupStack::PopAndDestroy(moduleUpdate); CleanupStack::PopAndDestroy(2, db); // db, prioList User::LeaveIfError(OpenPositioner()); // Request data from default psy should be Multi psy _LIT(KService, "service"); TPositionInfo posInfo = TPositionInfo(); TInt err = PerformSyncRequest(KService, &posInfo); if (err != KErrNone) { _LIT(KErrorRequest, "The request was not completed with KErrNone"); LogErrorAndLeaveL(KErrorRequest, err); } if (iUidMultiPsy.iUid != posInfo.ModuleId().iUid) { _LIT(KIncorrectPsyError, "TP1. Position from wrong PSY received"); LogErrorAndLeaveL(KIncorrectPsyError); } HPositionGenericInfo* genericInfo = HPositionGenericInfo::NewLC(); err = PerformSyncRequest(KService, &(*genericInfo)); if (err != KErrNone) { _LIT(KErrorRequest, "The request was not completed with KErrNone"); LogErrorAndLeaveL(KErrorRequest); } if (iUidMultiPsy.iUid != (genericInfo -> ModuleId()).iUid) { _LIT(KIncorrectPsyError, "TP1. Position from wrong PSY received"); LogErrorAndLeaveL(KIncorrectPsyError); } TPositionCourseInfo courseInfo = TPositionCourseInfo(); err = PerformSyncRequest(KService, &courseInfo); if (err != KErrNone) { _LIT(KErrorRequest, "Course info supported by default, but request failed"); LogErrorAndLeaveL(KErrorRequest); } TPositionSatelliteInfo satelliteInfo = TPositionSatelliteInfo(); err = PerformSyncRequest(KService, &satelliteInfo); if (err != KErrNone) { _LIT(KErrorRequest, "Satellite info supported by default, but request failed"); LogErrorAndLeaveL(KErrorRequest); } //Changing the priority and verifiy that it still possilbe //to request updated from a psy if basic position information //is used and that it is not possilbe to request sat or cource //any more. SetupPsyL(iUidTestPsy2); User::After(3000000); // Request data from default psy should be test psy 2 now err = PerformSyncRequest(KService, &posInfo); if (err != KErrNone) { _LIT(KErrorRequest, "The request was not completed with KErrNone"); LogErrorAndLeaveL(KErrorRequest); } if (iUidTestPsy2.iUid != posInfo.ModuleId().iUid) { _LIT(KIncorrectPsyError, "TP1. Position from wrong PSY received"); LogErrorAndLeaveL(KIncorrectPsyError); } err = PerformSyncRequest(KService, &(*genericInfo)); if (err != KErrNone) { _LIT(KErrorRequest, "The request was not completed with KErrNone"); LogErrorAndLeaveL(KErrorRequest); } if (iUidTestPsy2.iUid != (genericInfo -> ModuleId()).iUid) { _LIT(KIncorrectPsyError, "TP1. Position from wrong PSY received"); LogErrorAndLeaveL(KIncorrectPsyError); } err = PerformSyncRequest(KService, &courseInfo); if (err != KErrArgument) { _LIT(KErrorRequest, "Course info not supported by default, KErrArgument not returned"); LogErrorAndLeaveL(KErrorRequest); } err = PerformSyncRequest(KService, &satelliteInfo); if (err != KErrArgument) { _LIT(KErrorRequest, "Satellite info not supported by default, KErrArgument not returned"); LogErrorAndLeaveL(KErrorRequest); } //check that it is possilbe to change the different //type of class info during periodic request and //that the periodic update will fail if the class //type is incorrect. TTimeIntervalMicroSeconds interval = TTimeIntervalMicroSeconds(1000000); TPositionUpdateOptions posOption; posOption.SetUpdateInterval(interval); _LIT(KUpdateErr, "Error when setting update interval, %d"); err = iPositioner.SetUpdateOptions(posOption); AssertTrueL(err == KErrNone, KUpdateErr, err); _LIT(KErrPeriodic, "The periodic request did not return KErrNone, %d"); err = PerformSyncRequest(KService, &posInfo); AssertTrueL(err == KErrNone , KErrPeriodic, err); _LIT(KErrPeriodicArr, "The periodic request did not return KErrArgument, %d"); err = PerformSyncRequest(KService, &satelliteInfo); AssertTrueL(err == KErrArgument , KErrPeriodicArr, err); SetupPsyL(iUidMultiPsy); User::After(3000000); err = PerformSyncRequest(KService, &satelliteInfo); AssertTrueL(err == KErrNone , KErrPeriodic, err); CleanupStack::PopAndDestroy(genericInfo); ClosePositioner(); Disconnect(); }
// --------------------------------------------------------- // CT_LbsClientPosTp178::StartL // // (other items were commented in a header). // --------------------------------------------------------- // void CT_LbsClientPosTp178::StartL() { _LIT(KServiceAccept, "SAAA"); SetupPsyL(iUidTestPsy3); RPositioner positioner; TPositionInfo info = TPositionInfo(); ConnectL(); User::LeaveIfError(positioner.Open(iPosServer,iUidTestPsy3)); CleanupClosePushL(positioner); TInt Err = positioner.SetRequestor(CRequestor::ERequestorService, CRequestor::EFormatApplication, KServiceAccept); TPositionUpdateOptions updateOptionsLong, updateOptionsShort; TTimeIntervalMicroSeconds longInterval(7000000); updateOptionsLong.SetUpdateTimeOut(longInterval); Err = positioner.SetUpdateOptions(updateOptionsLong); TTimeIntervalMicroSeconds shortInterval(2000000); updateOptionsShort.SetUpdateTimeOut(shortInterval); TPositionUpdateOptions theUpdateOptions; Err = positioner.GetUpdateOptions(theUpdateOptions); if (theUpdateOptions.UpdateTimeOut() != updateOptionsLong.UpdateTimeOut() || updateOptionsLong.UpdateTimeOut() != longInterval) { _LIT(KUpdateOptions, "The update option was not set correctly"); LogErrorAndLeaveL(KUpdateOptions); } _LIT(KDelayMsg, "The successfull requests was completed within %d microsecs."); _LIT(KCancelMsg, "The canceled requests was completed within %d microsecs."); TRequestStatus status; for (TInt i = 0; i < 10; i++) // makes 10 test inorder to get some statistic { positioner.SetUpdateOptions(updateOptionsLong); TTime requestStartTime; requestStartTime.UniversalTime(); positioner.NotifyPositionUpdate(info, status); User::WaitForRequest(status); TTime requestStopTime; requestStopTime.UniversalTime(); TTimeIntervalMicroSeconds durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); TInt duration = durationMicro.Int64(); TBuf<100> timeMsg; timeMsg.Format(KDelayMsg, duration); INFO_PRINTF1(timeMsg); //check error status if (status != KErrNone) { _LIT(KErrPositionRequest, "error code returned from NotifyPositionUpdate, error code = %d"); TBuf<100> buf; buf.Format(KErrPositionRequest, status.Int()); LogErrorAndLeaveL(buf); } TTimeIntervalMicroSeconds shortInterval(2000000); updateOptionsShort.SetUpdateTimeOut(shortInterval); positioner.SetUpdateOptions(updateOptionsShort); requestStartTime.UniversalTime(); positioner.NotifyPositionUpdate(info, status); User::WaitForRequest(status); requestStopTime.UniversalTime(); durationMicro = requestStopTime.MicroSecondsFrom(requestStartTime); duration = durationMicro.Int64(); #ifdef __WINS__ TTimeIntervalMicroSeconds winsFail(100000); durationMicro = TTimeIntervalMicroSeconds(durationMicro.Int64()+winsFail.Int64()); #endif timeMsg.Format(KCancelMsg, duration); INFO_PRINTF1(timeMsg); if (status != KErrTimedOut) { _LIT(KErrPositionRequest, "Request did not returned KErrTimedOut, status code = %d."); TBuf<100> buf; buf.Format(KErrPositionRequest, status.Int()); LogErrorAndLeaveL(buf); } //Check that the request was not aborted before the Interval //Remove this condition if a lot of data is needed in test log. if (durationMicro < shortInterval) { _LIT(KErrInterval, " The request was aborted before the set timed out "); LogErrorAndLeaveL(KErrInterval); } } // end for loop CleanupStack::PopAndDestroy(1); //positioner Disconnect(); // Do timeout test TestTimeoutL(); // Do cancel test TestCancelL(); // ESLI-5QRA7U just check that it is not possible to set a timeout that is less than // the update interval TestOptionL(); }
void CTcpSymbianEngine::RunL() { DBG("RunL, EngineState: %d, iStatus: %d", EngineState(), iStatus.Int()); iTimer->Cancel(); // Cancel TimeOut timer before handling completion switch(EngineState()){ case EConnecting: // IP connection request if (iStatus == KErrNone){ DBG("Connection completed Ok"); // Connection completed sucessfully iConsole.ConnectionNotify(isab::Module::CONNECTED, isab::Module::REQUESTED); SetEngineState(EConnected); Read(); //Start CTcpSymbianRead Active object } else { WARN("Unable to connect, removing host from cache."); iDNSCache.Remove(*iHostName); if (iStatus == KErrCouldNotConnect){ ResetL(EConnectFailed, isab::Module::NO_RESPONSE); } else if (iStatus == KErrTimedOut) { ResetL(ETimedOut, isab::Module::NO_RESPONSE); } else{ WARN("EConnectFailed, INTERNAL_ERROR"); ResetL(EConnectFailed, isab::Module::INTERNAL_ERROR); //XXX handle the different cases } } break; case ELookingUp: iResolver.Close(); if (iStatus == KErrNone) { DBG("Name lookup ok"); // DNS look up successful // Extract domain name and IP address from name record class TInetAddr addr = TInetAddr::Cast(iNameEntry().iAddr); //cache the ip for later. TInt cacheStat = iDNSCache.CacheHost(*iHostName, addr.Address()); DBG("Host cached with result %d", cacheStat); cacheStat = cacheStat; // And connect to the IP address Connect(addr.Address(), iPort); //setactive here } else { //includes KErrTimedOut WARN("Lookup failed"); ResetL(ELookUpFailed, isab::Module::LOOKUP_FAILED); } break; case ELinking: if(iStatus == KErrNone){ DBG("Link layer setup ok"); OpenSocketL(); //cannot open socket until here. We need RConnection. StartLookupL(); //setactive here } else { //includes KErrCanceled and KErrTimedOut WARN("Link layer setup failed"); ResetL(ELinkFailed, isab::Module::TRANSPORT_FAILED); } break; case EBroken: DBG("Broken"); ResetL( EngineState(), isab::Module::CHANNEL_FAILED ); break; case EClosing: if(iStatus == KErrNone){ DBG("Closing ok"); ResetL(EComplete, isab::Module::REQUESTED); } else if(iStatus == KErrTimedOut){ ResetL(ETimedOut); } else { ResetL(EngineState()); //XXX ??? } break; case ESwitching: if(iStatus == KErrNone){ //the connection has been closed, start a new connection //using the values in iHostName, iPort, and iIAP. SetEngineState(EComplete); ConnectL(); } else if(iStatus == KErrTimedOut){ ResetL(ETimedOut); } else { ResetL(EngineState()); } break; case EClosed: DBG("Closed"); ResetL( EngineState(), isab::Module::BY_PEER ); break; default: ERR("PANIC KEchoEngine EBadEngineState (%d)", TInt(EBadEngineState)); User::Panic(KEchoEngine, EBadEngineState); break; }; if(!IsActive()){ DBG("Signal OperationComplete"); iConsole.OperationComplete(); DBG("Signaled OperationComplete"); } }
// ----------------------------------------------------------------------------- // CSeiForwardPlugin::HandleNotifyL // // ----------------------------------------------------------------------------- // void CSeiForwardPlugin::HandleNotifyL( const CEcmtMessageEvent& aEvent ) { const TPtrC8 m = iMessaging->Message( aEvent ); TLex8 lexer( m ); TPtrC8 type = lexer.NextToken(); TPtrC8 channelStr = lexer.NextToken(); TLex8 num ( channelStr ); TInt channel; // Check message type if ( ( type != KConnect ) && ( type != KListen ) && ( type != KMsg ) ) { RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid message" ) ); return; } // Get channel number if ( num.Val( channel ) ) { RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid channel" ) ); return; } // Process message if ( type == KConnect ) { TPtrC8 portStr = lexer.NextToken(); TInt port; num.Assign ( portStr ); // Get port number if ( num.Val( port ) ) { RDebug::Print( _L( "EcmtSeiForwardPlugin: Invalid port" ) ); return; } ConnectL( channel, port ); } else if ( type == KListen ) { ListenL( channel ); } else if ( type == KMsg ) { // Now this just sends the message back to the Java plug-in. // Instead, should cancel the appropriate socket read and write // the message to the socket. TPtrC8 msg = lexer.Remainder(); SendMessageL( channel, msg ); } }