LOCAL_C TInt NTRasThreadFunction(TAny* /*aThreadData*/)
	{
	_LIT(KCsyName,"LOOPBACK.CSY");
	_LIT(KPortName,"LOOPBACK::1");

	_LIT8(KServerText,"SERVER");

	CTrapCleanup* cleanup;
	if ((cleanup=CTrapCleanup::New())==NULL)
		return KErrGeneral;

	RCommServ commServ;
	TInt r=commServ.Connect();
	r=commServ.LoadCommModule(KCsyName);
	RComm comm;
	r=comm.Open(commServ,KPortName,ECommShared);

	TBuf8<6> readBuf;
	TRequestStatus stat0;
	comm.Read(stat0,readBuf);
	User::WaitForRequest(stat0) ;

	comm.Write(stat0,KServerText);
	User::WaitForRequest(stat0) ;


	delete cleanup;
	ASSERT(RThread().RequestCount()==0);
	return r;
	}
/**
See BT_ROMCONFIG_RCOMMSERV_001.script
*/
TVerdict CTestStepBtRomConfigRCommServ001::doTestStepL()
	{
	INFO_PRINTF1(\
		_L("&gt;&gt;CTestStepBtRomConfigRCommServ001::doTestStepL()"));
	const TInt expectedError = ( iBtExcluded ? KErrNotFound : KErrNone );
	// this is only used for logging readability purposes
	const TDesC* expectedErrorDesPtr = ( iBtExcluded ? &KErrNotFoundLit : &KErrNoneLit ); 
	
	RCommServ commServ;
	commServ.Connect();
	
	TInt err = commServ.LoadCommModule( KBtComm );
	if ( err!=expectedError )
		{
		INFO_PRINTF4(\
			_L("Failed: Expected %S(%d) and got %d when calling LoadCommModule(\"BTCOMM\")"),\
			expectedErrorDesPtr, expectedError, err);
		SetTestStepResult(EFail);
		}
	
	commServ.Close();

	INFO_PRINTF1(\
		_L("&lt;&lt;CTestStepBtRomConfigRCommServ001::doTestStepL()"));
	CheckAndSetTestResult();
	return TestStepResult(); 
	}
Ejemplo n.º 3
0
/* virtual */ TVerdict CTestStepInjectMemLeakC32::doTestStepL()
	{
	// inject memory leak to test memory leak detection mechanism working:
	
	_LIT(KCsyName,"LOOPBACK.CSY");
	_LIT(KPortName0,"LOOPBACK::0");
	_LIT8(KMemLeakToken, "--MemoryLeakToken--");	
	
	RCommServ commServ;
	
	TInt ret=commServ.Connect();
	TESTCHECKL(ret,KErrNone);
	
	ret=commServ.LoadCommModule(KCsyName);
	TESTCHECKL(ret,KErrNone);
	
	ret=iSerialPortList[1].Open(commServ,KPortName0,ECommShared);
	TESTCHECKL(ret,KErrNone);
		
	TRequestStatus stat0;
	
	TBuf8<20> writeBuf;
	writeBuf.Append(KMemLeakToken);
	
	iSerialPortList[1].Write(stat0,writeBuf);
	
	User::WaitForRequest(stat0);
	TESTCHECKL(stat0.Int(), KErrNone);
				
	iSerialPortList[1].Close();
	
	commServ.Close();				
	
	return TestStepResult();
	}
bool SerialPortInfo::isValid() const
{
    if (!loadDevices())
        return false;

    RCommServ server;
    TInt r = server.Connect();
    if (r != KErrNone)
        return false;

    RComm port;
    TPtrC portName(static_cast<const TUint16*>(systemLocation().utf16()), systemLocation().length());
    r = port.Open(server, portName, ECommExclusive);
    if (r == KErrNone)
        port.Close();
    return r == KErrNone || r == KErrLocked;
}
Ejemplo n.º 5
0
static void InitCommsL()
    {
    
   TInt err=0;
    err = User::LoadPhysicalDevice (PDD_NAME); 
    if ( err != KErrAlreadyExists && err)
    	User::Leave(err); 
  	err = User::LoadLogicalDevice (LDD_NAME);
  	if ( err != KErrAlreadyExists && err)
    	User::Leave(err);
  	StartC32();
  	
  	RCommServ ComSer;
  	ComSer.Connect();
  		
  	err=ComSer.LoadCommModule(_L("ECUART"));	 	
    if ( err != KErrAlreadyExists && err)
    	User::Leave(err);  
    }
Ejemplo n.º 6
0
bool QSerialPortPrivate::open(QIODevice::OpenMode mode)
{
    Q_Q(QSerialPort);

    // FIXME: Maybe need added check an ReadWrite open mode?
    Q_UNUSED(mode)

    if (!loadDevices()) {
        q->setError(QSerialPort::UnknownError);
        return false;
    }

    RCommServ server;
    errnum = server.Connect();
    if (errnum != KErrNone) {
        q->setError(decodeSystemError());
        return false;
    }

    if (systemLocation.contains("BTCOMM"))
        errnum = server.LoadCommModule(KBluetoothModuleName);
    else if (systemLocation.contains("IRCOMM"))
        errnum = server.LoadCommModule(KInfraRedModuleName);
    else if (systemLocation.contains("ACM"))
        errnum = server.LoadCommModule(KACMModuleName);
    else
        errnum = server.LoadCommModule(KRS232ModuleName);

    if (errnum != KErrNone) {
        q->setError(decodeSystemError());
        return false;
    }

    // In Symbian OS port opening only in R/W mode?
    TPtrC portName(static_cast<const TUint16*>(systemLocation.utf16()), systemLocation.length());
    errnum = descriptor.Open(server, portName, ECommExclusive);

    if (errnum != KErrNone) {
        q->setError(decodeSystemError());
        return false;
    }

    // Save current port settings.
    errnum = descriptor.Config(restoredSettings);
    if (errnum != KErrNone) {
        q->setError(decodeSystemError());
        return false;
    }

    detectDefaultSettings();
    return true;
}
QList<SerialPortInfo> SerialPortInfo::availablePorts()
{
    QList<SerialPortInfo> ports;

    if (!loadDevices())
        return ports;

    RCommServ server;
    TInt r = server.Connect();
    if (r != KErrNone)
        return ports; //User::LeaveIfError(r);

    TSerialInfo nativeInfo; // Native Symbian OS port info class.
    QString s("%1::%2");

    // FIXME: Get info about RS232 ports.
    r = server.LoadCommModule(KRS232ModuleName);
    //User::LeaveIfError(r);
    if (r == KErrNone) {
        r = server.GetPortInfo(KRS232ModuleName, nativeInfo);
        if (r == KErrNone) {
            //
            for (quint32 i = nativeInfo.iLowUnit; i < nativeInfo.iHighUnit + 1; ++i) {

                SerialPortInfo info; // My (desired) info class.

                info.d_ptr->device = s
                        .arg(QString::fromUtf16(nativeInfo.iName.Ptr(), nativeInfo.iName.Length()))
                        .arg(i);
                info.d_ptr->portName = info.d_ptr->device;
                info.d_ptr->description =
                        QString::fromUtf16(nativeInfo.iDescription.Ptr(), nativeInfo.iDescription.Length());
                info.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                ports.append(info);
            }
        }
    }

    // FIXME: Get info about Bluetooth ports.
    r = server.LoadCommModule(KBluetoothModuleName);
    //User::LeaveIfError(r);
    if (r == KErrNone) {
        r = server.GetPortInfo(KBluetoothModuleName, nativeInfo);
        if (r == KErrNone) {
            //
            for (quint32 i = nativeInfo.iLowUnit; i < nativeInfo.iHighUnit + 1; ++i) {

                SerialPortInfo info; // My (desired) info class.

                info.d_ptr->device = s
                        .arg(QString::fromUtf16(nativeInfo.iName.Ptr(), nativeInfo.iName.Length()))
                        .arg(i);
                info.d_ptr->portName = info.d_ptr->device;
                info.d_ptr->description =
                        QString::fromUtf16(nativeInfo.iDescription.Ptr(), nativeInfo.iDescription.Length());
                info.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                ports.append(info);
            }
        }
    }

    // FIXME: Get info about InfraRed ports.
    r = server.LoadCommModule(KInfraRedModuleName);
    //User::LeaveIfError(r);
    if (r == KErrNone) {
        r = server.GetPortInfo(KInfraRedModuleName, nativeInfo);
        if (r == KErrNone) {
            //
            for (quint32 i = nativeInfo.iLowUnit; i < nativeInfo.iHighUnit + 1; ++i) {

                SerialPortInfo info; // My (desired) info class.

                info.d_ptr->device = s
                        .arg(QString::fromUtf16(nativeInfo.iName.Ptr(), nativeInfo.iName.Length()))
                        .arg(i);
                info.d_ptr->portName = info.d_ptr->device;
                info.d_ptr->description =
                        QString::fromUtf16(nativeInfo.iDescription.Ptr(), nativeInfo.iDescription.Length());
                info.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                ports.append(info);
            }
        }
    }

    // FIXME: Get info about ACM ports.
    r = server.LoadCommModule(KACMModuleName);
    //User::LeaveIfError(r);
    if (r == KErrNone) {
        r = server.GetPortInfo(KACMModuleName, nativeInfo);
        if (r == KErrNone) {
            //
            for (quint32 i = nativeInfo.iLowUnit; i < nativeInfo.iHighUnit + 1; ++i) {

                SerialPortInfo info; // My (desired) info class.

                info.d_ptr->device = s
                        .arg(QString::fromUtf16(nativeInfo.iName.Ptr(), nativeInfo.iName.Length()))
                        .arg(i);
                info.d_ptr->portName = SerialPortPrivate::portNameFromSystemLocation(info.d_ptr->device);
                info.d_ptr->description =
                        QString::fromUtf16(nativeInfo.iDescription.Ptr(), nativeInfo.iDescription.Length());
                info.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                ports.append(info);
            }
        }
    }

    return ports;
}
//
// Perform the Test
//
LOCAL_C void PerformTestL()
/**
 *
 * The PerformTestL method is the main user interface routine for the GSM TSY Regression
 * Test Harness.  It loads the appropriate serial drivers and unloads them at completion.
 * This method presents the user with the list of tests to run and then
 * responds to the user's input.  If the user does not select any specific test, it runs all
 * tests as the default.
 *
 * @leave	This method leaves if it can not connect to the communications server or load
 *			the CSY.  Additionally, this method leaves if the test script can not be created.
 *			If the test fails with an error, User::Leave will be invoked.
 */
	{
	RCommServ commServer;
	TESTL(commServer.Connect()==KErrNone);
	TInt res=commServer.LoadCommModule(_L("ECUART.CSY"));
	INFO_PRINTF1(TRefByValue<const TDesC>(_L("LoadCommModuleError = %d\n")), res);
	TESTL(res==KErrNone || res==KErrAlreadyExists);

//  This block of prints is for all tests to be listed in one column
//  Note: by displaying menu selectons in a single column, all selections will not be visible
	INFO_PRINTF1(_L("Which test?  Leave to run all tests\n"));
	INFO_PRINTF1(_L("a) Receive SMS Test\n"));
	INFO_PRINTF1(_L("b) SMS Notification Test\n"));
	INFO_PRINTF1(_L("c) SMS PDU Capability Test\n"));
	INFO_PRINTF1(_L("d) Default SCA Test\n"));
	INFO_PRINTF1(_L("e) SMS Transmission Test\n"));
	INFO_PRINTF1(_L("f) Data Call Test\n"));
	INFO_PRINTF1(_L("g) Errored Data Call Test\n"));
	INFO_PRINTF1(_L("h) Odd Initialisation Tests\n"));
	INFO_PRINTF1(_L("i) SMS Storage Tests\n"));
	INFO_PRINTF1(_L("j) Failure Initialisation Tests\n"));
	INFO_PRINTF1(_L("k) Incoming Call Tests\n"));
	INFO_PRINTF1(_L("l) SMS Cancel Scenarios\n"));
	INFO_PRINTF1(_L("m) Shutdown Scenarios\n"));
	INFO_PRINTF1(_L("n) SMS Storage Delete Test\n"));
	INFO_PRINTF1(_L("o) Simultaneous Fax Reception and Signal Strength Retrieval Scenario\n"));
	INFO_PRINTF1(_L("p) Data Call Cancel Scenarios\n"));
	INFO_PRINTF1(_L("q) Fax Call Premature Close Scenario\n"));
	INFO_PRINTF1(_L("r) Two Fax Reception Scenario\n"));
	INFO_PRINTF1(_L("s) Voice Call Scenarios\n"));
	INFO_PRINTF1(_L("t) Data Call Set-up, Data Transfer and Remote Termination Test\n"));
	INFO_PRINTF1(_L("u) Data Call Dial-up Networking Call-back Test\n"));
	INFO_PRINTF1(_L("v) Data Call Answer and Remote Hang-up Closely Followed by a Dial Test\n"));
	INFO_PRINTF1(_L("w) Phonebook tests\n"));
	INFO_PRINTF1(_L("x) Network and Registration tests\n"));
	INFO_PRINTF1(_L("y) Phone and Line tests\n"));
	INFO_PRINTF1(_L("z) Voice and Data calls tests\n"));
	INFO_PRINTF1(_L("1) No CNMI info and Modem Detection tests\n"));
	INFO_PRINTF1(_L("2) No CMGF info tests\n"));
	INFO_PRINTF1(_L("3) AT+CBST  tests\n"));
	INFO_PRINTF1(_L("4) CBST & CNMI string parsing test\n")) ;
	INFO_PRINTF1(_L("5) CGQREQ responses during initialise\n"));
	INFO_PRINTF1(_L("6) Unsolicited messages injected during initialisation\n"));
	INFO_PRINTF1(_L("9) Voice Call OOM tests (NOT RUN AS PART OF 'ALL TESTS')\n"));

	TBool keyPressed=ETrue;
	TKeyCode key=ShortWaitForKey(10, keyPressed);

	TBool allTests=!keyPressed;
	if(keyPressed)
		{
		if((key>='A')&&(key<='Z'))	// A simple fold
			key=(TKeyCode)(key-'A'+'a');
		}

//
// Run the tests...
//


// Test Rx SMS messages
	if((key=='a')||(allTests))
		{
		SIMPLETESTMACRO("Simple SMS Receive",CTestDriveRxMess,ERxMessScript);
		SIMPLETESTMACRO("CMT SMS Receive",CTestDriveRxMessCmt,ERxMessCmtAndCmtiScript);
		SIMPLETESTMACRO("CMTI SMS Receive emulating an Ericsson T28",CTestDriveRxMess,ERxMessEricssonT28Script);
		}

// Test Notification of SMS messages
	if((key=='b')||(allTests))
		{
		SIMPLETESTMACRO("SMS CMTI Notification and Receive",CTestDriveNotMess,ERxMessScript);
		SIMPLETESTMACRO("SMS CMT Notification and Receive",CTestDriveNotMessCmt,ERxMessCmtScript);
		}

// Test behaviour when a modem claims not to support SMS PDU mode
	if((key=='c')||(allTests))
		{
		SIMPLETESTMACRO("No SMS PDU capability",CTestDriveNoPduRxMess,ENoPduRxMessScript);
		}


// Test retrieval and setting of default service centre

	if ((key=='d')||(allTests))
		{
		SIMPLETESTMACRO("Simple SCA retrieval & setting",CTestDriveSca,EScaSimpleScript);
		SIMPLETESTMACRO("8210-style SCA retrieval & setting",CTestDriveSca,ESca8210StyleScript);
		}


// Test a simple SMS Tx
	if((key=='e')||(allTests))
		{
		SIMPLETESTMACRO("A simple SMS Tx",CTestDriveTxMess,ETxMessScript);
		SIMPLETESTMACRO("New Standard SMS Tx",CTestDriveTxNewStdMess,ETxMessNewStdScript);
		SIMPLETESTMACRO("New Standard SMS Tx Test emulating an Ericsson T28",CTestDriveTxNewStdMess,ETxMessT28NewStdScript);

	// Test no prefix on pdu, don't set default sca, new ETSI format
		_LIT8(KTxA,"Tx: no PDU prefix, no default SCA set, new standard");
		StartTest(KTxA);
		CTestDriveTxWithScaCombo* test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixNodefscaNew,EFalse,EFalse,ETrue);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxA);
		User::After(1000000L);

	// Test prefix on pdu, don't set default sca, new ETSI format
		_LIT8(KTxB,"Tx: PDU prefix, no default SCA set, new standard");
		StartTest(KTxB);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixNodefscaNew,ETrue,EFalse,ETrue);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxB);
		User::After(1000000L);

	// Test no prefix on pdu, set default sca, new ETSI format
		_LIT8(KTxC,"Tx: no PDU prefix, default SCA set, new standard");
		StartTest(KTxC);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixDefscaNew,EFalse,ETrue,ETrue);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxC);
		User::After(1000000L);

	// Test prefix on pdu, set default sca, new ETSI format
		_LIT8(KTxD,"Tx: PDU prefix, default SCA set, new standard");
		StartTest(KTxD);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixDefscaNew,ETrue,ETrue,ETrue);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxD);
		User::After(1000000L);

	// Test no prefix on pdu, don't set default sca, old ETSI format
		_LIT8(KTxE,"Tx: No PDU prefix, no default SCA set, old standard");
		StartTest(KTxE);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixNodefscaOld,EFalse,EFalse,EFalse);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxE);
		User::After(1000000L);

	// Test prefix on pdu, don't set default sca, old ETSI format
		_LIT8(KTxF,"Tx: PDU prefix, no default SCA set, old standard");
		StartTest(KTxF);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixNodefscaOld,ETrue,EFalse,EFalse);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxF);
		User::After(1000000L);

	// Test no prefix on pdu, set default sca, old ETSI format
		_LIT8(KTxG,"Tx: no PDU prefix, default SCA set, old standard");
		StartTest(KTxG);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptNoprefixDefscaOld,EFalse,ETrue,EFalse);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxG);
		User::After(1000000L);

	// Test prefix on pdu, set default sca, old ETSI format
		_LIT8(KTxH,"Tx: PDU prefix, default SCA set, old standard");
		StartTest(KTxH);
		test4c=CTestDriveTxWithScaCombo::NewL(ETxMessScriptPrefixDefscaOld,ETrue,ETrue,EFalse);
		CleanupStack::PushL(test4c);
		User::LeaveIfError(test4c->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KTxH);
		User::After(1000000L);

	// Test a "+CMS ERROR 321" from a Read (observed on an Ericsson 888)
		SIMPLETESTMACRO("Invalid Read Test",CTestDriveTxRx,ETxMessRxTxScriptA);
		}

