2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
Header: FGInput.h
|
|
|
|
Author: Jon Berndt
|
|
|
|
Date started: 12/2/98
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2009-08-30 08:22:03 +00:00
|
|
|
------------- Copyright (C) 1999 Jon S. Berndt (jon@jsbsim.org) -------------
|
1999-12-20 20:25:13 +00:00
|
|
|
|
|
|
|
This program is free software; you can redistribute it and/or modify it under
|
2007-01-15 12:48:54 +00:00
|
|
|
the terms of the GNU Lesser General Public License as published by the Free Software
|
1999-12-20 20:25:13 +00:00
|
|
|
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
|
2007-01-15 12:48:54 +00:00
|
|
|
FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
|
1999-12-20 20:25:13 +00:00
|
|
|
details.
|
|
|
|
|
2007-01-15 12:48:54 +00:00
|
|
|
You should have received a copy of the GNU Lesser General Public License along with
|
1999-12-20 20:25:13 +00:00
|
|
|
this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
|
|
|
Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
|
|
|
2007-01-15 12:48:54 +00:00
|
|
|
Further information about the GNU Lesser General Public License can also be found on
|
1999-12-20 20:25:13 +00:00
|
|
|
the world wide web at http://www.gnu.org.
|
|
|
|
|
|
|
|
HISTORY
|
|
|
|
--------------------------------------------------------------------------------
|
2006-01-12 15:04:22 +00:00
|
|
|
12/02/98 JSB Created
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
SENTRY
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#ifndef FGINPUT_H
|
|
|
|
#define FGINPUT_H
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
INCLUDES
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#include "FGModel.h"
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2009-10-26 13:29:58 +00:00
|
|
|
#include <string>
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
DEFINITIONS
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
#define ID_INPUT "$Id$"
|
2000-10-14 02:10:10 +00:00
|
|
|
|
2004-01-14 22:09:39 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
FORWARD DECLARATIONS
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
2003-06-03 08:46:15 +00:00
|
|
|
namespace JSBSim {
|
|
|
|
|
2009-10-26 13:29:58 +00:00
|
|
|
class FGFDMExec;
|
|
|
|
class Element;
|
|
|
|
class FGfdmSocket;
|
|
|
|
|
2004-01-14 22:09:39 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
|
|
|
CLASS DOCUMENTATION
|
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
|
|
|
|
2008-07-10 17:23:02 +00:00
|
|
|
/** Handles simulation socket input.
|
2006-01-12 15:04:22 +00:00
|
|
|
*/
|
2004-01-14 22:09:39 +00:00
|
|
|
|
2000-11-03 23:02:47 +00:00
|
|
|
/*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
1999-12-20 20:25:13 +00:00
|
|
|
CLASS DECLARATION
|
2000-11-03 23:02:47 +00:00
|
|
|
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%*/
|
1999-12-20 20:25:13 +00:00
|
|
|
|
2006-01-12 15:04:22 +00:00
|
|
|
class FGInput : public FGModel
|
2001-10-05 20:19:59 +00:00
|
|
|
{
|
1999-12-20 20:25:13 +00:00
|
|
|
public:
|
2006-01-12 15:04:22 +00:00
|
|
|
FGInput(FGFDMExec*);
|
|
|
|
~FGInput();
|
|
|
|
|
2008-07-10 17:23:02 +00:00
|
|
|
bool InitModel(void);
|
2006-01-12 15:04:22 +00:00
|
|
|
bool Run(void);
|
|
|
|
|
|
|
|
inline void Enable(void) { enabled = true; }
|
|
|
|
inline void Disable(void) { enabled = false; }
|
|
|
|
inline bool Toggle(void) {enabled = !enabled; return enabled;}
|
|
|
|
bool Load(Element* el);
|
1999-12-20 20:25:13 +00:00
|
|
|
|
|
|
|
private:
|
2006-01-12 15:04:22 +00:00
|
|
|
bool sFirstPass, dFirstPass, enabled;
|
|
|
|
unsigned int port;
|
|
|
|
FGfdmSocket* socket;
|
2009-10-26 13:29:58 +00:00
|
|
|
std::string data;
|
2001-12-24 13:54:55 +00:00
|
|
|
void Debug(int from);
|
1999-12-20 20:25:13 +00:00
|
|
|
};
|
2003-01-24 12:55:28 +00:00
|
|
|
}
|
2006-01-12 15:04:22 +00:00
|
|
|
//%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|
2000-02-15 03:30:01 +00:00
|
|
|
#endif
|
2006-01-12 15:04:22 +00:00
|
|
|
|