void CCTsyPrivacyFU::DoCancelNotifyPrivacyConfirmationL(const TDesC& aLineName)
	{
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RLine line;
	RMobileCall mobileCall;

	TInt err = line.Open(iPhone, aLineName);
	ASSERT_EQUALS(KErrNone, err)
	CleanupClosePushL(line);
	
	err = mobileCall.OpenNewCall(line);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(mobileCall);

 	//-------------------------------------------------------------------------
	// Test cancelling of RMobileCall::NotifyPrivacyConfirmation
 	//-------------------------------------------------------------------------
	TRequestStatus notifyStatus;

	RMobilePhone::TMobilePhonePrivacy privacy;
	mobileCall.NotifyPrivacyConfirmation(notifyStatus,privacy);
	mobileCall.CancelAsyncRequest(EMobileCallNotifyPrivacyConfirmation);
	User::WaitForRequest(notifyStatus);

    ASSERT_EQUALS(KErrCancel, notifyStatus.Int());

	AssertMockLtsyStatusL(); // just in case

	CleanupStack::PopAndDestroy(3); // mobileCall, line, this
	}
示例#2
0
void RGraphicsSceneQt::exportRay(const RRay& ray) {
    bool created = beginPath();

    Q_ASSERT(currentPainterPath.isValid());

    // find largest view box over all attached views:
    RBox box;
    QList<RGraphicsView*>::iterator it;
    for (it=views.begin(); it!=views.end(); it++) {
        RBox b = (*it)->getBox();
        box.growToIncludeBox(b);
    }

    // trim line to view box:
    RLine clippedLine = ray.getClippedLine(box);

    double offs = clippedLine.getStartPoint().getDistanceTo(ray.getBasePoint());
    if (RMath::isSameDirection(ray.getBasePoint().getAngleTo(clippedLine.getStartPoint()), ray.getDirection1())) {
        offs *= -1;
    }

    exportLine(clippedLine, offs);

    currentPainterPath.setAlwaysRegen(true);

    if (created) {
        endPath();
    }
}
示例#3
0
/**
 * \return List of RLines describing this spline.
 */
QList<QSharedPointer<RShape> > RSpline::getExploded(int segments) const {
    if (!exploded.isEmpty() && segments==-1) {
        return exploded;
    }

    //qDebug() << "RSpline::getExploded: segments: " << segments;
    //RDebug::printBacktrace("getExploded:    ");

    //##boundingBox = RBox();

    updateInternal();

    exploded.clear();

    if (!isValid()) {
        //qWarning() << "RSpline::getExploded: invalid spline";
        return exploded;
    }

    if (segments==-1) {
        segments = 8;
    }

    double tMin = getTMin();
    double tMax = getTMax();

    double step = getTDelta() / (controlPoints.size() * segments);

    RVector p1;
    RVector prev = RVector::invalid;
    for (double t = tMin; t<tMax+(step/2.0); t+=step) {
        double tc = qMin(t, tMax);
        p1 = getPointAt(tc);

        if (RMath::isNaN(p1.x) || RMath::isNaN(p1.y)) {
            continue;
        }

        if (prev.isValid()) {
            RLine* line = new RLine(prev, p1);
            exploded.append(QSharedPointer<RShape>(line));
        }
        prev = p1;

        //##boundingBox.growToInclude(p1);
    }

    p1 = getEndPoint();
    if (!RMath::isNaN(p1.x) && !RMath::isNaN(p1.y)) {
        if (prev.isValid()) {
            RLine* line = new RLine(prev, p1);
            // prevent zero length line at the end:
            if (line->getLength()>1.0e-4) {
                exploded.append(QSharedPointer<RShape>(line));
            }
        }
    }

    return exploded;
}
enum TVerdict CTestOpenCallFrLine::doTestStepL()
	{
	INFO_PRINTF1(_L("Open Call from RLine!"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(phone,DSTD_LINE_NAME);
	TESTCHECK(ret, KErrNone);

	RCall call;
	ret = call.OpenNewCall(line);
    TESTCHECK(ret, KErrNone);
	call.Close();

	line.Close();
	phone.Close();
  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
	}
/**
@SYMTestCaseID BA-CTSY-ALTC-CNACS-0003
@SYMComponent  telephony_ctsy
@SYMTestCaseDesc Test support in CTSY for RMobileCall::NotifyAlternatingCallSwitch for fax calls
@SYMTestPriority High
@SYMTestActions Invokes RMobileCall::NotifyAlternatingCallSwitch for fax calls
@SYMTestExpectedResults Pass
@SYMTestType CT
*/
void CCTsyAlternatingCallFU::TestNotifyAlternatingCallSwitch0003L()
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RMobileCall mobileCall;
	RLine line;

	TInt err = line.Open(iPhone, KMmTsyFaxLineName);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(line);
	
	err = OpenNewCall(line, mobileCall, KMmTsyFaxLineName);
	ASSERT_EQUALS(KErrNone, err)
    CleanupClosePushL(mobileCall);

	TRequestStatus reqStatus;
	mobileCall.NotifyAlternatingCallSwitch(reqStatus);
	User::WaitForRequest(reqStatus);
	ASSERT_EQUALS(KErrNotSupported, reqStatus.Int())

	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this
	
	}
示例#6
0
void RPainterPathExporter::exportLineSegment(const RLine& line, double angle) {
    if (line.getLength()<RS::PointTolerance) {
        if (exportZeroLinesAsPoints) {
            path.addPoint(line.getStartPoint());
        }
        else {
            // Qt won't export a zero length line as point:
            // e.g. dot in a dash/dot line:
            RVector startPoint = line.startPoint - RVector::createPolar(0.01, angle);
            RVector endPoint = line.endPoint + RVector::createPolar(0.01, angle);
            path.moveTo(startPoint);
            path.lineTo(endPoint);
//            path.moveTo(line.getStartPoint()-RVector(0.01,0));
//            path.lineTo(line.getEndPoint()+RVector(0.01, 0));
//            path.moveTo(line.getStartPoint()-RVector(0,0.01));
//            path.lineTo(line.getEndPoint()+RVector(0, 0.01));
        }
    }
    else {
        if (!path.isAtPosition(line.getStartPoint())) {
            path.moveTo(line.getStartPoint());
        }
        path.lineTo(line.getEndPoint());
    }
}
void CCTsyPrivacyFU::DoSetPrivacyL(const TDesC& aLineName,RMobilePhone::TMobilePhonePrivacy aPrivacySetting)
	{
	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));
	OpenPhoneL();

	RLine line;
	TInt err = line.Open(iPhone, aLineName);
	ASSERT_EQUALS(KErrNone, err)
	CleanupClosePushL(line);
	
	RMobileCall mobileCall;
	err = mobileCall.OpenNewCall(line);
	ASSERT_EQUALS(KErrNone, err)
	CleanupClosePushL(mobileCall);
	
	// EMobileCallSetPrivacy is not passed to LTSY
	// CTSY returns KErrNotSupported immediately
	err = mobileCall.SetPrivacy(aPrivacySetting);
	ASSERT_EQUALS(KErrNotSupported, err);

	AssertMockLtsyStatusL();

	CleanupStack::PopAndDestroy(3, this); // mobileCall, line, this	

	}
