/usr/include/Aria/ArSerialConnection.h is in libaria-dev 2.8.0+repack-1.2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | /*
Adept MobileRobots Robotics Interface for Applications (ARIA)
Copyright (C) 2004, 2005 ActivMedia Robotics LLC
Copyright (C) 2006, 2007, 2008, 2009, 2010 MobileRobots Inc.
Copyright (C) 2011, 2012, 2013 Adept Technology
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
If you wish to redistribute ARIA under different terms, contact
Adept MobileRobots for information about a commercial version of ARIA at
robots@mobilerobots.com or
Adept MobileRobots, 10 Columbia Drive, Amherst, NH 03031; +1-603-881-7960
*/
#ifndef ARSERIALCONNECTION_H
#define ARSERIALCONNECTION_H
#include <string>
#include "ariaTypedefs.h"
#include "ArDeviceConnection.h"
/// Utility for connecting to and communicating with devices through a serial port
/** @ingroup UtilityClasses
@ingroup DeviceClasses
*/
class ArSerialConnection: public ArDeviceConnection
{
public:
/// Constructor
AREXPORT ArSerialConnection(bool is422 = false);
/// Destructor also closes the connection
AREXPORT virtual ~ArSerialConnection();
/** Opens the serial port
* @return 0 on success. Return one of the error codes in the
* ArSerialConnection::Open enumeration on error.
* @sa ArUtil::COM1, ArUtil::COM2, ArUtil::COM3, ArUtil::COM4
*/
AREXPORT int open(const char * port = NULL);
/** Sets the port this connection will use
* @sa ArUtil::COM1, ArUtil::COM2, ArUtil::COM3, ArUtil::COM4
*/
AREXPORT void setPort(const char *port = NULL);
/** Gets the port this is using
* @sa ArUtil::COM1, ArUtil::COM2, ArUtil::COM3, ArUtil::COM4
*/
AREXPORT const char * getPort(void);
AREXPORT virtual bool openSimple(void);
AREXPORT virtual int getStatus(void);
AREXPORT virtual bool close(void);
AREXPORT virtual int read(const char *data, unsigned int size,
unsigned int msWait = 0);
AREXPORT virtual int write(const char *data, unsigned int size);
AREXPORT virtual const char * getOpenMessage(int messageNumber);
/**
Sets the BAUD rate to use when connection is opened, or change the baud rate if already opened
@param baud the baud rate to set the connection to
@return true if rate was sucessfully set, false otherwise (unsupported rate, system error changing rate on port, etc.)
@sa getBaud()
*/
AREXPORT bool setBaud(int baud);
/// Gets what the current baud rate is set to
AREXPORT int getBaud(void);
/// Sets whether to enable or disable the hardware control lines
AREXPORT bool setHardwareControl(bool hardwareControl);
/// Gets whether the hardware control lines are enabled or disabled
AREXPORT bool getHardwareControl(void);
/// Sees how the CTS line is set (true = high)
AREXPORT bool getCTS(void);
/// Sees how the DSR line is set (true = high)
AREXPORT bool getDSR(void);
/// Sees how the DCD line is set (true = high)
AREXPORT bool getDCD(void);
/// Sees how the Ring line is set (true = high)
AREXPORT bool getRing(void);
// Internal open, for use by open and openSimple
AREXPORT int internalOpen(void);
enum Open {
OPEN_COULD_NOT_OPEN_PORT = 1, ///< Could not open the port
OPEN_COULD_NOT_SET_UP_PORT, ///< Could not set up the port
OPEN_INVALID_BAUD_RATE, ///< Baud rate is not valid
OPEN_COULD_NOT_SET_BAUD, ///< Baud rate valid, but could not set it
OPEN_ALREADY_OPEN ///< Connection was already open
};
AREXPORT virtual ArTime getTimeRead(int index);
AREXPORT virtual bool isTimeStamping(void);
protected:
void buildStrMap(void);
#ifndef WIN32
// these both return -1 for errors
int rateToBaud(int rate);
int baudToRate(int baud);
// this just tries
void startTimeStamping(void);
bool myTakingTimeStamps;
#endif
ArStrMap myStrMap;
std::string myPortName;
int myBaudRate;
int myStatus;
bool myHardwareControl;
#ifndef WIN32
int myPort;
#endif // ifdef linux
bool myIs422;
#ifdef WIN32
HANDLE myPort;
#endif // ifdef WIN32
};
#endif
|