⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 gsm_win32_serial.h

📁 这是一款VC++编写的软件
💻 H
字号:
// *************************************************************************
// * GSM TA/ME library
// *
// * File:    gsm_win32_port.h
// *
// * Purpose: WIN32 serial port implementation
// *
// * Author:  Frediano Ziglio (freddy77@angelfire.com)
// *
// * Created: 25.10.2000
// *************************************************************************

#ifndef GSM_WIN32_SERIAL_H
#define GSM_WIN32_SERIAL_H

#include <string>
#include <gsmlib/gsm_error.h>
#include <gsmlib/gsm_port.h>
#include <gsmlib/gsm_util.h>
#define WIN32_MEAN_AND_LEAN
#include <windows.h>

using namespace std;

namespace gsmlib
{
  class Win32SerialPort : public Port
  {
  private:
    HANDLE _file;               // file handle for device
    int _oldChar;               // character set by putBack() (-1 == none)
//    OVERLAPPED _overIn;         // overlapped structure for wait

    // throw GsmException include UNIX errno
    void throwModemException(string message) throw(GsmException);
    
  public:
    // create Port given the UNIX device name
    Win32SerialPort(string device, int lineSpeed = DEFAULT_BAUD_RATE,
                   string initString = DEFAULT_INIT_STRING,
                   bool swHandshake = false)
      throw(GsmException);

    // inherited from Port
    void putBack(char c);
    int readByte() throw(GsmException);
    string getLine() throw(GsmException);
    void putLine(string line,
                         bool carriageReturn = true) throw(GsmException);
    bool wait(GsmTime timeout) throw(GsmException);
    void setTimeOut(unsigned int timeout);

    virtual ~Win32SerialPort();
  };

  // convert baudrate string ("300" .. "460800") to speed_t
  extern int baudRateStrToSpeed(string baudrate) throw(GsmException);
};

#endif // GSM_UNIX_SERIAL_H

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -