📄 garmin_serial.cp
字号:
// $Id: garmin_serial.cp,v 1.1.1.1 2000/02/21 06:17:23 decouto Exp $// garmin_serial.cp// Douglas S. J. De Couto// September 9, 1998// Copyright (C) 1998 Douglas S. J. De Couto// <decouto@lcs.mit.edu>//// 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.#include "garmin_serial.h"void garmin_serial::putbyte(const garmin::uint8 c) throw (garmin::not_possible){ if (!m_init) { throw garmin::not_possible("The garmin physical protocol layer is not initialized"); } try { m_port->putchar(c); } catch (...) { // lame error handling... throw garmin::not_possible("There has been a serial port error"); }}garmin::uint8 garmin_serial::getbyte(void) throw (garmin::not_possible){ if (!m_init) { throw garmin::not_possible("The garmin physical protocol layer is not initialized"); } try { return m_port->getchar(); } catch (serial_port::timeout) { throw garmin::timeout("There has been a communications timeout on the serial port"); } catch (...) { throw garmin::not_possible("There has been a serial port error"); } return 0;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -