[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Dotgnu-pnet-commits] pnetlib/System/Platform PortMethods.cs, NONE, 1.1
From: |
Rhys Weatherley <address@hidden> |
Subject: |
[Dotgnu-pnet-commits] pnetlib/System/Platform PortMethods.cs, NONE, 1.1 |
Date: |
Tue, 04 Nov 2003 07:00:30 +0000 |
Update of /cvsroot/dotgnu-pnet/pnetlib/System/Platform
In directory subversions:/tmp/cvs-serv7725/System/Platform
Added Files:
PortMethods.cs
Log Message:
Check in an initial implementation of the .NET Framework 1.2
serial port classes.
--- NEW FILE: PortMethods.cs ---
/*
* PortMethods.cs - Implementation of the "Platform.PortMethods" class.
*
* Copyright (C) 2003 Southern Storm Software, Pty Ltd
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
namespace Platform
{
using System;
using System.Runtime.CompilerServices;
internal class PortMethods
{
// Serial port parameters.
public class Parameters
{
public int baudRate;
public int parity;
public int dataBits;
public int stopBits;
public int handshake;
public byte parityReplace;
public bool discardNull;
public int readBufferSize;
public int writeBufferSize;
public int receivedBytesThreshold;
public int readTimeout;
public int writeTimeout;
}; // class Parameters
// Serial port types.
public const int SERIAL_REGULAR = 0;
public const int SERIAL_INFRARED = 1;
// Bits for various serial pins.
public const int PIN_BREAK = (1<<0);
public const int PIN_CD = (1<<1);
public const int PIN_CTS = (1<<2);
public const int PIN_DSR = (1<<3);
public const int PIN_DTR = (1<<4);
public const int PIN_RTS = (1<<5);
// Determine if a serial port type and name is valid.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static bool IsValid(int type, int portNumber);
// Determine if a serial port type and name is accessible.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static bool IsAccessible(int type, int portNumber);
// Open a serial port with certain initial parameters.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static IntPtr Open
(int type, int portNumber, Parameters parameters);
// Close a serial port.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void Close(IntPtr handle);
// Modify the serial port parameters.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void Modify(IntPtr handle, Parameters parameters);
// Get the number of bytes that are ready to read from the port.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static int GetBytesToRead(IntPtr handle);
// Get the number of bytes of space that are available to write to the
port.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static int GetBytesToWrite(IntPtr handle);
// Read the values of the serial port pins.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static int ReadPins(IntPtr handle);
// Write the values of particular serial port pins.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void WritePins(IntPtr handle, int mask, int value);
// Get the recommended default buffer sizes.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void GetRecommendedBufferSizes
(out int readBufferSize, out int
writeBufferSize,
out int receivedBytesThreshold);
// Discard the contents of the input buffer.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void DiscardInBuffer(IntPtr handle);
// Discard the contents of the output buffer.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void DiscardOutBuffer(IntPtr handle);
// Drain the contents of the output buffer.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void DrainOutBuffer(IntPtr handle);
// Read data from a serial port.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static int Read
(IntPtr handle, byte[] buffer, int offset, int count);
// Write data to a serial port.
[MethodImpl(MethodImplOptions.InternalCall)]
extern public static void Write
(IntPtr handle, byte[] buffer, int offset, int count);
}; // class PortMethods
}; // namespace Platform
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Dotgnu-pnet-commits] pnetlib/System/Platform PortMethods.cs, NONE, 1.1,
Rhys Weatherley <address@hidden> <=
- Prev by Date:
[Dotgnu-pnet-commits] pnetlib/System/IO/Ports Handshake.cs, NONE, 1.1 Parity.cs, NONE, 1.1 SerialErrorEventArgs.cs, NONE, 1.1 SerialErrorEventHandler.cs, NONE, 1.1 SerialErrors.cs, NONE, 1.1 SerialPinChangedEventArgs.cs, NONE, 1.1 SerialPinChangedEventHandler.cs, NONE, 1.1 SerialPinChanges.cs, NONE, 1.1 SerialPort.cs, NONE, 1.1 SerialReceived.cs, NONE, 1.1 SerialReceivedEventArgs.cs, NONE, 1.1 SerialReceivedEventHandler.cs, NONE, 1.1 StopBits.cs, NONE, 1.1
- Next by Date:
[Dotgnu-pnet-commits] pnetlib/profiles compact, 1.12, 1.13 compact-fp, 1.10, 1.11 ecma, 1.12, 1.13 full, 1.13, 1.14 kernel, 1.12, 1.13 kernel-fp, 1.10, 1.11 mscompact, 1.5, 1.6 tiny, 1.11, 1.12 tiny-fp, 1.10, 1.11
- Previous by thread:
[Dotgnu-pnet-commits] pnetlib/System/IO/Ports Handshake.cs, NONE, 1.1 Parity.cs, NONE, 1.1 SerialErrorEventArgs.cs, NONE, 1.1 SerialErrorEventHandler.cs, NONE, 1.1 SerialErrors.cs, NONE, 1.1 SerialPinChangedEventArgs.cs, NONE, 1.1 SerialPinChangedEventHandler.cs, NONE, 1.1 SerialPinChanges.cs, NONE, 1.1 SerialPort.cs, NONE, 1.1 SerialReceived.cs, NONE, 1.1 SerialReceivedEventArgs.cs, NONE, 1.1 SerialReceivedEventHandler.cs, NONE, 1.1 StopBits.cs, NONE, 1.1
- Next by thread:
[Dotgnu-pnet-commits] pnetlib/profiles compact, 1.12, 1.13 compact-fp, 1.10, 1.11 ecma, 1.12, 1.13 full, 1.13, 1.14 kernel, 1.12, 1.13 kernel-fp, 1.10, 1.11 mscompact, 1.5, 1.6 tiny, 1.11, 1.12 tiny-fp, 1.10, 1.11
- Index(es):