Koala Library
koala_serial.h File Reference

RS-232 Communication Layer. More...

Include dependency graph for koala_serial.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  koala_rs232_s

Typedefs

typedef struct koala_rs232_s koala_rs232_t

Functions

koala_rs232_tkoala_rs232_open (const char *name, int baudrate)
void koala_rs232_close (koala_rs232_t *rs232)
int koala_rs232_read (koala_rs232_t *rs232, char *buf, unsigned int len)
int koala_rs232_readLine_nowait (koala_rs232_t *rs232, char *buffer)
int koala_rs232_readLine (koala_rs232_t *rs232, char *buffer)
int koala_rs232_write (koala_rs232_t *rs232, const char *buf, unsigned int len)

Detailed Description

RS-232 Communication Layer.

Definition in file koala_serial.h.


Typedef Documentation

typedef struct koala_rs232_s koala_rs232_t

Function Documentation

void koala_rs232_close ( koala_rs232_t rs232)

This function closes an RS-232 device.

Parameters:
rs232RS-232 device descriptor

Definition at line 106 of file koala_serial.c.

References koala_rs232_s::fd.

Referenced by koala_robot_release().

koala_rs232_t* koala_rs232_open ( const char *  name,
int  baudrate 
)

This function opens a given device on the RS-232 Bus

Parameters:
nameRS-232 device name
baudratebaudrate (B115200,...)
Returns:
A Pointer to a RS-232 device descriptor or NULL in case of error.
Remarks:
This function is NOT exported outside this module.

Definition at line 63 of file koala_serial.c.

References koala_rs232_s::fd, and koala_rs232_s::tios.

Referenced by koala_robot_init().

int koala_rs232_read ( koala_rs232_t rs232,
char *  buf,
unsigned int  len 
)

This function reads data from an RS-232 device.

Parameters:
rs232RS-232 device descriptor
bufPointer to the buffer that will receive the data
lenSize of the buffer
Returns:
A value:
  • <0 on error
  • >=0 on success, number of bytes read
Remarks:
This function is NOT exported outside this module.

Definition at line 132 of file koala_serial.c.

References koala_rs232_s::fd.

Referenced by koala_getcommand().

int koala_rs232_readLine ( koala_rs232_t rs232,
char *  buffer 
)

Definition at line 210 of file koala_serial.c.

Referenced by koala_getcommand_line().

int koala_rs232_readLine_nowait ( koala_rs232_t rs232,
char *  buffer 
)

Definition at line 152 of file koala_serial.c.

Referenced by koala_getcommand_line_nowait().

int koala_rs232_write ( koala_rs232_t rs232,
const char *  buf,
unsigned int  len 
)

This function writes data to an RS-232 device.

Parameters:
rs232RS-232 device descriptor
bufPointer to the buffer that contains the data to be written
lenNumber of the bytes in the buffer
Returns:
A value:
  • <0 on error
  • >=0 on success, number of byte written
Remarks:
This function is NOT exported outside this module.

Definition at line 271 of file koala_serial.c.

References koala_rs232_s::fd.

Referenced by koala_sendcommand().