Source: include/transfer.H


Annotated List
Files
Globals
Hierarchy
Index
/* -------------------------------------------------------------------------
   transfer.H - Protocol Classes for Direct Transfer
   -------------------------------------------------------------------------
   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 PROTOCOL_H
#define PROTOCOL_H

#include <cc++/serial.h>
#include <string>

#include "status.H"

namespace TransferProtocols {

using namespace StatusMsgs;

const int FLUSHWAIT = 250;

const unsigned long NOTIMER = ~0;

class DirectTransfer: public TTYStream {

   public:
      DirectTransfer(const string& serial, const int& speed,
                     LogLevel lvl = NONE);
      virtual ~DirectTransfer();

      virtual bool send(const string fname) = 0;
      virtual bool receive(const string fname) = 0;

      virtual void terminateConnection();

      StatusMsgs::Error open();
      StatusMsgs::Error close();

      void flushInput(void);

      /**
       * @return true if read, false if timed out
       */
      bool read(unsigned char& c, unsigned long time = NOTIMER);

      /**
       * @return true if written, false if timed out
       */
      bool write(const unsigned char& c, unsigned long time = NOTIMER);
      bool write(const string& s, unsigned long time = NOTIMER);

   private:
      Log log;
      string tty;
      int baud;
};

}

#endif

Generated on Fri Mar 9 02:04:42 2001, using kdoc 2.0a43.