Source: include/paramtrans.H
|
|
|
|
/* -------------------------------------------------------------------------
paramtrans.H - Class Which Handles Specific HpTrans Parameters
-------------------------------------------------------------------------
Copyright (C) 2000-2001 Eric R. Schendel
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., 675 Mass Ave, Cambridge, MA 02139, USA.
------------------------------------------------------------------------- */
#ifndef PTRANS_H
#define PTRANS_H
#include <string>
#include "status.H"
#include "parameters.H"
namespace GlobalParameters {
using namespace StatusMsgs;
enum TransState {TS_NONE = 0, TS_SEND = 1, TS_RECV = 2};
enum HpTransMode {HTM_LINE = 0, HTM_GUI = 1, HTM_INFO = 2};
const int GP_BAUD = 9600;
const char GP_TTYS[] = "/dev/ttyS0";
const char OPT_BAUDRATE[] = "-b";
const char OPT_NOCONVERT[] = "-n";
const char OPT_OVERWRITE[] = "-o";
const char OPT_RECEIVE[] = "-r";
const char OPT_SEND[] = "-s";
const char OPT_TTY[] = "-t";
class ParamTrans: public Parameters {
public:
ParamTrans();
Error parseCommandLine(const int&, char**, const char** = 0);
void printHelp() const;
/**
* Set baud rate
*
* @param rate can be "1200", "2400", "4800", or "9600"
*/
Error setBaudRate(const string rate);
bool isConversionSet() const { return conversion; }
bool isOverwriteSet() const { return overwrite; }
int getBaud() const { return baud; }
string getFileName() const { return file; }
string getFileInName() const { return filein; }
string getTTY() const { return ttys; }
TransState getTransState() const { return trans; }
HpTransMode getMode() const { return mode; }
private:
TransState trans;
HpTransMode mode;
string file;
string filein;
string ttys;
int baud;
bool conversion;
bool overwrite;
Log log;
Error parse_transfer(const int&, char**);
Error parse_TTY(const int&, char**);
Error parse_rate(const int&, char**);
Error parse_files(const int&, char**);
void parse_conversion(const int&, char**);
void parse_overwrite(const int&, char**);
};
extern ParamTrans params;
}
#endif
Generated on Fri Mar 9 02:04:42 2001, using kdoc 2.0a43. |