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; }
// --------------------------------------------------------------------------- // Issues request to start monitoring the endpoint for line status change // --------------------------------------------------------------------------- // TInt CDunSignalCopy::IssueRequest() { FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest()" ))); if ( iSignalCopyState != EDunStateIdle ) { FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() (not ready) complete" ) )); return KErrNotReady; } RComm* comm = NULL; if ( iStreamType == EDunStreamTypeUpstream ) { iListenSignals = KSignalDCEInputs; comm = iComm; } else if ( iStreamType == EDunStreamTypeDownstream ) { iListenSignals = KSignalDTEInputs; comm = iNetwork; } else { FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() (ERROR) complete" ) )); return KErrGeneral; } TUint currentSignals = comm->Signals( iListenSignals ); TUint oldSignalsLow = iSignals & KDunSixLowestBitsMask; TUint newSignalsLow = currentSignals & KDunSixLowestBitsMask; TUint oldSignalsHigh = oldSignalsLow * KSignalChanged; TUint newSignalsHigh = newSignalsLow * KSignalChanged; FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() oldSignalsLow=0x%08X" ), oldSignalsLow )); FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() newSignalsLow=0x%08X" ), newSignalsLow )); FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() oldSignalsHigh=0x%08X" ), oldSignalsHigh )); FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() newSignalsHigh=0x%08X" ), newSignalsHigh )); if ( newSignalsLow != oldSignalsLow ) { FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() signals already set..." ) )); iSignals = newSignalsLow | (oldSignalsHigh ^ newSignalsHigh); ManageSignalChange(); } else { FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() start waiting for change..." ) )); iStatus = KRequestPending; iSignalCopyState = EDunStateSignalCopy; comm->NotifySignalChange( iStatus, iSignals, iListenSignals ); SetActive(); } FTRACE(FPrint( _L("CDunSignalCopy::IssueRequest() complete" ))); return KErrNone; }
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; }
// --------------------------------------------------------------------------- // Sets media to use for this endpoint monitor // --------------------------------------------------------------------------- // TInt CDunSignalCopy::SetMedia( RComm* aComm, RComm* aNetwork, TDunStreamType aStreamType ) { FTRACE(FPrint( _L("CDunSignalCopy::SetMedia()" ))); if ( !aNetwork ) { FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (aComm) not initialized!" ))); return KErrGeneral; } RComm* comm = NULL; if ( aStreamType == EDunStreamTypeUpstream ) { iContextInUse = EDunMediaContextLocal; comm = aComm; } else if ( aStreamType == EDunStreamTypeDownstream ) { iContextInUse = EDunMediaContextNetwork; comm = aNetwork; } else { FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (aStreamtype) not initialized!" ))); return KErrGeneral; } // No possibility to do iUtility->GetLocalId() here as aComm is not yet // in channel data; use aComm directly TCommCaps2 caps; comm->Caps( caps ); if ( !(caps().iNotificationCaps & KNotifySignalsChangeSupported) ) { FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (RComm) (not supported) complete" ))); return KErrNotSupported; } iComm = aComm; iNetwork = aNetwork; iStreamType = aStreamType; FTRACE(FPrint( _L("CDunSignalCopy::SetMedia() (RComm) complete" ))); return KErrNone; }
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; }
// --------------------------------------------------------------------------- // From class MDunTransporterUtility. // Allocates a channel by creating and setting local media independent // objects // This is a common method used by exported local media dependent methods // --------------------------------------------------------------------------- // void CDunTransUtils::DoAllocateChannelL( RComm* aComm, TInt& aBufferLength, TInt aFirstFree, MDunBufferCorrection* aCorrection ) { FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL()" ))); TInt retTemp; TInt itemsInCs = 0; if ( !iParent.iNetwork ) { FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() (iNetwork) not initialized!" ))); User::Leave( KErrGeneral ); } FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() aFirstFree = %d" ), aFirstFree)); // Allocate network channel RComm* networkEntity; retTemp = iParent.iNetwork->AllocateChannel( networkEntity ); if ( retTemp != KErrNone ) { FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() network allocation failed" ))); if ( retTemp == KErrTooBig ) { // Start to show note if ( iParent.iNoteHandler ) { iParent.iNoteHandler->IssueRequest(); } // Set flag to indicate that advertisement is not possible anymore ManageAdvertisementStatusChange( EFalse ); FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() (too big) complete" ))); User::Leave( KErrTooBig ); } FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() (ERROR) complete" ))); User::Leave( KErrGeneral ); } TInt currentLength = networkEntity->ReceiveBufferLength(); TInt newLength = currentLength; FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() buffer length before = %d" ), currentLength)); if ( aCorrection ) { // Get network side buffer length and request change if required. // Check "newlength>currentLength" here as it is not possible to // increase Dataport's buffer length newLength = aCorrection->NotifyBufferCorrection( currentLength ); if ( newLength<=0 || newLength>currentLength ) { FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() unknown buffer length" ))); User::Leave( KErrGeneral ); } // It is not possible to set Dataport side receive buffer length to any // arbitrary value (currently only 8kB..20kB are supported but that // can't be queried via an API). So here only default buffer size will // be used from Dataport while this component's local buffering uses // Dataport's default buffer size if not adjusted via plugin side. // NOTE: If Dataport side starts to support arbitrary receive buffer // size, it should be changed here if newLength != currentLength. } aBufferLength = newLength; FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() buffer length after = %d" ), newLength)); // Get channel data TDunChannelData& channelData = iChannelData[aFirstFree]; // Create buffers and set length TUint8* bufferUpstream; TPtr8* bufferUpPtr; DoCreateBufferLC( channelData.iBufferUpstream, channelData.iBufferUpPtr, bufferUpstream, bufferUpPtr, newLength, itemsInCs ); TUint8* bufferDownstream; TPtr8* bufferDownPtr; DoCreateBufferLC( channelData.iBufferDownstream, channelData.iBufferDownPtr, bufferDownstream, bufferDownPtr, newLength, itemsInCs ); // Create signal copy objects CDunSignalCopy* upstreamCopy = channelData.iUpstreamSignalCopy; CDunSignalCopy* downstreamCopy = channelData.iDownstreamSignalCopy; if ( aComm ) { DoCreateSignalCopyLC( channelData.iUpstreamSignalCopy, upstreamCopy, itemsInCs ); DoCreateSignalCopyLC( channelData.iDownstreamSignalCopy, downstreamCopy, itemsInCs ); retTemp = upstreamCopy->SetMedia( aComm, networkEntity, EDunStreamTypeUpstream ); if ( retTemp != KErrNone ) { delete upstreamCopy; upstreamCopy = NULL; } retTemp = downstreamCopy->SetMedia( aComm, networkEntity, EDunStreamTypeDownstream ); if ( retTemp != KErrNone ) { delete downstreamCopy; downstreamCopy = NULL; } } // Create signal notify objects CDunSignalNotify* signalNotify = channelData.iSignalNotify; if ( !aComm ) // RSocket { DoCreateSignalNotifyLC( channelData.iSignalNotify, signalNotify, itemsInCs ); retTemp = signalNotify->SetMedia( networkEntity ); if ( retTemp != KErrNone ) { delete signalNotify; signalNotify = NULL; } } // Create upstream objects CDunUpstream* upstreamRW; DoCreateUpTransferObjectL( channelData.iUpstreamRW, upstreamRW, itemsInCs ); upstreamRW->SetBuffering( bufferUpPtr ); upstreamRW->SetMedia( networkEntity, EDunMediaContextNetwork ); upstreamRW->SetActivityCallback( this ); // Create downstream objects CDunDownstream* downstreamRW; DoCreateDownTransferObjectL( channelData.iDownstreamRW, downstreamRW, itemsInCs ); downstreamRW->SetBuffering( bufferDownPtr ); downstreamRW->SetMedia( networkEntity, EDunMediaContextNetwork ); // Save values channelData.iNetwork = networkEntity; channelData.iUpstreamRW = upstreamRW; channelData.iDownstreamRW = downstreamRW; channelData.iBufferUpstream = bufferUpstream; channelData.iBufferDownstream = bufferDownstream; channelData.iBufferUpPtr = bufferUpPtr; channelData.iBufferDownPtr = bufferDownPtr; channelData.iUpstreamSignalCopy = upstreamCopy; channelData.iDownstreamSignalCopy = downstreamCopy; channelData.iSignalNotify = signalNotify; CleanupStack::Pop( itemsInCs ); // Set flag to indicate that advertisement is now possible ManageAdvertisementStatusChange( ETrue, ETrue ); FTRACE(FPrint( _L("CDunTransUtils::DoAllocateChannelL() complete" ))); }
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; }
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; }
// 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(); }