示例#8
0
enum TVerdict CTestErrNewTelObjectIllegalBuffer::doTestStepL()
/** 
Check that CTelSession::NewTelObject fails when an illegal buffer is passed to it for the name of the call.
 (Uses similar code to that in RTelServer::OpenNewCall().)

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

	RPhone phone;
	ret = phone.Open( server, phoneInfo.iName );
	TESTCHECK(ret, KErrNone);


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	char retName;  
		// Illegal buffer.

	RCall1 call;

	// Taken from OpenNewCall(line , retName); 
	RSessionBase* session=&line.SessionHandle();
	call.ConstructL();
	TInt subSessionHandle=line.SubSessionHandle();

	TPtrC name(_L("::"));	// necessary so that server knows to ask TSY for new name

	TIpcArgs args(&name,REINTERPRET_CAST(TDes*,&retName),subSessionHandle);
	call.SetSessionHandle(*session);
	ret = call.CreateSubSession(*session,EEtelOpenFromSubSession,args);
	call.Destruct();

	TESTCHECK(ret, KErrBadDescriptor);

	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
TInt CTestDriveSsFax::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KFaxLineName,"Fax");
	_LIT(KMmPhoneName,"GsmPhone1");

	RMobilePhone mmPhone;
	INFO_PRINTF1(_L("Opening Multimode Phone\n"));
	TESTL(mmPhone.Open(iServer,KMmPhoneName)==KErrNone);

	RLine faxLine;
	INFO_PRINTF1(_L("Opening Fax Line\n"));
	TESTL(faxLine.Open(iPhone,KFaxLineName)==KErrNone);
 	RCall faxCall;
	INFO_PRINTF1(_L("Opening New fax Call\n"));
	TESTL(faxCall.OpenNewCall(faxLine)==KErrNone);

	TRequestStatus stat1,stat2,reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// Now wait for an incoming fax call...
	INFO_PRINTF1(_L("Answering a Fax Call\n"));
	RCall::TFaxSessionSettings faxSessionSettings;
	faxSessionSettings.iMode=RCall::EReceive;
	faxSessionSettings.iFaxRetrieveType=RCall::EFaxOnDemand;
	faxSessionSettings.iFaxClass=EClassAuto;
	faxSessionSettings.iFaxId.Zero();
	faxSessionSettings.iMaxSpeed=14400;
	faxSessionSettings.iMinSpeed=12000;
	faxSessionSettings.iRxResolution=EFaxNormal;
	faxSessionSettings.iRxCompression=EModifiedHuffman;
	faxCall.SetFaxSettings(faxSessionSettings);
	faxCall.AnswerIncomingCall(stat2);
	User::After(2000000L);					// Wait for a 2secs to make sure the port is "access denied"

	INFO_PRINTF1(_L("Get Signal Strength\n"));
	TInt32 signalStrength;
	TInt8 bar=0;
	mmPhone.GetSignalStrength(stat1,signalStrength,bar);
	User::WaitForRequest(stat1);
	TESTL(stat1==KErrAccessDenied);			// The port is "access denied" by this time

	User::WaitForRequest(stat2);
	User::After(300000L);
	TESTL(faxCall.HangUp()==KErrNone);
	
	mmPhone.Close();
	faxLine.Close();
	faxCall.Close();
	return KErrNone;
	}
示例#10
0
void RPainterPathExporter::exportLineSegment(const RLine& line) {
    if (line.getLength()<RS::PointTolerance) {
        path.addPoint(line.getStartPoint());
    }
    else {
        path.moveTo(line.getStartPoint());
        path.lineTo(line.getEndPoint());
    }
}
enum TVerdict CTestMemZeroLength::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Zero Length Dials"));
    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RPhone phone;
    ret = phone.Open(server,DSTD_PHONE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(phone,DSTD_LINE_NAME);
	TESTCHECK(ret, KErrNone);

	RCall call;
	TName name;
    ret = call.OpenNewCall(line,name);
	TESTCHECK(ret, KErrNone);

	RCall::TTelNumberC number(_L(""));
	TPtrC8 callParams(_L8(""));
	ret=call.Dial(number);
    TESTCHECK(ret, KErrArgument);

	ret=call.Dial(callParams,number);
    TESTCHECK(ret, KErrArgument);

	TRequestStatus status;
	call.Dial(status,number);
	User::WaitForRequest(status);
    TESTCHECK(status.Int(), KErrArgument);

	call.Dial(status,callParams,number);
	User::WaitForRequest(status);
    TESTCHECK(status.Int(), KErrArgument);

	call.Close();
	line.Close();

	INFO_PRINTF1(_L("Passed illegal Cancel Test"));
	INFO_PRINTF1(_L("Test an illegal Cancel"));

// This shouldn't panic
	phone.NotifyModemDetectedCancel();

	phone.Close();
    ServerClose(server);

	INFO_PRINTF1(_L("Passed illegal Cancel Test"));

	return TestStepResult();
	}
示例#12
0
RVector RVector::rotate3D(const RLine& axis, double rotation) {
    RVector off = -axis.getStartPoint();
    RVector ret = *this;
    ret.move(off);
    RVector ax = axis.getStartPoint() - axis.getEndPoint();
    QQuaternion quat = QQuaternion::fromAxisAndAngle(ax.x, ax.y, ax.z, RMath::rad2deg(rotation));
    QVector3D qv = quat.rotatedVector(QVector3D(ret.x, ret.y, ret.z));
    ret = RVector(qv.x(), qv.y(), qv.z());
    ret.move(-off);
    *this = ret;
    return *this;
}
void CCTsySessionManagementFU::AuxReferenceCountL(const TDesC &aName)
	{

	OpenEtelServerL(EUseExtendedError);
	CleanupStack::PushL(TCleanupItem(Cleanup,this));

	OpenPhoneL();

    TName lineName(aName);    
    RLine line;
    
    TInt ret  = line.Open(iPhone, lineName);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(line);  
    
    TName name;
	RCall call;
    
    ret = OpenNewCall(line, call, lineName, name);    
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call);    

	// test on successful completion
	TInt count = call.ReferenceCount();
    ASSERT_EQUALS(1, count);

	AssertMockLtsyStatusL();

	// test on successful completion, increasing count
	RCall call2;
	
	ret = call2.OpenExistingCall(line, name);
    ASSERT_EQUALS(KErrNone, ret);
    CleanupClosePushL(call2);  
	
	count = call.ReferenceCount();
    ASSERT_EQUALS(2, count);

	AssertMockLtsyStatusL();

	// test on successful completion, decreasing count
	CleanupStack::PopAndDestroy(1);

	count = call.ReferenceCount();
    ASSERT_EQUALS(1, count);


	AssertMockLtsyStatusL();
	CleanupStack::PopAndDestroy(3, this); 
	
	}
示例#14
0
enum TVerdict CTestErrNewTelObjectOk::doTestStepL()
/** 
Check that RTelServer::OpenNewCall returns no errors 
 when it has a large enough valid buffer to put the call name in. 

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

	RPhone phone;
	ret = phone.Open( server, phoneInfo.iName );
	TESTCHECK(ret, KErrNone);


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	TName retName;

	// Check that we can get a name for the newly opened call. 

	RCall call;
	ret = call.OpenNewCall(line , retName); 
	TESTCHECK(ret, KErrNone);

	call.Close();
	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);

	return TestStepResult();
	}
示例#15
0
bool RDimRotatedData::mirror(const RLine& axis) {
    RDimLinearData::mirror(axis);
    //extensionPoint1.mirror(axis);
    //extensionPoint2.mirror(axis);

    RLine neutralAxis = axis;
    neutralAxis.move(-neutralAxis.getStartPoint());
    RVector vec = RVector::createPolar(1.0, rotation);
    vec.mirror(neutralAxis);
    rotation = vec.getAngle();

    update();
    return true;
}
示例#16
0
enum TVerdict CTestErrNewTelObjectSmallBuffer::doTestStepL()
/** 
Check that CTelSession::NewTelObject fails when a small buffer is passed to it for the name of the call.
 (Uses similar code to that in RTelServer::OpenNewCall().)

@return EPass or EFail 
*/
	{
	RTelServer1 server;
	TInt ret = server.Connect();
	TESTCHECK(ret, KErrNone);
	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);

	RTelServer::TPhoneInfo phoneInfo;

	ret = server.GetPhoneInfo( 0, phoneInfo );
	TESTCHECK(ret, KErrNone);

	RPhone phone;
	ret = phone.Open( server, phoneInfo.iName );
	TESTCHECK(ret, KErrNone);


	RPhone::TLineInfo lineInfo;
	ret = phone.GetLineInfo( 0, lineInfo );
	TESTCHECK(ret, KErrNone);


	RLine line;
	ret = line.Open( phone, lineInfo.iName );

	TBuf<1> retName;
		//Buffer too small to recieve name.

	RCall call;
	ret = call.OpenNewCall(line , retName); 

	TESTCHECK(ret, KErrOverflow);

	line.Close();
	phone.Close();

	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);	
	ServerClose(server);
	return TestStepResult();
	}
