SerialDevice.h
Go to the documentation of this file.
00001 /*
00002 *  Copyright (c) 2012, Robotnik Automation, SLL
00003 * 
00004 *   This file is part of sick-s3000-ros-pkg.
00005 *
00006 *   sick-s3000-ros-pkg is free software: you can redistribute it and/or modify
00007 *   it under the terms of the GNU General Public License as published by
00008 *   the Free Software Foundation, either version 3 of the License, or
00009 *   (at your option) any later version.
00010 *
00011 *   This program is distributed in the hope that it will be useful,
00012 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014 *   GNU General Public License for more details.
00015 *
00016 *   You should have received a copy of the GNU General Public License
00017 *   along with this program.  If not, see <http://www.gnu.org/licenses/>.
00018 *
00019 */
00020 
00031 #ifndef __SERIALDEV_H
00032 #define __SERIALDEV_H
00033         
00034 #include <stdio.h>
00035 #include <string>
00036 
00037 class SerialDevice
00038 {
00039 private:        
00040         //Device's name
00041         const std::string device_;      
00042         //Parity for input and output: EVEN, ODD, NONE
00043         const std::string parity_;      
00044         //BaudRate: 9600, 19200, 38400, 115200, 500000
00045         const int baudrate_;
00046         //Character size mask. Values are CS5, CS6, CS7, or CS8.
00047         const int datasize_;
00048 
00049         int serial_port_; // File descriptor
00050 
00051 public:
00052         SerialDevice(const char *device, int baudrate,const char *parity, int datasize);        
00053         virtual ~SerialDevice();
00054         
00055         bool OpenPort();
00056         bool ClosePort();
00057         bool ReadPort( char *result, int bytes_to_read, int &bytes_read );
00058 
00059         const char* GetDevice() const { return device_.c_str(); }
00060         
00061 private:
00063         bool SetTermSpeed(int speed);
00064 
00065 };
00066 
00067 #endif


s3000_laser
Author(s): Roman Navarro Garcia
autogenerated on Sat Jun 8 2019 20:55:59