// Test Dialing a Data Call
	if((key=='f')||(allTests))
		{
		SIMPLETESTMACRO("Dialing a simple Data Call",CTestDriveDataCall,EDataCallScript);
		}

// Test an Error Dialing a Data Call
	if((key=='g')||(allTests))
		{
		SIMPLETESTMACRO("Dialing a simple Data Call, with the modem ERRORing some commands",CTestDriveDataCall,EDataCallErrorAScript);
		}

// Test some odd initialisation sequences
	if((key=='h')||(allTests))
		{
		SIMPLETESTMACRO("Odd Initialisation Sequence A",CTestDriveOddInit,EOddInitAScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence B",CTestDriveOddInit,EOddInitBScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence C",CTestDriveOddInit,EOddInitCScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence D",CTestDriveOddInit,EOddInitDScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence E",CTestDriveOddInit,EOddInitEScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence F",CTestDriveOddInit,EOddInitFScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence G",CTestDriveOddInit,EOddInitGScript);
		SIMPLETESTMACRO("Odd Initialisation Sequence H",CTestDriveOddInit,EOddInitHScript);
 		SIMPLETESTMACRO("Odd Initialisation Sequence I",CTestDriveOddInit,EOddInitIScript);
		}

// Test SMS Storage functions
	if((key=='i')||(allTests))
		{
		SIMPLETESTMACRO("Message Storage Functions with old standard PDUs",CTestDriveMessStor,EMessStorOldSmsStdScript);
		SIMPLETESTMACRO("Message Storage Functions with new standard PDUs",CTestDriveMessStor,EMessStorNewSmsStdScript);
		}