/**
 *  "Outgoing Call" function.  This function will wait until the
 *  Watchers have started and then will make and terminate a call.
 */
void CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe::OutgoingCallL()
	{
	const TInt KStartupPollPeriod = 1*1000000;
	const TInt KCallActivePeriod  = 5*1000000;

	TInt val(KErrNotFound);

	while (val < KErrNone)
		{
		User::After(KStartupPollPeriod);
		User::LeaveIfError(RProperty::Get(KUidSystemCategory, KUidCurrentCall.iUid, val));
		}

	RTelServer  telServer;

	User::LeaveIfError(telServer.Connect());
	CleanupClosePushL(telServer);

	RPhone  phone;

	User::LeaveIfError(phone.Open(telServer, KPhoneName));
	CleanupClosePushL(phone);

	RLine  line;

	User::LeaveIfError(line.Open(phone, KVoiceLineName));
	CleanupClosePushL(line);

	RCall  call;
	TName  callName;

	User::LeaveIfError(call.OpenNewCall(line, callName));
	CleanupClosePushL(call);

	_LIT(KTelNumber,"1234");

	User::LeaveIfError(call.Dial(KTelNumber));

	User::After(KCallActivePeriod);
	call.HangUp();

	CleanupStack::PopAndDestroy(&call);
	CleanupStack::PopAndDestroy(&line);
	CleanupStack::PopAndDestroy(&phone);
	CleanupStack::PopAndDestroy(&telServer);
	} // CTelWatchersIntTestOutgoingCallStatusWithPublishSubscribe::OutgoingCallL
