First public contribution.
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 the License "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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32test\misc\ymodemu.cpp
19 #include <e32std_private.h>
23 //#include <e32test.h>
26 YModemU::YModemU(TBool aG)
37 TInt YModemU::Create(TInt aPort)
39 TInt r=iComm.Open(aPort);
43 TCommConfigV01& c=cfg();
48 c.iParity=EParityNone;
49 // c.iHandshake=KConfigFreeRTS|KConfigFreeDTR;
53 r=iComm.SetConfig(cfg);
56 r=iComm.SetReceiveBufferLength(8192);
59 return iTimer.CreateLocal();
62 YModemU* YModemU::NewL(TInt aPort, TBool aG)
64 YModemU* p=new YModemU(aG);
65 TInt r=p->Create(aPort);
74 void YModemU::WriteC(TUint aChar)
81 User::WaitForRequest(s);
84 TInt YModemU::ReadBlock(TDes8& aDest)
87 TRequestStatus s1, s2;
88 iTimer.After(s1,iTimeout);
89 // test.Printf(_L("@%dms %d\n"),User::NTickCount(),iComm.QueryReceiveBuffer());
91 User::WaitForRequest(s1,s2);
92 if (s2!=KRequestPending)
95 User::WaitForRequest(s1);
99 User::WaitForRequest(s2);