// Test Initialisation Failure Scenarios
	if((key=='j')||(allTests))
		{
		SIMPLETESTMACRO("Initialisation Failure Scenarios",CTestDriveFailInit,EFailInitAScript);
		}

// Test Incoming Call Scenarios
	if((key=='k')||(allTests))
		{
		SIMPLETESTMACRO("Incoming Call Scenarios",CTestDriveInCall,EInCallScriptA);
		SIMPLETESTMACRO("Incoming Call Scenarios with a Nokia",CTestDriveInCall,EInCallScriptB);
		}

// Test SMS Cancel
	if((key=='l')||(allTests))
		{
		SIMPLETESTMACRO("SMS Cancel CMT Scenarios",CTestDriveSmsCancel,ESmsCancelScript);
		SIMPLETESTMACRO("SMS Cancel CMTI Scenarios",CTestDriveSmsCancel,ESmsCancelCmtiScript);
		}

// Test Shutdown Scenarios
	if((key=='m')||(allTests))
		{
 		SIMPLETESTMACRO("Shutdown Scenarios",CTestDriveShutdown,EShutdownScript);
		SIMPLETESTMACRO("Shutdown Scenarios A",CTestDriveShutdownA,EShutdownScriptA);
		}

// Test SMS Delete
	if((key=='n')||(allTests))
		{
		SIMPLETESTMACRO("A Simple SMS Storage Delete",CTestDriveSmsDelete,ESmsStorageDeleteScript);
		}

