home *** CD-ROM | disk | FTP | other *** search
- /***************************************************************************
- These C++ classes are copyright 1990, by William Herrera.
- All those who put this code or its derivatives in a commercial product MUST
- mention this copyright in their documentation for users of the products in
- which this code or its derivative classes are used. Otherwise, this code
- may be freely distributed and freely used for any purpose.
- ***************************************************************************/
-
- // file serialpo.hpp class declaration of SerialPort class.
-
- #ifndef SERIALPO_HPP
- #define SERIALPO_HPP 1
-
- #include "comports.hpp"
-
- class SerialPort
- {
- protected:
- // the protected data within each Serial object
-
- int port_number;
- boolean translatenewline; // These are used in '\r\n' <--> '\n'
- boolean lastin_wascr; // translation.
- uart * com; // pointer to the uart for port
-
- public:
- SerialPort(int portnum = 1, long speed = 38400,
- parity_t p = NOPAR, int sbits = 1,
- int dbits = 8, boolean trans = false);
- virtual ~SerialPort();
- uart * GetUART();
- void SetSpeed(long s);
- long GetSpeed();
- void SetParity(parity_t p);
- parity_t GetParity();
- void SetStopBits(int s);
- int GetStopBits();
- void SetDataBits(int s);
- int GetDataBits();
- void PurgeInput();
- void FlushOutput();
- void PurgeOutput();
- boolean CarrierPresent();
- void RaiseDTR();
- void DropDTR();
- void Pause(int ms = 550);
- void Break(int ms = 550);
- void SetDoIfNoCarrier(void (*f)());
- boolean InputEmpty();
- boolean OutputEmpty();
- boolean OutputReady();
- void SendChar(char ch);
- void SendString(char * s);
- int GetChar();
- void Write(void * p,int n);
- int Read(char * p, int n);
- };
-
- #endif
-
- // end of file serialpo.hpp
-