From 2c7625351a7e0b4480f02206759b1a5c342d0d83 Mon Sep 17 00:00:00 2001 From: curt Date: Fri, 19 Nov 1999 03:02:49 +0000 Subject: [PATCH] Added PVE (ProVision Entertainment) and RUL (some guy's motion platform) formats. --- src/Network/Makefile.am | 2 + src/Network/protocol.cxx | 35 +++++++++--- src/Network/pve.cxx | 117 +++++++++++++++++++++++++++++++++++++++ src/Network/pve.hxx | 57 +++++++++++++++++++ src/Network/rul.cxx | 103 ++++++++++++++++++++++++++++++++++ src/Network/rul.hxx | 58 +++++++++++++++++++ 6 files changed, 365 insertions(+), 7 deletions(-) create mode 100644 src/Network/pve.cxx create mode 100644 src/Network/pve.hxx create mode 100644 src/Network/rul.cxx create mode 100644 src/Network/rul.hxx diff --git a/src/Network/Makefile.am b/src/Network/Makefile.am index 9207bdf53..6d6c76e96 100644 --- a/src/Network/Makefile.am +++ b/src/Network/Makefile.am @@ -7,6 +7,8 @@ libNetwork_a_SOURCES = \ protocol.cxx protocol.hxx \ garmin.cxx garmin.hxx \ nmea.cxx nmea.hxx \ + pve.cxx pve.hxx \ + rul.cxx rul.hxx \ net_hud.cxx network.cxx network.h INCLUDES += -I$(top_builddir) -I$(top_builddir)/Lib -I$(top_builddir)/Simulator diff --git a/src/Network/protocol.cxx b/src/Network/protocol.cxx index 2954f04b6..1e5b7ca0d 100644 --- a/src/Network/protocol.cxx +++ b/src/Network/protocol.cxx @@ -23,6 +23,7 @@ #include +#include "iochannel.hxx" #include "protocol.hxx" @@ -38,11 +39,24 @@ FGProtocol::~FGProtocol() { } -// dummy open routine +// standard I/O channel open routine bool FGProtocol::open() { - FG_LOG( FG_IO, FG_INFO, "dummy FGProtocol::open()" ); - enabled = false; - return false; + if ( is_enabled() ) { + FG_LOG( FG_IO, FG_ALERT, "This shouldn't happen, but the channel " + << "is already in use, ignoring" ); + return false; + } + + FGIOChannel *io = get_io_channel(); + + if ( ! io->open( get_direction() ) ) { + FG_LOG( FG_IO, FG_ALERT, "Error opening channel communication layer." ); + return false; + } + + set_enabled( true ); + + return true; } @@ -60,10 +74,17 @@ bool FGProtocol::close() { } -// dummy close routine +// standard I/O channel close routine bool FGProtocol::gen_message() { - FG_LOG( FG_IO, FG_INFO, "dummy FGProtocol::gen_message()" ); - return false; + FGIOChannel *io = get_io_channel(); + + set_enabled( false ); + + if ( ! io->close() ) { + return false; + } + + return true; } diff --git a/src/Network/pve.cxx b/src/Network/pve.cxx new file mode 100644 index 000000000..2caa94060 --- /dev/null +++ b/src/Network/pve.cxx @@ -0,0 +1,117 @@ +// pve.cxx -- "PVE" protocal class (for Provision Entertainment) +// +// Written by Curtis Olson, started November 1999. +// +// Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org +// +// 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. +// +// $Id$ + + +#include +#include +#include +#include