// Test simultaneous Fax Reception and Signal Strength Retrieval
	if((key=='o')||(allTests))
		{
		SIMPLETESTMACRO("Simultaneous Fax Reception and Signal Strength Retrieval",CTestDriveSsFax,ESsFaxScriptA);
		SIMPLETESTMACRO("Simultaneous Data Reception and Signal Strength Retrieval",CTestDriveSSData,ESsDataScriptA);
		}

// Test Data Call Cancel Scenarios
	if((key=='p')||(allTests))
		{
		SIMPLETESTMACRO("Data Call Cancel Scenarios",CTestDriveDataCallCancel,EDataCallCancelScript);
		}

// Fax Call Premature Close Scenarios
	if((key=='q')||(allTests))
		{
		SIMPLETESTMACRO("Fax Call Premature Close Scenarios",CTestDrivePremClose,EFaxPremCloseScriptA);
//		SIMPLETESTMACRO("Fax Call Premature Close Scenarios Part B",CTestDrivePremCloseB,EFaxPremCloseScriptB);
		}

// Two Fax Reception Scenarios
	if((key=='r')||(allTests))
		{
		SIMPLETESTMACRO("Two Fax Reception Scenarios",CTestDriveTwoFaxRx,ETwoFaxRxScriptA);
		}

// Voice Call Scenarios
	if((key=='s')||(allTests))
		{
		SIMPLETESTMACRO("Voice Call Scenarios",CTestDriveVoiceCall,EVoiceCallScriptA);
		}

