Digi.Common.DriverIO Class Reference

This class wraps the standard C/C++ CreatFile type functions into a C# class. More...

List of all members.

Classes

class  ImportedFunctions

Public Member Functions

bool CreateFile (string lpFileName, GenericAccessRights dwDesiredAccess, ShareMode dwShareMode, CreationDisposition dwCreationDisposition, FileAttrib dwFlagsAndAttributes)
 This method opens a file or device.
int WriteFile (byte[] buffer)
 Writes all of the buffer to the opened file or device.
int WriteFile (byte[] buffer, int BytesToWrite)
 Writes data to the opened device.
int ReadFile (byte[] buffer)
 Reads data from the file or device into a buffer.
int ReadFile (byte[] buffer, int BytesToRead)
 Reads data from the file or device into buffer.
int DeviceIOControl (uint IOControlCode, ref byte[] WriteBuffer, ref byte[] ReadBuffer)
 Sends a IO Control to the device.
int DeviceIOControl (uint IOControlCode, ref byte[] WriteBuffer, int WriteBufferLength, ref byte[] ReadBuffer, int ReadBufferLength)
 Sends a IO Control to the device.
bool Close ()
 Closes the device or file.

Public Attributes

IntPtr FileHandle = (IntPtr)InvalidHandleValue
 Handle to the Device or driver.


Detailed Description

This class wraps the standard C/C++ CreatFile type functions into a C# class.


Member Function Documentation

public bool Digi::Common.DriverIO::Close (  ) 

Closes the device or file.

Returns:
Returns true if the file is closed, false if error.

public bool Digi::Common.DriverIO::CreateFile ( string  lpFileName,
GenericAccessRights  dwDesiredAccess,
ShareMode  dwShareMode,
CreationDisposition  dwCreationDisposition,
FileAttrib  dwFlagsAndAttributes 
)

This method opens a file or device.

Parameters:
lpFileName Pointer to a null-terminated string that specifies the name of the object, such as file, COM port, disk device, or console, to create or open.
dwDesiredAccess Type of access to the object. An application can obtain read-only access, write-only access, read/write access, or device-query access.
dwShareMode Share mode for the object. If this parameter is set to zero, the object cannot be shared. Subsequent open operations on the object fail until the handle is closed.
dwCreationDisposition Action to take on files that exist, and which action to take when files do not exist. The following table shows possible values.
dwFlagsAndAttributes File attributes and flags for the file.
Returns:
An open handle to the specified file indicates success.INVALID_HANDLE_VALUE indicates failure.

public int Digi::Common.DriverIO::DeviceIOControl ( uint  IOControlCode,
ref byte[]  WriteBuffer,
int  WriteBufferLength,
ref byte[]  ReadBuffer,
int  ReadBufferLength 
)

Sends a IO Control to the device.

Parameters:
IOControlCode The IOCTL code to send
WriteBuffer A buffer with data to send to the file or device.
WriteBufferLength Size of the buffer to send
ReadBuffer A buffer to read data from the file or device.
ReadBufferLength Size of the boffer to read
Returns:
Returns -1 if error, else it returns the number of bytes read.

public int Digi::Common.DriverIO::DeviceIOControl ( uint  IOControlCode,
ref byte[]  WriteBuffer,
ref byte[]  ReadBuffer 
)

Sends a IO Control to the device.

Parameters:
IOControlCode The IOCTL code to send
WriteBuffer A buffer with data to send to the file or device.
ReadBuffer A buffer to read data from the file or device.
Returns:
Returns -1 if error, else it returns the number of bytes read.

public int Digi::Common.DriverIO::ReadFile ( byte[]  buffer,
int  BytesToRead 
)

Reads data from the file or device into buffer.

Parameters:
buffer The buffer to write data to.
BytesToRead Number of bytes to read
Returns:
Returns -1 on error, else the number of bytes read.

public int Digi::Common.DriverIO::ReadFile ( byte[]  buffer  ) 

Reads data from the file or device into a buffer.

Parameters:
buffer The buffer to write data to.
Returns:
Returns -1 on error, else the number of bytes read.

public int Digi::Common.DriverIO::WriteFile ( byte[]  buffer,
int  BytesToWrite 
)

Writes data to the opened device.

Parameters:
buffer A byte buffer containing data to write
BytesToWrite The number of bytes to write.
Returns:
Returns -1 if there was an error. Else it returns the number of bytes written.

public int Digi::Common.DriverIO::WriteFile ( byte[]  buffer  ) 

Writes all of the buffer to the opened file or device.

Parameters:
buffer A byte buffer containing data to write.
Returns:
Returns -1 if there was an error. Else it returns the number of bytes written.


Member Data Documentation

IntPtr Digi.Common.DriverIO.FileHandle = (IntPtr)InvalidHandleValue

Handle to the Device or driver.


The documentation for this class was generated from the following file:

Generated on Fri Oct 16 19:28:05 2009 by  doxygen 1.5.9