示例#18
0
QList<RVector> RShape::getIntersectionPointsLT(const RLine& line1,
        const RTriangle& triangle2, bool limited) {

    QList<RVector> res;

    RVector normal = triangle2.getNormal();

    if (normal.getMagnitude() < 1.0e-12) {
        return res;
    }

    if (line1.getLength() < 1.0e-12) {
        return res;
    }

    double t = RVector::getDotProduct(normal, triangle2.getCorner(2) - line1.getStartPoint())
            / RVector::getDotProduct(normal, (line1.getEndPoint() - line1.getStartPoint()));

    // check if intersection point is on the line:
    if (limited && (t < 0.0 || t > 1.0)) {
        return res;
    }

    // intersection point:
    RVector ip = line1.getStartPoint() + (line1.getEndPoint() - line1.getStartPoint()) * t;

    // check if intersection point is inside the triangle:
    if (!limited || triangle2.isPointInTriangle(ip)) {
        res.push_back(ip);
    }

    return res;
}
示例#19
0
void CTelServerProcessor::GetLineInfoL(RPhone::TLineInfo& aInfo,const TDesC& aPhoneName, TUint aLineType)
        {
        RPhone phone;
        User::LeaveIfError(phone.Open(iTelServer,aPhoneName));
        CleanupClosePushL(phone);
        
        TInt count = 0;
        User::LeaveIfError(phone.EnumerateLines(count));
	if (count <= 0)
		{
    	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETLINEINFOL_1,"NetDial:\tGetLineInfoL(): no line info available - leaving with -1");
	        User::Leave(KErrNotFound);
		}
        
        TBool found = EFalse;
	for (TInt i=0; i<count && !found; ++i)
		{
		User::LeaveIfError(phone.GetLineInfo(i,aInfo));
		/* if (aInfo.iLineCapsFlags & aLineType) // Required line found
		        {
		        found=ETrue;
		        } */

		RLine line;
		User::LeaveIfError(line.Open(phone,aInfo.iName));
		CleanupClosePushL(line);

		RLine::TCaps caps;
		User::LeaveIfError(line.GetCaps(caps));
		if (caps.iFlags & aLineType) // Required line found
		        {
		        found=ETrue;
		        }
                CleanupStack::PopAndDestroy(&line);
	
		}

        CleanupStack::PopAndDestroy(&phone);
        if (!found)
        	{
        	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CTELSERVERPROCESSOR_GETLINEINFOL_2, "NetDial:\tGetLineInfoL(): required line not found - leaving with -1");
	        User::Leave(KErrNotFound);
        	}
        }