// Test Dialing a Set-up, Data Transfer and Remote Termination Data Call
	if((key=='t')||(allTests))
		{
		SIMPLETESTMACRO("Dialing a Set-up, Data Transfer and Remote Termination Data Call",CTestDriveDataCallRemoteTerm,EDataCallRemoteTermScript);
		}

// Test Dialing a Dial-up Networking Call-back Data Call
	if((key=='u')||(allTests))
		{
		TInt varDelay;  // Variable Delay for EWait script, for scoping purposes
		varDelay = KCallBackDefVarDelay;
		if(!allTests)
			{
			// This tests is valid for supporting variable delay for an EWait script
			varDelay = GetNumberEntry(	KCallBackMaxDigits,	// max numbers of digits
										KCallBackMinVarDelay,	// min value allowed
										KCallBackMaxVarDelay,	// max value allowed
										KInputWaitOnDelaySecs,	// secs to wait for a user key entry
										KCallBackDefVarDelay,	// default value if timed out
										_L("Enter delay value")
									 );
			}
		_LIT8(KCallbackA,"Dialing a Dial-up Networking Call-back Data Call");
		StartTest(KCallbackA);
		CTestDriveDataCallCallBack* test23=CTestDriveDataCallCallBack::NewL(EDataCallCallBackScript, varDelay);
		CleanupStack::PushL(test23);
		User::LeaveIfError(test23->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KCallbackA);
		User::After(1000000L);
		}

// Test an Answer and Remote Hang-up Closely Followed by a Dial Data Call
	if((key=='v')||(allTests))
		{
		TInt varDelay;  // Variable Delay for EWait script, for scoping purposes
		varDelay = KHangupDialDefVarDelay;
		if(!allTests)
			{
			// This tests is valid for supporting variable delay for an EWait script
			varDelay = GetNumberEntry(	KHangupDialMaxDigits,	// max numbers of digits
										KHangupDialMinVarDelay,	// min value allowed
										KHangupDialMaxVarDelay,	// max value allowed
										KInputWaitOnDelaySecs,	// secs to wait for a user key entry
										KHangupDialDefVarDelay,	// default value if timed out
										_L("Enter delay value")
									 );
			}
		_LIT8(KCallbackB,"Answer and Remote Hang-up Closely Followed by a Dial Data Call");
		StartTest(KCallbackB);
		CTestDriveRemoteHangupDial* test24=CTestDriveRemoteHangupDial::NewL(EDataCallRemoteHangDialScript, varDelay);
		CleanupStack::PushL(test24);
		User::LeaveIfError(test24->RunTestL());
		CleanupStack::PopAndDestroy();
		EndTest(KCallbackB);
		User::After(1000000L);
		}

// Phone book tests
	if((key=='w')||(allTests))
		{
		SIMPLETESTMACRO("Phone book Scenarios",CTestDrivePhoneBook,EPhoneBookScript);
		}

// Network and Registration tests
	if((key=='x')||(allTests))
		{
		SIMPLETESTMACRO("Testing Network and Registration",CTestDriveNetworkRegistration,ENetworkRegistrationScript);
		}

// Phone and Line tests
	if((key=='y')||(allTests))
		{
		SIMPLETESTMACRO("Phone and Line Scenarios",CTestDrivePhoneLine,EPhoneLineScript);
		}

// Voice and Data Call tests
	if((key=='z')||(allTests))
		{
		SIMPLETESTMACRO("Voice and Data Calls",CTestDriveAllCalls,EAllCallsScript);
		}

// No CNMI information and Modem notification tests
	if((key=='1')||(allTests))
		{
		SIMPLETESTMACRO("No CNMI info and Modem notification request",CTestDriveNoCnmi,ENoCnmiScript);
		}

// No CMGF information tests
	if((key=='2')||(allTests))
		{
		SIMPLETESTMACRO("No CMGF info request",CTestDriveNoCmgf,ENoCmgfScript);
		}

// AT+CBST information tests
	if((key=='3')||(allTests))
		{
		SIMPLETESTMACRO("AT+CBST tests",CTestDriveDataCallDiffParam, ECallDiffParamScript);
		}
//CBST string parsing test
	if((key=='4')||(allTests))
		{
		SIMPLETESTMACRO("CBST & CNMI string parsing test",CTestDriveCbstParse, ECbstParseScript);
		}

// CGQREQ responses during initialise (added to increase conditional code coverage)
	if((key=='5')||(allTests))
		{
		SIMPLETESTMACRO("CGQREQ responses during initialise",CTestDriveCGQREQResponses,ECGQREQResponsesScript);
		}

// Unsolicited messages injected during initialisation
	if((key=='6')||(allTests))
		{
		SIMPLETESTMACRO("Unsolicited messages injected during initialisation",CTestDriveUnsolicited,EUnsolicitedScript);
		}

// OOM Voice Call tests, not run as part of 'all tests'
	if(key=='9')
		{
		SIMPLETESTMACRO("OOM Voice Call",CTestDriveOOMVoiceCall,EOOMVoiceCall);
		}

//
// Tidy up after the tests
//
	res = commServer.UnloadCommModule(_L("ECUART.CSY"));
	commServer.Close();
	}
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;
	}
Ejemplo n.º 10
0
QList<QSerialPortInfo> QSerialPortInfo::availablePorts()
{
    QList<QSerialPortInfo> serialPortInfoList;

    if (!loadDevices())
        return serialPortInfoList;

    RCommServ server;
    TInt r = server.Connect();
    if (r != KErrNone)
        return serialPortInfoList;

    TSerialInfo nativeSerialInfo;
    QString s("%1::%2");

    // FIXME: Get info about RS232 ports.
    r = server.LoadCommModule(KRS232ModuleName);
    if (r == KErrNone) {
        r = server.GetPortInfo(KRS232ModuleName, nativeSerialInfo);
        if (r == KErrNone) {
            for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {

                QSerialPortInfo serialPortInfo;

                serialPortInfo.d_ptr->device = s
                                               .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
                                               .arg(i);
                serialPortInfo.d_ptr->portName = serialPortInfo.d_ptr->device;
                serialPortInfo.d_ptr->description =
                    QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
                serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                serialPortInfoList.append(serialPortInfo);
            }
        }
    }

    // FIXME: Get info about Bluetooth ports.
    r = server.LoadCommModule(KBluetoothModuleName);
    if (r == KErrNone) {
        r = server.GetPortInfo(KBluetoothModuleName, nativeSerialInfo);
        if (r == KErrNone) {
            for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {

                QSerialPortInfo serialPortInfo;

                serialPortInfo.d_ptr->device = s
                                               .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
                                               .arg(i);
                serialPortInfo.d_ptr->portName = serialPortInfo.d_ptr->device;
                serialPortInfo.d_ptr->description =
                    QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
                serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                serialPortInfoList.append(serialPortInfo);
            }
        }
    }

    // FIXME: Get info about InfraRed ports.
    r = server.LoadCommModule(KInfraRedModuleName);
    if (r == KErrNone) {
        r = server.GetPortInfo(KInfraRedModuleName, nativeSerialInfo);
        if (r == KErrNone) {
            for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {

                QSerialPortInfo serialPortInfo;

                serialPortInfo.d_ptr->device = s
                                               .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
                                               .arg(i);
                serialPortInfo.d_ptr->portName = serialPortInfo.d_ptr->device;
                serialPortInfo.d_ptr->description =
                    QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
                serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                serialPortInfoList.append(serialPortInfo);
            }
        }
    }

    // FIXME: Get info about ACM ports.
    r = server.LoadCommModule(KACMModuleName);
    if (r == KErrNone) {
        r = server.GetPortInfo(KACMModuleName, nativeSerialInfo);
        if (r == KErrNone) {
            for (quint32 i = nativeSerialInfo.iLowUnit; i < nativeSerialInfo.iHighUnit + 1; ++i) {

                QSerialPortInfo serialPortInfo;

                serialPortInfo.d_ptr->device = s
                                               .arg(QString::fromUtf16(nativeSerialInfo.iName.Ptr(), nativeSerialInfo.iName.Length()))
                                               .arg(i);
                serialPortInfo.d_ptr->portName = QSerialPortPrivate::portNameFromSystemLocation(serialPortInfo.d_ptr->device);
                serialPortInfo.d_ptr->description =
                    QString::fromUtf16(nativeSerialInfo.iDescription.Ptr(), nativeSerialInfo.iDescription.Length());
                serialPortInfo.d_ptr->manufacturer = QString(QObject::tr("Unknown."));
                serialPortInfoList.append(serialPortInfo);
            }
        }
    }

    return serialPortInfoList;
}
TInt CTestDriveRemoteHangupDial::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side "Data Call answer and remote 
 * hang-up closely followed by a dial" test code.  This method sets up to answer a 
 * call and receive a data transfer.  The call is then terminated from the remote end, 
 * and then must quickly respond by dialing the remote end back.  Data is then 
 * transfered and the call is terminated again from the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

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

	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);
//
// Initialization complete
//

