char rmc[256], gga[256], patla[256];
char rmc_sum[10], gga_sum[10], patla_sum[10];
char dir;
char rmc[256], gga[256], patla[256];
char rmc_sum[10], gga_sum[10], patla_sum[10];
char dir;
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
char lon[20];
sprintf( lat, "%02d%06.3f,%c", abs(deg), min, dir);
char lon[20];
current_radiostack->get_nav1_sel_radial(),
current_radiostack->get_nav2_freq(),
current_radiostack->get_nav2_sel_radial(),
current_radiostack->get_nav1_sel_radial(),
current_radiostack->get_nav2_freq(),
current_radiostack->get_nav2_sel_radial(),
- FG_LOG( FG_IO, FG_DEBUG, rmc );
- FG_LOG( FG_IO, FG_DEBUG, gga );
- FG_LOG( FG_IO, FG_DEBUG, patla );
+ SG_LOG( SG_IO, SG_DEBUG, rmc );
+ SG_LOG( SG_IO, SG_DEBUG, gga );
+ SG_LOG( SG_IO, SG_DEBUG, patla );
// $GPGGA,163227,3321.173,N,11039.855,W,1,,,3333,F,,,,*0F
bool FGAtlas::parse_message() {
// $GPGGA,163227,3321.173,N,11039.855,W,1,,,3333,F,,,,*0F
bool FGAtlas::parse_message() {
string::size_type begin_line, end_line, begin, end;
begin_line = begin = 0;
string::size_type begin_line, end_line, begin, end;
begin_line = begin = 0;
while ( end_line != string::npos ) {
string line = msg.substr(begin_line, end_line - begin_line);
begin_line = end_line + 1;
while ( end_line != string::npos ) {
string line = msg.substr(begin_line, end_line - begin_line);
begin_line = end_line + 1;
double lon_deg, lon_min, lat_deg, lat_min;
double lon, lat, speed, heading, altitude;
double lon_deg, lon_min, lat_deg, lat_min;
double lon, lat, speed, heading, altitude;
- cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
- FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
+ cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
+ SG_LOG( SG_IO, SG_INFO, " lat = " << lat );
- cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
- FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
+ cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
+ SG_LOG( SG_IO, SG_INFO, " lon = " << lon );
speed = atof( speed_str.c_str() );
cur_fdm_state->set_V_calibrated_kts( speed );
// cur_fdm_state->set_V_ground_speed( speed );
speed = atof( speed_str.c_str() );
cur_fdm_state->set_V_calibrated_kts( speed );
// cur_fdm_state->set_V_ground_speed( speed );
heading = atof( hdg_str.c_str() );
cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
heading = atof( hdg_str.c_str() );
cur_fdm_state->set_Euler_Angles( cur_fdm_state->get_Phi(),
cur_fdm_state->get_Theta(),
- heading * DEG_TO_RAD );
- FG_LOG( FG_IO, FG_INFO, " heading = " << heading );
+ heading * SGD_DEGREES_TO_RADIANS );
+ SG_LOG( SG_IO, SG_INFO, " heading = " << heading );
} else if ( sentence == "GPGGA" ) {
// time
end = msg.find(",", begin);
} else if ( sentence == "GPGGA" ) {
// time
end = msg.find(",", begin);
- // cur_fdm_state->set_Latitude( lat * DEG_TO_RAD );
- FG_LOG( FG_IO, FG_INFO, " lat = " << lat );
+ // cur_fdm_state->set_Latitude( lat * SGD_DEGREES_TO_RADIANS );
+ SG_LOG( SG_IO, SG_INFO, " lat = " << lat );
- // cur_fdm_state->set_Longitude( lon * DEG_TO_RAD );
- FG_LOG( FG_IO, FG_INFO, " lon = " << lon );
+ // cur_fdm_state->set_Longitude( lon * SGD_DEGREES_TO_RADIANS );
+ SG_LOG( SG_IO, SG_INFO, " lon = " << lon );
- FG_LOG( FG_IO, FG_ALERT, "This shouldn't happen, but the channel "
+ SG_LOG( SG_IO, SG_ALERT, "This shouldn't happen, but the channel "
if ( get_direction() == SG_IO_OUT ) {
gen_message();
if ( ! io->write( buf, length ) ) {
if ( get_direction() == SG_IO_OUT ) {
gen_message();
if ( ! io->write( buf, length ) ) {
return false;
}
} else if ( get_direction() == SG_IO_IN ) {
if ( (length = io->readline( buf, FG_MAX_MSG_SIZE )) > 0 ) {
parse_message();
} else {
return false;
}
} else if ( get_direction() == SG_IO_IN ) {
if ( (length = io->readline( buf, FG_MAX_MSG_SIZE )) > 0 ) {
parse_message();
} else {