Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

rwil::SerialOp Namespace Reference


Functions

void open_port (void)
 Open the serial port. More...

void configure_port ()
 Configure the Serial port. More...


Variables

int fd = 0
 The file descriptor of the open serial port. More...


Function Documentation

void rwil::SerialOp::configure_port  
 

Configure the Serial port.

Definition at line 42 of file SerialOp.cpp.

Referenced by rwil::X10Recv::Tick().

00043     {
00044       struct termios options;
00045         
00046       if(!fd) open_port();
00047 
00048       tcgetattr(fd, &options);
00049       cfsetispeed(&options, B9600);
00050       cfsetospeed(&options, B9600);
00051 
00052       options.c_cflag |= CLOCAL | CREAD;
00053       options.c_cflag &= ~CSIZE;
00054       options.c_cflag |= CS8;
00055       options.c_cflag &= ~PARENB;
00056       options.c_cflag &= ~CSTOPB;
00057         
00058       options.c_cflag &= ~CRTSCTS;
00059 
00060       options.c_lflag &= ~(ICANON | ECHO | ECHOE| ISIG );
00061 
00062       //disable software flow control
00063       options.c_iflag &= ~(IXON | IXOFF | IXANY);
00064 
00065       //disaable output mangling
00066       options.c_oflag &= ~OPOST;
00067 
00068       tcsetattr(fd, TCSAFLUSH, &options);
00069       fcntl(fd, F_SETFL, FNDELAY);
00070     }

void rwil::SerialOp::open_port void   
 

Open the serial port.

Definition at line 22 of file SerialOp.cpp.

Referenced by rwil::X10Recv::Tick().

00023     {
00024       //        int fd; /* File descriptor for the port */
00025 
00026 
00027       fd = open("/dev/ttyS0", O_RDWR | O_NOCTTY | O_NONBLOCK);
00028       if (fd == -1)
00029         {
00030           /*
00031            * Could not open the port.
00032            */
00033 
00034           perror("open_port: Unable to open /dev/ttyS0 - ");
00035         }
00036       else
00037         fcntl(fd, F_SETFL, 0);
00038 
00039       return;
00040     }


Variable Documentation

int rwil::SerialOp::fd = 0
 

The file descriptor of the open serial port.

Definition at line 14 of file SerialOp.cpp.

Referenced by rwil::X10Recv::Tick().


Generated on Tue Apr 9 13:53:09 2002 for RWIL - Real World Interface Library by doxygen1.2.12 written by Dimitri van Heesch, © 1997-2001