genericopenlibs/cstdlib/USTLIB/UREDIR.CPP
changeset 31 ce057bb09d0b
parent 0 e4d67989cc36
equal deleted inserted replaced
30:e20de85af2ee 31:ce057bb09d0b
       
     1 // Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     2 // All rights reserved.
       
     3 // This component and the accompanying materials are made available
       
     4 // under the terms of "Eclipse Public License v1.0"
       
     5 // which accompanies this distribution, and is available
       
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     7 //
       
     8 // Initial Contributors:
       
     9 // Nokia Corporation - initial contribution.
       
    10 //
       
    11 // Contributors:
       
    12 //
       
    13 // Description:
       
    14 // RedirCli.CPP
       
    15 // 
       
    16 //
       
    17 
       
    18 #include <redircli.h>
       
    19 #include "FDESC.H"
       
    20 #include <stdio.h>
       
    21 
       
    22 CRedirDesc::CRedirDesc() : iAttemptedConnection(EFalse)
       
    23 	{}
       
    24 
       
    25 TInt CRedirDesc::Connect()
       
    26 	{
       
    27 	iAttemptedConnection = ETrue;
       
    28 	return iRedirSession.Connect();
       
    29 	}
       
    30 
       
    31 void CRedirDesc::Read(TDes8& aDesc, TRequestStatus& aStatus)
       
    32 	{
       
    33 	//see if we are connected at this point?
       
    34 	if (!iAttemptedConnection && !iRedirSession.Handle())
       
    35 		Connect();
       
    36 	iRedirSession.Read(aStatus, aDesc);
       
    37 	}
       
    38 
       
    39 void CRedirDesc::Write(TDes8& aDesc, TRequestStatus& aStatus)
       
    40 	{
       
    41 	//see if we are connected at this point?
       
    42 	if (!iAttemptedConnection && !iRedirSession.Handle())
       
    43 		Connect();
       
    44 
       
    45 	iRedirSession.Write(aStatus, aDesc);
       
    46 	}
       
    47 
       
    48 void CRedirDesc::Sync(TRequestStatus& aStatus)
       
    49 	{
       
    50 	iRedirSession.Flush(aStatus);
       
    51 	}
       
    52 
       
    53 TInt CRedirDesc::FinalClose()
       
    54 	{
       
    55 	iRedirSession.Close();
       
    56 	return KErrNone;
       
    57 	}
       
    58 
       
    59 
       
    60