示例#20
0
void RSpline::appendToExploded(const RLine& line) const {
    if (line.getLength()<1.0e-6) {
        return;
    }

    if (!exploded.isEmpty()) {
        // compare angle of this sement with last segment and
        // modify last segment if angle is the same (straight line):
        QSharedPointer<RLine> prev = exploded.last().dynamicCast<RLine>();
        if (!prev.isNull()) {
            if (RMath::fuzzyCompare(prev->getAngle(), prev->getStartPoint().getAngleTo(line.getEndPoint()))) {
                prev->setEndPoint(line.getEndPoint());
                return;
            }
        }
    }

    exploded.append(QSharedPointer<RShape>(new RLine(line)));
}
enum TVerdict CTestOpenLineFrServ::doTestStepL()
	{
	INFO_PRINTF1(_L("Test Open Line From Server"));

    RTelServer server;
	TInt ret = server.Connect();
    TESTCHECK(ret, KErrNone);
   	ret=server.LoadPhoneModule(DSTD_MODULE_NAME);
    TESTCHECK(ret, KErrNone);

	RLine line;
    ret = line.Open(server,DSTD_LINE_FULLNAME);
	TESTCHECK(ret, KErrNone);
	line.Close();

  	ret=server.UnloadPhoneModule(DSTD_MODULE_NAME);
	TESTCHECK(ret, KErrNone);
    ServerClose(server);

	return TestStepResult();
    }
示例#22
0
bool RExporter::exportLinetypeShape(QList<RPainterPath>& pps, const RLine& line, double total, double length, double angle, const RVector& cursor) {
    RVector min = RPainterPath::getMinList(pps);
    RVector max = RPainterPath::getMaxList(pps);
    bool isCursorOnLine = line.isOnShape(cursor);
    double diffBefore = total+min.x;
    double diffAfter = total+max.x-length;
    bool shapeOutsideBefore = diffBefore < -RS::PointTolerance;
    bool shapeOutsideAfter = diffAfter > RS::PointTolerance;
    if (isCursorOnLine && (!shapeOutsideBefore && !shapeOutsideAfter)) {
        exportPainterPaths(pps, angle, cursor);
        return true;
    }
    else {
        if (shapeOutsideBefore) {
            // check if first shape is not entirely before the start point of the line:
            if (total + max.x < 0.0) {
                return false;
            }
            RLine l = line;
            if (fabs(total+max.x)<length) {
                RVector p = RVector(
                            cos(angle) * fabs(total+max.x),
                            sin(angle) * fabs(total+max.x)
                            );
                l.endPoint = l.startPoint + p;
            }
            exportLineSegment(l, angle);
            return true;
        }
        if (shapeOutsideAfter) {
            // check if last shape is not entirely after the end point of the line:
            if (total + min.x > length) {
                return false;
            }
            RLine l = line;
            if (fabs(total+min.x)>0.0) {
                RVector p = RVector(
                            cos(angle) * fabs(total+min.x),
                            sin(angle) * fabs(total+min.x)
                            );
                l.startPoint = l.startPoint + p;
            }
            exportLineSegment(l, angle);
            return true;
        }

        return false;
    }
}
示例#23
0
QList<RVector> RShape::getIntersectionPointsLL(const RLine& line1,
        const RLine& line2, bool limited1, bool limited2) {
    QList<RVector> res;
    double a1 = line1.endPoint.y - line1.startPoint.y;
    double b1 = line1.startPoint.x - line1.endPoint.x;
    double c1 = a1 * line1.startPoint.x + b1 * line1.startPoint.y;

    double a2 = line2.endPoint.y - line2.startPoint.y;
    double b2 = line2.startPoint.x - line2.endPoint.x;
    double c2 = a2 * line2.startPoint.x + b2 * line2.startPoint.y;

    double det = a1 * b2 - a2 * b1;
    if (fabs(det) < 1.0e-6) {
        return res;
    } else {
        RVector v((b2 * c1 - b1 * c2) / det, (a1 * c2 - a2 * c1) / det);

        if ((!limited1 || line1.isOnShape(v)) && (!limited2 || line2.isOnShape(v))) {
            res.append(v);
            return res;
        }
    }
    return res;
}
示例#24
0
bool RDimRotatedData::moveReferencePoint(const RVector& referencePoint, const RVector& targetPoint) {
    // if definition point and extension points are on one line,
    // move the extension points together with the definition point:
    bool moveExtensionPoints = false;
    if (referencePoint.equalsFuzzy(definitionPoint)) {
        if (RLine(extensionPoint1, extensionPoint2).isOnShape(definitionPoint, false)) {
            moveExtensionPoints = true;
        }
    }

    bool ret = RDimLinearData::moveReferencePoint(referencePoint, targetPoint);

    if (moveExtensionPoints) {
        // move extension points with definition point:
        RVector dir = RVector::createPolar(1.0, rotation);
        RLine dimLine = RLine(targetPoint, targetPoint + dir);
        extensionPoint1 = dimLine.getClosestPointOnShape(extensionPoint1, false);
        extensionPoint2 = dimLine.getClosestPointOnShape(extensionPoint2, false);
        definitionPoint = RVector::getAverage(extensionPoint1, extensionPoint2);
        //recomputeDefinitionPoint(referencePoint, targetPoint);
    }

    return ret;
}
示例#25
0
void CPubSubMode::TestCallInitiationL(const TDesC& aLineName, TUid aPSCallInitCategory, const TInt aPSCallInitKey)
	{		
	RLine line;
	CleanupClosePushL(line); 
	
	TName callName;
	
	INFO_PRINTF2(_L("Opening %S Line"), &aLineName);

	TInt ret = line.Open(iPhone,aLineName);
	TEST(ret==KErrNone);

	TInt callID = 0;
	RCall call;

	//Test  Initiate call using P&S
	
	line.NotifyIncomingCall(iStatus, callName);	// wait for a call
	
	ret = RProperty::Set(aPSCallInitCategory, aPSCallInitKey, callID);
	TEST(ret == KErrNone);
	callID++;
	
	User::WaitForRequest(iStatus);
	TEST(iStatus == KErrNone);	
	
	//answer the call then hangup.
	ret = call.OpenExistingCall(line, callName);
	TEST(ret == KErrNone);
	call.AnswerIncomingCall(iStatus);
	User::WaitForRequest(iStatus);	
	call.HangUp();
	call.Close();
	
	CleanupStack::PopAndDestroy(); //call	
	}
