// ---------------------------------------------------------
// 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);
        }
    }
예제 #2
0
coor xaeBlockScene::collisionCheck(HTEXTURE hTex, int x, int y, int w, int h)
{
    if(!m_bClothes[y / h][x / w]) return coor(-1, -1);

    int nTexWidth = m_pHGE->Texture_GetWidth(hTex);
    DWORD* pPix = m_pHGE->Texture_Lock(hTex);
    for(int i = 0; i < h; i++)
    {
        for(int j = 0; j < w; j++)
        {
            /** 某一个点不透明 */
            if((y + i) * nTexWidth + x + j >= nTexWidth * 600) break;
            if(pPix[(y + i) * nTexWidth + x + j] != 0xffff00ff)
            {
                /** 在圆的半径里 */
                if(DISTANCE(x + j, y + i, m_fBallX, m_fBallY) < (g_Setting.Block.m_nBallLength / 2))
                {
                    m_pHGE->Texture_Unlock(hTex);
                    return coor(x + j, y + i);
                }
            }
        }
    }

    m_pHGE->Texture_Unlock(hTex);
    return coor(-1, -1);
}
//set domain
void ConstantPressureVolumeQuad :: setDomain( Domain *theDomain ) 
{  
  int i ;
  for ( i = 0;  i < 4; i++ ) {

     nodePointers[i] = theDomain->getNode( connectedExternalNodes(i)  ) ;

     if ( nodePointers[i] != 0 ) {
	 const Vector &coor = nodePointers[i]->getCrds( ) ;

	 xl[0][i] = coor(0) ;
	 xl[1][i] = coor(1) ; 
     } // end if 

  } //end for i 
  
  this->DomainComponent::setDomain(theDomain);
}
예제 #4
0
파일: rotate.c 프로젝트: finit/etude-c
int item(struct Info *mx, char *p, int way)
{
    switch (sameCorn(mx, way)) {
    case UPLEFT:
        ++mx->i;
        ++mx->j;
        break;
    case UPRIGH:
        ++mx->i;
        --mx->j;
        break;
    case BOTRIGH:
        --mx->i;
        --mx->j;
        break;
    case BOTLEFT:
        --mx->i;
        ++mx->j;
        break;
    default:
        fprintf(stderr, "item: no match option\n");
        break;
    }

    for (; isbound(mx, way) && !p[(coor(mx->col, mx->i, mx->j))];
          condit(mx, way)) {
        p[(coor(mx->col, mx->i, mx->j))] = mx->count;
        if (mx->ord == INC)
            ++mx->count;
        else if (mx->ord == DEC)
            --mx->count;
    }

    if (mx->ord == INC) {
        if (mx->count > mx->row * mx->col)
            return 1;
    } else if (mx->ord == DEC) {
        if (mx->count == 0)
            return 1;
    }
    return 0;
}
예제 #5
0
파일: Block2D.cpp 프로젝트: aceskpark/osfeo
//generate node
const Vector&
Block2D::getNodalCoords( int i, int j )
{

  double hx = 2.0 / nx;

  double hy = 2.0 / ny;

  double x = -1.0 + (i*hx);

  double y = -1.0 + (j*hy);

  coor(0) = x;
  coor(1) = y;
  coor(2) = 0.0;

  this->transformNodalCoordinates( );
  
  return coor;
}
TEST(get_coordinates_from_index, basic)
{
   using coor = std::array<uint,2>;
   ASSERT_EQ(coor({0,0}), mzlib::get_coordinates_from_index(0,3));
   ASSERT_EQ(coor({1,0}), mzlib::get_coordinates_from_index(1,3));
   ASSERT_EQ(coor({2,0}), mzlib::get_coordinates_from_index(2,3));
   ASSERT_EQ(coor({0,1}), mzlib::get_coordinates_from_index(3,3));

   ASSERT_EQ(coor({0,1}), mzlib::get_coordinates_from_index(4, 4));
   ASSERT_EQ(coor({0,1}), mzlib::get_coordinates_from_index(5, 5));
   
   ASSERT_EQ(coor({4,4}), mzlib::get_coordinates_from_index(24, 5));
}
예제 #7
0
파일: Block2D.cpp 프로젝트: aceskpark/osfeo
//transform to real coordiantes
void  Block2D::transformNodalCoordinates( )
{

  static double shape[9];
  
  static double natCoor[2];

  natCoor[0] = coor(0);
  natCoor[1] = coor(1);

  coor.Zero( );

  this->shape2d( natCoor[0], natCoor[1], shape );

  for ( int j=0; j<9; j++ ) {
      
    for ( int dim=0; dim<3; dim++ )
      coor(dim) += shape[j]*xl[dim][j];

  } //end for j

  return;

}
LogFilePositionSource::LogFilePositionSource(QObject *parent)
    : QGeoPositionInfoSource(parent),
      logFile(new QFile(this)),
      timer(new QTimer(this))
{
    connect(timer, SIGNAL(timeout()), this, SLOT(readNextPosition()));

//    logFile->setFileName(QCoreApplication::applicationDirPath()
//            + QDir::separator() + "simplelog.txt");

    logFile->setFileName(QString::fromUtf8(":/simplelog.txt"));
    if (!logFile->open(QIODevice::ReadOnly))
        qWarning() << "Error: cannot open source file" << logFile->fileName();

    QGeoCoordinate coor(3.067269, 101.691547);
    lastPosition.setCoordinate(coor);
    lastPosition.setTimestamp(QDateTime::currentDateTime());
}
예제 #9
0
파일: rotate.c 프로젝트: finit/etude-c
int rotate(struct Info *mx, int x, int y)
{
    static int state = 1;
    static char *p;

    int n;

    if (state) {
        p = (char *) malloc(mx->row * mx->col);
        for (n = 0; n < mx->row * mx->col; ++n)
            p[n] = 0;

        switch (mx->corn) {

        case UPLEFT:
            mx->i = 0;
            mx->j = 0;
            if (mx->orien == CLOCK) {
                while (1) {
                    if (item(mx, p, UP))
                        break;
                    if (item(mx, p, RG))
                        break;
                    if (item(mx, p, BOT))
                        break;
                    if (item(mx, p, LF))
                        break;
                }
            } else {
                while (1) {
                    if (item(mx, p, LF))
                        break;
                    if (item(mx, p, BOT))
                        break;
                    if (item(mx, p, RG))
                        break;
                    if (item(mx, p, UP))
                        break;
                }
            }
            break;
        case UPRIGH:
            mx->i = 0;
            mx->j = mx->col + 1;
            if (mx->orien == CLOCK) {
                while (1) {
                    if (item(mx, p, RG))
                        break;
                    if (item(mx, p, BOT))
                        break;
                    if (item(mx, p, LF))
                        break;
                    if (item(mx, p, UP))
                        break;
                }
            } else {
                while (1) {
                    if (item(mx, p, UP))
                        break;
                    if (item(mx, p, LF))
                        break;
                    if (item(mx, p, BOT))
                        break;
                    if (item(mx, p, RG))
                        break;
                }
            }
            break;
        case BOTLEFT:
            mx->i = mx->row + 1;
            mx->j = 0;
            if (mx->orien == CLOCK) {
                while (1) {
                    if (item(mx, p, RG))
                        break;
                    if (item(mx, p, UP))
                        break;
                    if (item(mx, p, LF))
                        break;
                    if (item(mx, p, BOT))
                        break;
                }
            } else {
                while (1) {
                    if (item(mx, p, BOT))
                        break;
                    if (item(mx, p, RG))
                        break;
                    if (item(mx, p, UP))
                        break;
                    if (item(mx, p, LF))
                        break;
                }
            }
            break;
        case BOTRIGH:
            mx->i = mx->row + 1;
            mx->j = mx->col + 1;
            if (mx->orien == CLOCK) {
                while (1) {
                    if (item(mx, p, BOT))
                        break;
                    if (item(mx, p, LF))
                        break;
                    if (item(mx, p, UP))
                        break;
                    if (item(mx, p, RG))
                        break;
                }
            } else {
                while (1) {
                    if (item(mx, p, RG))
                        break;
                    if (item(mx, p, UP))
                        break;
                    if (item(mx, p, LF))
                        break;
                    if (item(mx, p, BOT))
                        break;
                }
            }
            break;
        default:
            fprintf(stderr, "rotate: no match option\n");
            break;
        }
        state = 0;
    }

    n = p[coor(mx->col, x, y)];
    if (x == mx->row && y == mx->col)
        free(p);
    return n;
}
예제 #10
0
/** Perform Cmtlr5Step test step.

This test checks that the Protocol Module handles the case in which LBS requests further
assistance data.

2 data items are requested - one is included in the rrlp assistance data message, and one 
is included in the rrlp measure position request. 

@return TVerdict test result code
*/
TVerdict Cmtlr5Step::doTestStepL()
	{
	INFO_PRINTF1(_L("\t********************************************************************"));
	INFO_PRINTF1(_L("\tMTLR basic procedure - not all requested assistance data delivered..."));
	INFO_PRINTF1(_L("\t********************************************************************"));
	INFO_PRINTF1(_L("- START -"));	
	

	// Initiate MT-LR
	// Generate received SUPL INIT message (test message content #0)
	TPtr8 messagePtr(iReceiveBuffer.Des());
	TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr);
	if (err != KErrNone)
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}

	// Inject SUPL INIT using the SUPL Push API
	INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()"));
	TLbsSuplPushRequestId reqId = 12345;
	TPtrC8 message(messagePtr);
	iSuplPush->SuplInit(reqId, message, 0);
	
	// Check Gateway receives a Privacy request and Location Request
	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
	if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) ||
		!iGatewayObserver->IsPrivReqReceived() ||
		MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() )
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}


	// LBS delivers privacy response
	INFO_PRINTF1(_L("\tLBS -> RespondPrivacyRequest ()"));	
	CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted;
	iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0);
	
	// Check Connection Manager receives a request for connecting
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));


	// Simulate the connection is up (inject that event)
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
    iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
    

	// LBS Requests assistance data
	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));	
	// Request both sets of assitance data. 
	// They'll be delivered in different SUPL POS messages later on in the test.
	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
	TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataIonosphericModel;
	TLbsAsistanceDataGroup dataRequestMask = dataRequestMask1|dataRequestMask2;
	TLbsNetSessionIdArray dummyIdArray;	
	iModule->RequestAssistanceData(dataRequestMask, dummyIdArray);
	
	
	// Check Connection Manager receives a request to send a SUPL POS INIT
	// with the assistance data mask requested by the gateway
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));


	// Inject a SUPL POS with some of the Assistance data requested
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(dataRequestMask1, EFalse);
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	


	// Check gateway receives the assistance data types requested.
	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessAssistanceData) ||
		(dataRequestMask1 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask1))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	

	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));
	
	// Inject a SUPL POS (RRLP Measure Position Request) - does not contains missing assistance data
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET"));
	suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask2);
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	

	// Check gateway receives the assistance data types requested.
	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessAssistanceData) ||
		(dataRequestMask2 & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask2))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}

	// Check gateway receives a location request (due to the RRLP Measure Position Request)
	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessLocationRequest) ||
		MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType())
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	

	// Fake LBS sending results (position) to SPM
	INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest"));
	TReal64 latitude = 10;
	TReal64 longitude = 0;
	TReal32 HorAccuracy = 10;
	TPositionInfo mobilePosInfo;
	TTime utcTime;
	utcTime.UniversalTime();
	TCoordinate coor(latitude,longitude);
	TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime);
	mobilePosInfo.SetPosition(mobilePos);
	iModule->RespondLocationRequest(iGatewayObserver->SessionIdValue(),KErrNone,mobilePosInfo);
	

	// Check the Connection Manager receives a request to send a SUPL POS (RRLP Measure Position Response)
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET"));


	// Inject a SUPL END (without position)
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
	CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse);
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
	
	
	// Check gateway session completed
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessSessionComplete))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));

	// Check Connection Manager receives a disconnection request
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
	
	// Check if more observer activity takes place
	if (iGatewayObserver->IsMoreObserverActivity() ||
	iNetworkObserver->IsMoreObserverActivity())
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("- END -"));
	
	SetTestStepResult(EPass);
	return TestStepResult();
	
	}
예제 #11
0
/** Perform CMoLrStep1 test step.
This test verifies that the SUPL Protocol Module correctly handles 
an MO-LR Self Locate Terminal Based sequence. Assistance data is
partially delivered whith an RRLP assistance data message and then complemented
with more assistance data received in an RRLP Measure Position Request.

This test also ensures that Reference Location is one of the assistance data
types requested by LBS after SUPL RESPONSE. The test verifies that a reference
location is delivered to LBS if it is received from the network in the 
Reference Location assistance data type.

@return TVerdict test result code
*/
TVerdict Cmolr30Step::doTestStepL()
	{
 	
	INFO_PRINTF1(_L("\t********************************************************************"));
	INFO_PRINTF1(_L("\tMOLR times out waiting for SUPL END after SUPL POS session"));
	INFO_PRINTF1(_L("\t********************************************************************"));
	INFO_PRINTF1(_L("- START -"));
	// Initiate MO-LR
	TLbsNetSessionId sessionId1(TUid::Uid(0x87654321), 0x1111);
	TLbsNetPosRequestOptionsAssistance options1;
	options1.SetNewClientConnected(ETrue);
	TLbsNetPosRequestQuality quality1;
	options1.SetRequestQuality(quality1);
	TLbsAsistanceDataGroup dataRequestMask1 = EAssistanceDataBadSatList;
	TLbsAsistanceDataGroup dataRequestMask2 = EAssistanceDataReferenceLocation;
	// Request both sets of assitance data. They'll be delivered in different
	// SUPL POS messages later on in the test.
	TLbsAsistanceDataGroup dataRequestMask = dataRequestMask1|dataRequestMask2;
	options1.SetDataRequestMask(dataRequestMask); 
	INFO_PRINTF1(_L("\tLBS -> RequestSelfLocation"));
	iModule->RequestSelfLocation(sessionId1, options1);

	// Check Connection Manager receives a request for connecting
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));


	// Simulate the connection is up (inject that event)
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
    iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());
	
	// Check Connection Manager receives a request to send a SUPL START
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESuplStartSendReq))
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL START -> NET"));
	
	// Inject a SUPL RESPONSE
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL RESPONSE <- NET"));
	CSuplMessageBase* resp = BuildSuplResponseL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted);
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), resp);
	

	// Check gateway receives Location Request
	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessLocationRequest) ||
		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
		
	// LBS Requests assistance data
	INFO_PRINTF1(_L("\tLBS -> RequestAssistanceData ()"));
	TLbsNetSessionIdArray dummyIdArray;		
	iModule->RequestAssistanceData(dataRequestMask, dummyIdArray);
	
	// Check Connection Manager receives a request to send a SUPL POS INIT
	// with the assistance data mask requested by the gateway
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));

	// Inject a SUPL POS (RRLP ASSIST DATA) with some of the Assistance data requested
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assitance Data <- NET"));
	CSuplMessageBase* suplPos = BuildSuplPosAssitDataL(dataRequestMask2, ETrue); // ETrue = more assistance data underway
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	

	// Check the Connection Manager receives a request to send a SUPL POS (ack to assistance data)
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Assistance Data Ack -> NET"));

	// Inject a SUPL POS (RRLP MEASURE POSITION REQUEST) wich carries
	// assistance data
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Request <- NET"));
	suplPos = BuildSuplPosRequestL(TPositionModuleInfo::ETechnologyTerminal | TPositionModuleInfo::ETechnologyAssisted, dataRequestMask1);
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplPos);	


	// Check gateway receives the assistance data types contained in both SUPL POS messages
	// received earlier.
	if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessAssistanceData) ||
		(dataRequestMask & iGatewayObserver->AssistanceDataSetMask() != dataRequestMask) )
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	
	// Ref Loc has been requested. Make sure it's been notified	(the callback mechanism does
	// not work well because EProcessAssistanceData overwrites EProcessLocationUpdate as they
	// happen in the same RunL of the SUPL Protocol). Instead, a flag has to be checked after
	// having received EProcessAssistanceData above
	if (!iGatewayObserver->IsRefLocNotified())
		{
		SetTestStepResult(EFail);
		return TestStepResult();			
		}
	
	// Reference Location is reported before Assistance Data...if we got this far,
	// both ref loc and assist data have been notified:
	INFO_PRINTF1(_L("\tLBS <- ProcessLocationUpdate(Reference Location)"));
	INFO_PRINTF1(_L("\tLBS <- ProcessAssistanceData()"));

	
	// Check gateway receives a location request (due to the RRLP Measure Position Request)
	//
	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessLocationRequest) ||
		MLbsNetworkProtocolObserver::EServiceSelfLocation != iGatewayObserver->LocType())
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	
	// Fake LBS sending results (position) to SPM
	INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest"));
	TReal64 latitude = 10;
	TReal64 longitude = 0;
	TReal32 HorAccuracy = 10;
	TPositionInfo mobilePosInfo;
	TTime utcTime;
	utcTime.UniversalTime();
	TCoordinate coor(latitude,longitude);
	TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime);
	mobilePosInfo.SetPosition(mobilePos);
	iModule->RespondLocationRequest(sessionId1,KErrNone,mobilePosInfo);

	
	// Check the Connection Manager receives a request to send a SUPL POS (RRLP MEASURE POSITION RESPONSE)
	//
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosSendReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS - RRLP Measure Position Response -> NET"));

	// ********* DONNOT Inject a SUPL END (from SUPL server) *************
	// This will test that the 10 second timer goes off due to inactivity after
	// sending the last SUPL POS message.
	// The SUPL Protocol Module will send a SUPL END and close the connection.
	// ********************************************************************

	// Check the Connection Manager receives a request to send a SUPL END 
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplEndSendReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END -> NET"));

	
	// Check gateway session completed
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessSessionComplete))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));

	// Check Connection Manager receives a disconnection request
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
	
	// Check if more observer activity takes place
	if (iGatewayObserver->IsMoreObserverActivity() ||
	iNetworkObserver->IsMoreObserverActivity())
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}
	INFO_PRINTF1(_L("- END -"));
	
	SetTestStepResult(EPass);
	return TestStepResult();	
}
예제 #12
0
/** Perform Cmtlr24Step test step.
This test verifies that the SUPL Protocol Module correctly handles 
an MT-LR Network requested Locate Terminal Based sequence (assistance data
delivered via an RRLP payload).

@return TVerdict test result code
*/
TVerdict Cmtlr24Step::doTestStepL()
	{
	INFO_PRINTF1(_L("\t********************************************************************"));
	INFO_PRINTF1(_L("\tMTLR - LBS sends response before connection is established)"));
	INFO_PRINTF1(_L("\t********************************************************************"));
	INFO_PRINTF1(_L("- START -"));	
	
	// Initiate MT-LR
	// Generate received SUPL INIT message (test message content #0)
	TPtr8 messagePtr(iReceiveBuffer.Des());
	TInt err = iSuplInitGenerator->GenerateSuplInitL(0, messagePtr);
	if (err != KErrNone)
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}

	// Inject SUPL INIT using the SUPL Push API
	INFO_PRINTF1(_L("\tLBS (SuplPush) -> OnSuplInit()"));
	TLbsSuplPushRequestId reqId = 12445;
	TPtrC8 message(messagePtr);
	iSuplPush->SuplInit(reqId, message, 0);
	
	// Check Gateway receives a Privacy request and Location Request
	INFO_PRINTF1(_L("\tLBS <- ProcessLocationRequest()"));
	if (EFail == CheckGatewayCallbackL(CSuplGatewayObserver::EProcessLocationRequest) ||
		!iGatewayObserver->IsPrivReqReceived() ||
		MLbsNetworkProtocolObserver::EServiceMobileTerminated != iGatewayObserver->LocType() )
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	
	// Wait a couple of seconds for user instructions
    INFO_PRINTF1(_L("...user taking a couple of seconds for privacy response"));
	if (iGatewayObserver->IsMoreObserverActivity() ||
	    iNetworkObserver->IsMoreObserverActivity())
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}

    // LBS delivers privacy response
	INFO_PRINTF1(_L("\tLBS -> PrivacyResponse (EPrivacyResponseAccepted)"));	
	CLbsNetworkProtocolBase::TLbsPrivacyResponse privacyResponse = CLbsNetworkProtocolBase::EPrivacyResponseAccepted;
	iModule->RespondPrivacyRequest(iGatewayObserver->SessionIdValue(), privacyResponse, 0);

	// Check Connection Manager receives a request for connecting
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EConnectReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t ConnectionRequest -> NET"));

	// ****************   Location Response is sent by LBS before the connection is up  *****************
	// **************************************************************************************************

	// Fake LBS sending results (position) to SPM
	INFO_PRINTF1(_L("\tLBS -> RespondLocationRequest"));
	TReal64 latitude = 10;
	TReal64 longitude = 0;
	TReal32 HorAccuracy = 10;
	TPositionInfo mobilePosInfo;
	TTime utcTime;
	utcTime.UniversalTime();
	TCoordinate coor(latitude,longitude);
	TPosition mobilePos(TLocality(coor,HorAccuracy),utcTime);
	mobilePosInfo.SetPosition(mobilePos);
	iModule->RespondLocationRequest(iGatewayObserver->SessionIdValue(),KErrNone,mobilePosInfo);

	// Wait a couple of seconds for connection activation
    INFO_PRINTF1(_L("...connection taking a couple of seconds to activate"));
	if (iGatewayObserver->IsMoreObserverActivity() ||
	    iNetworkObserver->IsMoreObserverActivity())
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}

	// Simulate the connection is up (inject that event)
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t Connected <- NET"));
    iNetworkObserver->InjectConnectedIndication(iNetworkObserver->SessionId());

	// Check Connection Manager receives a request to send a SUPL POS INIT
	// with the assistance data mask requested by the gateway
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::ESendSuplPosInitSendReq))
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL POS INIT -> NET"));

	// Inject a SUPL END (without position)
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t SUPL END <- NET"));
	CSuplMessageBase* suplEnd = BuildSuplEndL(EFalse);
	iNetworkObserver->InjectSuplMessage(iNetworkObserver->SessionId(), suplEnd);
	
	// Check gateway session completed
	if (EFail == CheckGatewayCallbackL(
				CSuplGatewayObserver::EProcessSessionComplete))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\tLBS <- ProcessSessionComplete"));

	// Check Connection Manager receives a disconnection request
	if (EFail == CheckNetworkCallbackL(CSuplNetworkTestObserver::EDisconnectReq))
		{
		SetTestStepResult(EFail);
		return TestStepResult();
		}
	INFO_PRINTF1(_L("\t\t\t\t\t\t\t\t DisconnectRequest -> NET"));
	
	// Check if more observer activity takes place
	if (iGatewayObserver->IsMoreObserverActivity() ||
	iNetworkObserver->IsMoreObserverActivity())
	{
	SetTestStepResult(EFail);
	return TestStepResult();
	}
	INFO_PRINTF1(_L("- END -"));
	
		SetTestStepResult(EPass);
	return TestStepResult();
	
}
예제 #13
0
/*----------------------------------------------------------------------------*/
bool DEreader::GetPlanetPoz(double jdate, int index, bool geleo, double poz[])
{
    if (jdate != dJD) {
       bool r = read(jdate);
       if (!r){
            qDebug() << "GetPlanetPoz";
           return false;
       }
        dJD = jdate;
    }
    double tc[16];
    double tcp[16];
    for (int i = 0; i < 16; i++) {
        tc[i] = 0;
        tcp[i] = 0;
    }

    double d = buf[0];
    double c = d - deHeader.raz[index];
    int n1 = -3 * deHeader.pow[index];
    do {
        c += deHeader.raz[index];
        d += deHeader.raz[index];
        n1 += 3*deHeader.pow[index];
    } while (jdate < c || jdate > d);
    cheb(false, c, d, jdate, deHeader.pow[index], tc, tcp);
    coor(false, index, n1, tc, tcp, poz);

    if (index == 2 || index == 9) {
        int idx = index == 2 ? 9 : 2;
        n1 = 0;
        d = buf[0];
        c = d - deHeader.raz[idx];
        n1 = -3*deHeader.pow[idx];
        do {
            c += deHeader.raz[idx];
            d += deHeader.raz[idx];
            n1 += 3*deHeader.pow[idx];
        } while (jdate < c || jdate > d);
        cheb(false, c, d, jdate, deHeader.pow[idx], tc, tcp);
        double x[6];
        coor(false, idx, n1, tc, tcp, x);
        if (index == 2)
            for (int k = 0; k < 6; k++)
                poz[k] = poz[k] - x[k] / (deHeader.EarthDivMoon + 1); // земля
        else if (index == 9) {
            for (int k = 0; k < 6; k++)
                x[k] = x[k] - poz[k] / (deHeader.EarthDivMoon + 1);  // земля
            for (int k = 0; k < 6; k++)
                poz[k] += x[k]; // луна
        }
    }
    if (geleo) {
        n1 = 0;
        d = buf[0];
        c = d - deHeader.raz[10];
        n1 = -3*deHeader.pow[10];
        do {
            c += deHeader.raz[10];
            d += deHeader.raz[10];
            n1 += 3*deHeader.pow[10];
        } while (jdate < c || jdate > d);
        cheb(false, c, d, jdate, deHeader.pow[10], tc, tcp);
        double x[6];
        coor(false, 10, n1, tc, tcp, x);
        for (int k = 0; k < 6; k++)
            poz[k] = (poz[k] - x[k]) / deConst.AE;
    } else
        for (int k = 0; k < 6; k++)
            poz[k] /= deConst.AE;

    return true;
//    qDebug() << poz[0];
//    qDebug() << poz[1];
//    qDebug() << poz[2];
}
예제 #14
0
CurveShape::CurveShape(std::string fileName) {
    std::ifstream infile(fileName);
    if (!infile) {
        cerr << "File not found." << endl;
        
    }

    // Using getline() to read one line at a time.
    std::string line;
    int next;
    bool isX = 1;
    while (getline(infile, line)) {

        if (line.empty()) continue;

        // Using istringstream to read the line into integers.
        std::istringstream outl(line);
        outl >> next;
        int R = next;
        outl >> next;
        int G = next;
        outl >> next;
        int B = next;
        outl >> next;
        int alpha = next;
        outlineTexture = Texture::createSingleColorTexture(R,G,B,alpha);
        //cout << "outline " << R << " " << G << " " << B << " " << alpha << endl;


        getline(infile, line); // fill
        std::istringstream fill(line);
        
        fill >> next;
        R = next;
        fill >> next;
        G = next;
        fill >> next;
        B = next;
        fill >> next;
        alpha = next;
        fillTexture = Texture::createSingleColorTexture(R,G,B,alpha);
        //cout << "fill " << R << " " << G << " " << B << " " << alpha << endl;

        getline(infile, line); // koor
        std::istringstream coor(line);

        int tempX;
        while (coor >> next) {
            if (isX) {
                isX = 0;
                tempX = next;
            } else {
                isX = 1;
                push_back(tempX, next);
                //cout << "x,y " << tempX << "," << next << endl; 
            }
        }        
        //cout << endl;
    }

    infile.close();
}