// 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"));
	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,KWriteTestRemoteHangupData);
	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,KWriteTestRemoteHangupData);
	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 perform the user specified delay before making outgoing call...
	INFO_PRINTF2(_L("Start the %d sec delay before making outgoing call\n"), iVarDelay);
	User::After( (TTimeIntervalMicroSeconds32)(iVarDelay*1000000L) );
	INFO_PRINTF2(_L("End of the delay before making outgoing call\n"), iVarDelay);

	// Now perform the outgoing call...
	// dial
	_LIT(KDialString,"+1234");
	TESTL(call.Dial(KDialString)==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);

	// Transfer data
	port.Write(stat,KWriteTestRemoteHangupData2);
	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,KWriteTestRemoteHangupData2);
	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=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
Ejemplo n.º 12
0
TInt CTestDriveSSData::DriveETelApiL()
//
// This function contains the real meat of the Client-side test code
//
	{
	_LIT(KDataLineName,"Data");
	_LIT(KMmPhoneName,"GsmPhone1");

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

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

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

	TRequestStatus stat,stat1,reqStatus;

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

	_LIT(KDialString,"+1234");
	TInt status = call.Dial(KDialString);
	TESTL(status == KErrNone);

	TInt32 signalStrength;
	TInt8 bar = 0;
	mmPhone.GetSignalStrength(stat1,signalStrength,bar);

	RCall::TCommPort commPort;
	TESTL(call.LoanDataPort(commPort)==KErrNone);

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

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

	port.Write(stat,KDataSsWriteTestData);
	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,KDataSsWriteTestData);
	User::WaitForRequest(stat);
	TESTL(stat.Int()==KErrNone);

	port.Close();
	cs.Close();

	call.RecoverDataPort();

	User::After(500000L);

	User::WaitForRequest(stat1); // Result of GetSignalStrength()
	TESTL(stat1==KErrAccessDenied);

	TESTL(call.HangUp()==KErrNone);

	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
TInt CTestDriveDataCallRemoteTerm::DriveETelApiL()
/**
 * This method contains the real meat of the Client-side the "Data Call set-up, data 
 * transfer and remote termination" test code.  This method sets up to make a data-call
 * and then transfer data.  After the data transfer, the call is terminated by the remote end.
 *
 * @return KErrNone.
 */
	{
	_LIT(KMmPhoneName,"GsmPhone1");
	_LIT(KDataLineName,"Data");

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

	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,KWriteTestRemoteData);
	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,KWriteTestRemoteData);
	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=0;
	mmPhone.GetSignalStrength(stat,ss,bar);
	User::WaitForRequest(stat);
	TESTL(stat==KErrNone);

	// close iPhone, line and call
	mmPhone.Close();
	line.Close();
	call.Close();
	return KErrNone;
	}
Ejemplo n.º 14
0
// Do the example 
LOCAL_C void doExampleL()
    {
	_LIT(KStatus0,"Connect to file server\n");
	_LIT(KStatus1,"Connect to comm server\n");
	_LIT(KStatus2,"Load IrCOMM.CSY\n");
	_LIT(KStatus3,"Open IrCOMM::0\n");
	_LIT(KStatus4,"Write to IrCOMM::0\n");
	_LIT(KStatus5,"Close IrCOMM::0\n");
	_LIT(KStatus6,"Close server connection\n");
	_LIT(KIrCOMM,"IrCOMM");
	_LIT(KIrCOMM0,"IrCOMM::0");

	const TTimeIntervalMicroSeconds32 KTimeOut(4000000);
	//time-out value

	console->Printf(KStatus0);
				// force a link to the file server
				// so that we're sure the loader 
				// will be present

	RFs f;
	User::LeaveIfError(f.Connect());
	f.Close();
				// Initialisation

	Init();
				
	RCommServ server;

				// Connect to the comm server
	console->Printf(KStatus1);
	server.Connect();

				// Load the IrCOMM comm module
				// C32 will automatically search \System\Libs
				// on all drives for IrCOMM.CSY
	console->Printf(KStatus2);
	TInt ret=server.LoadCommModule(KIrCOMM);
	
	//test(ret==KErrNone);
	User::LeaveIfError(ret);
		
	RComm commPort;
				// Open the IrCOMM port unit 0 (the only one supported)
				// Open port in exclusive mode because we don't 
				// have any access control code.
	console->Printf(KStatus3);
	ret=commPort.Open(server,KIrCOMM0,ECommExclusive);
	//test(ret==KErrNone);
	User::LeaveIfError(ret);

	TRequestStatus status;
				// Write to the IrCOMM port - the first write 
				// takes a long time as the IrDA connection is 
				// set up in response to this request. Subsequent 
				// writes to IrCOMM are very fast.
	console->Printf(KStatus4);
	commPort.Write(status,KTimeOut,DATA_STRING);
	User::WaitForRequest(status);

	//test(status.Int()==KErrNone);
	User::LeaveIfError(status.Int());
				// Close port
	console->Printf(KStatus5);
	commPort.Close();

	console->Printf(KStatus6);
	server.Close();
	}