示例#26
0
void RGraphicsSceneQt::exportLineSegment(const RLine& line, double angle) {
    Q_ASSERT(currentPainterPath.isValid());

    if (line.getLength()<RS::PointTolerance && !RMath::isNaN(angle)) {
        // Qt won't export a zero length line as point:
        RVector startPoint = line.startPoint - RVector::createPolar(0.01, angle);
        RVector endPoint = line.endPoint + RVector::createPolar(0.01, angle);
        currentPainterPath.moveTo(startPoint);
        currentPainterPath.lineTo(endPoint);
        return;
    }

    // add new painter path with current entity ID:
    if ((currentPainterPath.currentPosition() - QPointF(line.startPoint.x, line.startPoint.y)).manhattanLength() > RS::PointTolerance) {
        currentPainterPath.moveTo(line.startPoint);
    }

    currentPainterPath.lineTo(line.endPoint);
}
示例#27
0
void RExporter::exportLine(const RLine& line, double offset) {
    if (!line.isValid()) {
        return;
    }

    double length = line.getLength();

    if (length>1e100 || length<RS::PointTolerance) {
        return;
    }

    RLinetypePattern p = getLinetypePattern();

    // continuous line or
    // we are in draft mode or
    // QCAD is configured to show screen based line patterns
    if (!p.isValid() || p.getNumDashes() == 1 || draftMode || screenBasedLinetypes) {
        exportLineSegment(line);
        return;
    }

    p.scale(getPatternFactor());
    double patternLength = p.getPatternLength();
    

    // avoid huge number of small segments due to very fine 
    // pattern or long lines:
    if (patternLength<RS::PointTolerance || length / patternLength > 5000) {
        exportLineSegment(line);
        return;
    }

    double angle = line.getAngle();
    RVector* vp = NULL;
    vp = new RVector[p.getNumDashes()];
    for (int i = 0; i < p.getNumDashes(); ++i) {
        vp[i] = RVector(cos(angle) * fabs(p.getDashLengthAt(i)),
                        sin(angle) * fabs(p.getDashLengthAt(i)));
    }

    bool optimizeEnds = false;
    if (RMath::isNaN(offset)) {
        offset = getPatternOffset(length, p);
        optimizeEnds = true;
    }
    else {
        double num = ceil(offset / patternLength);
        offset -= num * patternLength;
    }

    bool done = false;
    int i = 0;
    RVector cursor(line.getStartPoint() + RVector::createPolar(offset, angle));
    double total = offset;
    bool dashFound = false;
    bool gapFound = false;
    RVector p1 = line.getStartPoint();
    RVector p2 = p1;

    do {
        if (dashFound && !gapFound) {
            // don't shoot over end of line:
            if (total + fabs(p.getDashLengthAt(i)) >= length - 1.0e-6) {
                if (optimizeEnds) {
                    exportLineSegment(RLine(p1, line.endPoint));
                }
                else {
                    exportLineSegment(RLine(p1, p2));
                }
                break;
            }
            exportLineSegment(RLine(p1, p2));
        }

        // dash, no gap. note that a dash can have a length of 0.0 (point):
        if (p.getDashLengthAt(i) > -RS::PointTolerance) {
            // check if we're on the line already:
            if (total + p.getDashLengthAt(i) > 0) {
                p1 = cursor;

                // no gap at the beginning of the line:
                if (total < 0 || (!dashFound && optimizeEnds)) {
                    p1 = line.startPoint;
                }

                p2 = cursor + vp[i];
                if (!p2.equalsFuzzy(line.startPoint, 1.0e-6)) {
                    dashFound = true;
                }
            }
            gapFound = false;
        }

        // gap:
        else {
            gapFound = true;
        }

        cursor += vp[i];
        total += fabs(p.getDashLengthAt(i));

        done = total > length;

        ++i;
        if (i >= p.getNumDashes()) {
            i = 0;
        }
    } while (!done);

    if (!gapFound || !dashFound) {
        if (total + fabs(p.getDashLengthAt(i)) >= length - 1.0e-6) {
            if (optimizeEnds || (total>length && !gapFound)) {
                exportLineSegment(RLine(p1, line.endPoint));
            }
            else {
                exportLineSegment(RLine(p1, p2));
            }
        } else {
            exportLineSegment(RLine(p1, p2));
        }
    }

    delete[] vp;
}
TInt CTestDriveDataCallCallBack::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side "Data Call dial-up networking 
 * call-back" test code.  This method sets up an outgoing data-call write test that is 
 * terminated from the remote end.  The test then quickly responds to an incoming call.  
 * Data is received and the call is terminated again from the remote end.
 */
	{
	_LIT(KDataLineName,"Data");

	INFO_PRINTF1(_L("Opening Mobile Phone\n"));

	RLine line;
	INFO_PRINTF1(_L("Opening Data Line\n"));
	TESTL(line.Open(iPhone,KDataLineName)==KErrNone);

	INFO_PRINTF1(_L("Opening New Data Call\n"));
	RCall call;
	TESTL(call.OpenNewCall(line)==KErrNone);

	TRequestStatus reqStatus;
	RMobilePhone::TMMTableSettings tableSettings;
	tableSettings.iLocId=KInternetAccessPoint;
	RMobilePhone::TMMTableSettingsPckg tableSettingsPckg(tableSettings);
	iPhone.InitialiseMM(reqStatus , tableSettingsPckg); 	
	User::WaitForRequest(reqStatus);
	TESTL(reqStatus == KErrNone);

	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	RCommServ cs;
	TESTL(cs.Connect()==KErrNone);

	RComm port;
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	// Transfer data
	TRequestStatus stat;
	port.Write(stat,KWriteTestCallBackData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestCallBackData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	// Now wait for an incoming call...
	INFO_PRINTF1(_L("Wait to Answer incoming Data Call\n"));
	TESTL(call.AnswerIncomingCall()==KErrNone);

	INFO_PRINTF1(_L("Loan Data Call Port to Comm Server\n"));
	TESTL(call.LoanDataPort(commPort)==KErrNone);

	TESTL(cs.Connect()==KErrNone);
	TESTL(port.Open(cs,commPort.iPort,ECommShared)==KErrNone);

	port.Write(stat,KWriteTestCallBackData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

    //-- a small delay between successive writes to the COM port
    //-- I had to insert it to fix mistiming between script execution and sending AT-commands to modem
    User::After(500000);		

	port.Write(stat,KWriteTestCallBackData2);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	// Remote termination of call should have occurred in scripts, 
	// close port and comm server
	port.Close();
	cs.Close();
	INFO_PRINTF1(_L("Reclaim Data Call Port from Comm Server\n"));
	TESTL(call.RecoverDataPort()==KErrNone);

	TInt32 ss;
	TInt8 bar;
	iPhone.GetSignalStrength(stat,ss,bar);
	//	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	line.Close();
	call.Close();
	return KErrNone;
	}
示例#29
0
double RExporter::exportLine(const RLine& line, double offset) {
    double ret = RNANDOUBLE;

    if (!line.isValid()) {
        return ret;
    }

    double length = line.getLength();

    if (length>1e100 || length<RS::PointTolerance) {
        return ret;
    }

    double angle = line.getAngle();

    // continuous line or
    // we are in draft mode or
    // QCAD is configured to show screen based line patterns
    if (draftMode || screenBasedLinetypes || twoColorSelectedMode) {
        exportLineSegment(line, angle);
        return ret;
    }

    RLinetypePattern p = getLinetypePattern();
    if (!p.isValid() || p.getNumDashes() <= 1) {
        exportLineSegment(line, angle);
        return ret;
    }

    p.scale(getLineTypePatternScale(p));
    double patternLength = p.getPatternLength();

    // avoid huge number of small segments due to very fine 
    // pattern or long lines:
    if (patternLength<RS::PointTolerance || length / patternLength > RSettings::getDashThreshold()) {
        exportLineSegment(line, angle);
        return ret;
    }

    RVector* vp = NULL;
    vp = new RVector[p.getNumDashes()];
    for (int i = 0; i < p.getNumDashes(); ++i) {
        vp[i] = RVector(cos(angle) * fabs(p.getDashLengthAt(i)),
                        sin(angle) * fabs(p.getDashLengthAt(i)));
    }

    if (RMath::isNaN(offset)) {
        offset = p.getPatternOffset(length);
    }
    else {
        double num = ceil(offset / patternLength);
        offset -= num * patternLength;
    }

    bool done = false;
    int i = 0;
    RVector cursor(line.getStartPoint() + RVector::createPolar(offset, angle));
    double total = offset;
    double nextTotal;
    bool isGap = false;
    RLine dash;

    do {
        double dashLength = p.getDashLengthAt(i);
        nextTotal = total + fabs(dashLength);
        //qDebug() << "total: " << total;
        //qDebug() << "nextTotal: " << nextTotal;

        // dash, no gap. note that a dash can have a length of 0.0 (point):
        if (dashLength > -RS::PointTolerance) {
            isGap = false;
        }

        // gap:
        else {
            isGap = true;
        }

        // check if we're on the line already
        // (since we might start before the line due to pattern offset):
        if (nextTotal > 0.0) {
            dash = RLine(cursor, cursor + vp[i]);

            if (!isGap) {
                // fist part is gap, then dash
                ret = -nextTotal;
            }
            else {
                // fist part is dash, then gap
                ret = nextTotal;
            }

            // shorten at start of line:
            if (total < 0.0 /*&& nextTotal > 0.0*/) {
                dash.startPoint = line.startPoint;
                ret = RNANDOUBLE;
            }

            // shorten at end of line:
            if (/*total < length &&*/ nextTotal >= length - 1.0e-6) {
                dash.endPoint = line.endPoint;
                ret = RINFDOUBLE;
            }

            if (!isGap) {
                exportLineSegment(dash, angle);
                ret = nextTotal;
            }
        }

        cursor += vp[i];
        total = nextTotal;

        done = total > length;

        // export shape (zigzag, text, etc.) at end of dash / gap:
        if (p.hasShapeAt(i)) {
            QList<RPainterPath> pps = p.getShapeAt(i);
            exportLinetypeShape(pps, line, total, length, angle, cursor);
        }

        ++i;
        if (i >= p.getNumDashes()) {
            i = 0;
        }
    } while (!done);

    delete[] vp;

    return ret;
}
示例#30
0
static void DialNumberL(PktBuf &in, PktBuf &out) {
	/// @todo maybe use a CActive object to allow the call to be cancelled from gammu
	TBuf<100> aPhoneNumber;

	in >> aPhoneNumber;

	cons->Printf( _L("dialing... number:\n") );
	cons->Printf( aPhoneNumber );
	cons->Printf( _L("\n") );

	TName newCallName = _L("call");

	//Create a connection to the tel server
	RTelServer server;
	CleanupClosePushL(server);
	User::LeaveIfError(server.Connect());

	//Load in the phone device driver
	User::LeaveIfError(server.LoadPhoneModule(KTsyName));
	
	//Find the number of phones available from the tel server
	TInt numberPhones;
	User::LeaveIfError(server.EnumeratePhones(numberPhones));

	//Check there are available phones
	if (numberPhones < 1)
	{
		User::Leave(KErrNotFound);
	}

	//Get info about the first available phone
	RTelServer::TPhoneInfo info;
	User::LeaveIfError(server.GetPhoneInfo(0, info));

	//Use this info to open a connection to the phone, the phone is identified by its name
	RPhone phone;
	CleanupClosePushL(phone);
	User::LeaveIfError(phone.Open(server, info.iName));

	//Get info about the first line from the phone
	RPhone::TLineInfo lineInfo;
	User::LeaveIfError(phone.GetLineInfo(0, lineInfo));

	//Use this to open a line
	RLine line;
	CleanupClosePushL(line);
	User::LeaveIfError(line.Open(phone, lineInfo.iName));

	//Open a new call on this line
	RCall call;
	CleanupClosePushL(call);
	User::LeaveIfError(call.OpenNewCall(line, newCallName));

	if ((call.Dial(aPhoneNumber) == KErrNone))
	{
		TRequestStatus iStatus;
		RCall::TStatus iLineStatus;
		line.NotifyStatusChange(iStatus, iLineStatus);
		User::WaitForRequest(iStatus);
	}

	CleanupStack::PopAndDestroy(4);//phone, line, call

	//Unload the phone device driver
	User::LeaveIfError(server.UnloadPhoneModule(KTsyName));

	out << (TUint16)GNAPPLET_MSG_PHONEBOOK_DIAL_RESP;
	out << (TUint16)GN_ERR_NONE;
}