Main Page   Modules   Data Structures   File List   Data Fields   Globals   Related Pages   Examples  

XgIfStream


Functions

int NutIfStreamRead (NUTDEVICE *dev, char *data, int size)
 Read from a stream device.

int NutIfStreamReadTran (NUTDEVICE *dev, char *data, int size)
 Read from a stream device translating non printables.

int NutIfStreamGetLine (NUTDEVICE *dev, char *data, int size)
 Get a line from a stream device.

int NutIfStreamWrite (NUTDEVICE *dev, CONST char *data, int len)
 Write to a stream device.

int NutIfStreamWriteTran (NUTDEVICE *dev, CONST char *data)
 Translate and write a string to a stream device.

int NutIfStreamWrite_P (NUTDEVICE *dev, PGM_P data, int len)
 Write program space data to a stream device.

int NutIfStreamFlush (NUTDEVICE *dev)
 Flush stream device buffer.


Function Documentation

int NutIfStreamFlush NUTDEVICE   dev
 

Flush stream device buffer.

Flushes the output buffer for the specified device by writing its current contents to the corresponding device.

Parameters:
dev  Identifies the device to flush. This pointer must have been retrieved by directly or indirectly calling NutDeviceOpen().
Returns:
0 on success, -1 on failures.

int NutIfStreamGetLine NUTDEVICE   dev,
char *    data,
int    size
 

Get a line from a stream device.

Reads a string from the specified device. Characters are read up to and including the first end of line character or until the number of characters read is equal to the specified maximum or until a timeout occurs, whichever comes first.

Parameters:
dev  Identifies the device to read from. This pointer must have been retrieved by calling NutDeviceOpen().
data  Points to the buffer that receives the zero terminated string. End of line characters are not stored.
size  Specifies the size of the buffer. The maximum number of characters read is one less because of the terminating null character.
Returns:
The number of bytes read or -1 in case of an error. Receiving no character is being considered an error.

int NutIfStreamRead NUTDEVICE   dev,
char *    data,
int    size
 

Read from a stream device.

Parameters:
dev  Identifies the device to read from. This pointer must have been retrieved by calling NutDeviceOpen().
data  Pointer to the buffer that receives the data. Set to null to flush the input buffer.
size  Size of the buffer. Ignored if the data pointer is null.
Returns:
The number of bytes read, 0 on timeouts and broken connections or -1 in case of an error.

int NutIfStreamReadTran NUTDEVICE   dev,
char *    data,
int    size
 

Read from a stream device translating non printables.

This call works like NutIfStreamRead(), but translates character codes below 33, above 126 or equal 34 into their hex representation prepended by a backslash and the letter x. Backslashes are duplicated and the complete string is terminated by character code zero. This offers the ability to store binary data in printable strings.

Parameters:
dev  Identifies the device to read from. This pointer must have been retrieved by calling NutDeviceOpen().
data  Pointer to the buffer that receives the translated string.
size  Size of the buffer.
Returns:
The number of bytes read or -1 in case of an error. Due to code translation, this may be less than the number of characters returned in the string.

int NutIfStreamWrite NUTDEVICE   dev,
CONST char *    data,
int    len
 

Write to a stream device.

The data isn't immediately transfered to the physical device, but buffered in a transmit buffer. Transmission starts either when the buffer is full or when this function is called with a zero data pointer.

Parameters:
dev  Identifies the device to write to. This pointer must have been retrieved by calling NutDeviceOpen().
data  Pointer to data to be written. If this pointer is NULL, the stream device starts transmitting the buffered data.
len  Number of bytes to write.
Returns:
The number of bytes written or -1 in case of an error.

int NutIfStreamWrite_P NUTDEVICE   dev,
PGM_P    data,
int    len
 

Write program space data to a stream device.

Parameters:
dev  Identifies the device to write to. This pointer must have been retrieved by calling NutDeviceOpen().
data  Pointer to data in program space to be written.
len  Number of bytes to write.
Returns:
The number of bytes written or -1 in case of an error.

int NutIfStreamWriteTran NUTDEVICE   dev,
CONST char *    data
 

Translate and write a string to a stream device.

This call works like NutIfStreamWrite(), but translates any backslash followed by the letter x followed by two hexadecimal uppercase digits into the binary representation. Simple backslashes are expected to be duplicated and the complete string must be terminated by character code zero. This offers the ability to write binary data from a printable strings.

The data isn't immediately transfered to the physical device, but buffered in a transmit buffer. Transmission starts either when the buffer is full or when this function is called with a zero data pointer.

Parameters:
dev  Identifies the device to write to. This pointer must have been retrieved by calling NutDeviceOpen().
data  Pointer to a zero terminated string to be translated and written. If this pointer is NULL, the stream device starts transmitting the buffered data.
Returns:
The number of characters written or -1 in case of an error. Due to code translation, this may be less than the number of characters contained in the string.


Generated on Thu Jan 30 22:30:59 2003 for EduNet by doxygen1.2.18