Digi XBee(R) ANSI C Host Library
Macros | Functions

Serial Interface for XBee Module (POSIX Platform) More...

#include <limits.h>
#include <errno.h>
#include <fcntl.h>
#include <stdio.h>
#include <termios.h>
#include <unistd.h>
#include <sys/ioctl.h>
#include "xbee/serial.h"

Macros

#define XBEE_SER_CHECK(ptr)   do { if (xbee_ser_invalid(ptr)) return -EINVAL; } while (0)
 
#define _BAUDCASE(b)   case b: baud = B ## b; break
 
#define XBEE_FLOW_FLAGS   (CRTSCTS)
 

Functions

int xbee_ser_invalid (xbee_serial_t *serial)
 Helper function used by other xbee_serial functions to validate the serial parameter. More...
 
const char * xbee_ser_portname (xbee_serial_t *serial)
 Returns a human-readable string describing the serial port. More...
 
int xbee_ser_write (xbee_serial_t *serial, const void FAR *buffer, int length)
 Transmits length bytes from buffer to the XBee serial port serial. More...
 
int xbee_ser_read (xbee_serial_t *serial, void FAR *buffer, int bufsize)
 Reads up to bufsize bytes from XBee serial port serial and into buffer. More...
 
int xbee_ser_putchar (xbee_serial_t *serial, uint8_t ch)
 Transmits a single character, ch, to the XBee serial port serial. More...
 
int xbee_ser_getchar (xbee_serial_t *serial)
 Reads a single character from the XBee serial port serial. More...
 
int xbee_ser_tx_free (xbee_serial_t *serial)
 Returns the number of bytes of unused space in the serial transmit buffer for XBee serial port serial. More...
 
int xbee_ser_tx_used (xbee_serial_t *serial)
 Returns the number of queued bytes in the serial transmit buffer for XBee serial port serial. More...
 
int xbee_ser_tx_flush (xbee_serial_t *serial)
 Flushes (i.e., deletes and does not transmit) characters in the serial transmit buffer for XBee serial port serial. More...
 
int xbee_ser_rx_free (xbee_serial_t *serial)
 Returns the number of bytes of unused space in the serial receive buffer for XBee serial port serial. More...
 
int xbee_ser_rx_used (xbee_serial_t *serial)
 Returns the number of queued bytes in the serial receive buffer for XBee serial port serial. More...
 
int xbee_ser_rx_flush (xbee_serial_t *serial)
 Deletes all characters in the serial receive buffer for XBee serial port serial. More...
 
int xbee_ser_baudrate (xbee_serial_t *serial, uint32_t baudrate)
 Change the baud rate of XBee serial port serial to baudrate bits/second. More...
 
int xbee_ser_open (xbee_serial_t *serial, uint32_t baudrate)
 Opens the serial port connected to XBee serial port serial at baudrate bits/second. More...
 
int xbee_ser_close (xbee_serial_t *serial)
 Close the serial port attached to XBee serial port serial. More...
 
int xbee_ser_break (xbee_serial_t *serial, int enabled)
 Disable the serial transmit pin and pull it low to send a break to the XBee serial port. More...
 
int xbee_ser_flowcontrol (xbee_serial_t *serial, int enabled)
 Enable or disable hardware flow control (CTS/RTS) on the serial port for XBee serial port serial. More...
 
int xbee_ser_set_rts (xbee_serial_t *serial, int asserted)
 Disable hardware flow control and manually set the RTS (ready to send) pin on the XBee device's serial port. More...
 
int xbee_ser_get_cts (xbee_serial_t *serial)
 Read the status of the /CTS (clear to send) pin on the serial port connected to XBee serial port serial. More...
 

Detailed Description

Serial Interface for XBee Module (POSIX Platform)

This file was created by Tom Collins Tom.C.nosp@m.olli.nosp@m.ns@di.nosp@m.gi.c.nosp@m.om based on information from:

http://www.easysw.com/~mike/serial/serial.html

Serial Programming Guide for POSIX Operating Systems 5th Edition, 6th Revision Copyright 1994-2005 by Michael R. Sweet

Todo:
missing a way to hold Tx in break condition

This file was created by Tom Collins Tom.C.nosp@m.olli.nosp@m.ns@di.nosp@m.gi.c.nosp@m.om based on information from:

http://www.easysw.com/~mike/serial/serial.html

Serial Programming Guide for POSIX Operating Systems 5th Edition, 6th Revision Copyright 1994-2005 by Michael R. Sweet

Todo:
missing a way to hold Tx in break condition