# include <sys/types.h>
# include <sys/stat.h>
# include <fcntl.h>
+# include <unistd.h>
+# include <ostream>
#endif
+#include <errno.h>
+#include <math.h>
+
#include STL_STRING
#include <simgear/debug/logstream.hxx>
+#include <simgear/misc/sg_path.hxx>
#include <Main/fg_props.hxx>
// Lock the ATC hardware
static int ATCLock( int fd ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
}
return result;
+#else
+ return -1;
+#endif
}
// Release the ATC hardware
static int ATCRelease( int fd ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
}
return result;
+#else
+ return -1;
+#endif
}
// Write a radios command
static int ATCSetRadios( int fd, unsigned char data[ATC_RADIO_DISPLAY_BYTES] ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
}
return result;
+#else
+ return -1;
+#endif
}
static int ATCSetStepper( int fd, unsigned char channel,
unsigned char value )
{
+#if defined( unix ) || defined( __CYGWIN__ )
// rewind
lseek( fd, 0, SEEK_SET );
SG_LOG( SG_IO, SG_DEBUG,
"Sent cmd = " << (int)channel << " value = " << (int)value );
return result;
+#else
+ return -1;
+#endif
}
// Read status of last stepper written to
static unsigned char ATCReadStepper( int fd ) {
+#if defined( unix ) || defined( __CYGWIN__ )
int result;
// rewind
SG_LOG( SG_IO, SG_DEBUG, "Read result = " << (int)buf[0] );
return buf[0];
+#else
+ return 0;
+#endif
}
// Turn a lamp on or off
void ATCSetLamp( int fd, int channel, bool value ) {
+#if defined( unix ) || defined( __CYGWIN__ )
// lamp channels 0-63 are written to LampPort0, channels 64-127
// are written to LampPort1
SG_LOG( SG_IO, SG_ALERT, "Write failed" );
exit( -1 );
}
+#endif
}
#endif
+#ifdef ATCFLIGHTSIM_HAVE_COMPASS
/////////////////////////////////////////////////////////////////////
// Home the compass stepper motor
/////////////////////////////////////////////////////////////////////
}
compass_position = 0.0;
+#endif
/////////////////////////////////////////////////////////////////////
// Blank the radio display
/////////////////////////////////////////////////////////////////////
bool FGATCOutput::do_lamps() {
-
if ( lamps_out_node != NULL ) {
for ( int i = 0; i < lamps_out_node->nChildren(); ++i ) {
// read the next config entry from the property tree
do_lamps();
do_radio_display();
+#ifdef ATCFLIGHTSIM_HAVE_COMPASS
do_steppers();
+#endif
return true;
}