Re: IPaq 2215 / 4155 by John
John
Sat Jun 19 14:37:45 CDT 2004
Oh well I found the problem. My Xmodem function checks the TX buffer value
returned, which never reachs zero so... As I said in the previous message
this is not a problem on the 2215... If I replace the function that waits
for the TX buffer to empty with a short timer my program again works fine.
The program also works fine with a change to the DllImport on a desktop.
Does anybody have any clue on this?
Code used (some snagged from web):
while(e.TXBytes > 0) // Yea bad programing :)
{
if(AbortTransfer())
return;
Sleep(1);
}
if (Win32Com.ClearCommError(hPort, out er, out cs))
{
e.RXbytes = cs.cbInQue;
e.TXbytes = cs.cbOutQue;
}
[DllImport("coredll.dll")]
internal static extern bool ClearCommError(IntPtr hFile, out UInt32
lpErrors, out COMSTAT cs);
[StructLayout( LayoutKind.Sequential )] internal struct COMSTAT
{
internal const uint fCtsHold = 0x1;
internal const uint fDsrHold = 0x2;
internal const uint fRlsdHold = 0x4;
internal const uint fXoffHold = 0x8;
internal const uint fXoffSent = 0x10;
internal const uint fEof = 0x20;
internal const uint fTxim = 0x40;
internal UInt32 Flags;
internal UInt32 cbInQue;
internal UInt32 cbOutQue;
}
Regards,
John