1
0
Fork 0

Changes to support voice ATIS

This commit is contained in:
daveluff 2002-12-04 19:51:21 +00:00
parent fe6784af51
commit df089b80f8
2 changed files with 301 additions and 258 deletions

View file

@ -55,6 +55,7 @@ SG_USING_STD(cout);
#include "atislist.hxx" #include "atislist.hxx"
#include "ATCdisplay.hxx" #include "ATCdisplay.hxx"
#include "ATCutils.hxx" #include "ATCutils.hxx"
#include "ATCmgr.hxx"
// Constructor // Constructor
FGATIS::FGATIS() FGATIS::FGATIS()
@ -88,13 +89,15 @@ void FGATIS::Update() {
} else { } else {
// We need to get and display the message // We need to get and display the message
UpdateTransmission(); UpdateTransmission();
globals->get_ATC_display()->RegisterRepeatingMessage(transmission); //cout << "ATIS.CXX - calling ATCMgr to render transmission..." << endl;
globals->get_ATC_mgr()->Render(transmission, true);
displaying = true; displaying = true;
} }
} else { } else {
// We shouldn't be displaying // We shouldn't be displaying
if(displaying) { if(displaying) {
globals->get_ATC_display()->CancelRepeatingMessage(); //cout << "ATIS.CXX - calling NoRender()..." << endl;
globals->get_ATC_mgr()->NoRender();
displaying = false; displaying = false;
} }
} }
@ -120,10 +123,13 @@ void FGATIS::UpdateTransmission() {
transmission = ""; transmission = "";
// Start with the transmitted station name. // UK CAA radiotelephony manual indicated ATIS transmissions start with "This is"
// Not sure about rest of the world though.
transmission += "This_is ";
// transmitted station name.
transmission += name; transmission += name;
// Add "Information" // Add "Information"
transmission += " Information"; transmission += " information";
//cout << "In atis.cxx, time_str = " << time_str << '\n'; //cout << "In atis.cxx, time_str = " << time_str << '\n';
// Add the recording identifier // Add the recording identifier
@ -139,7 +145,7 @@ void FGATIS::UpdateTransmission() {
// Output the recording time. - we'll just output the last whole hour for now. // Output the recording time. - we'll just output the last whole hour for now.
// FIXME - this only gets GMT time but that appears to be all the clock outputs for now // FIXME - this only gets GMT time but that appears to be all the clock outputs for now
//cout << "in atis.cxx, time = " << time_str << endl; //cout << "in atis.cxx, time = " << time_str << endl;
transmission = transmission + " Weather " + time_str.substr(0,3) + "00 hours Zulu"; transmission = transmission + " / Weather " + ConvertNumToSpokenDigits((time_str.substr(0,3) + "00")) + " hours zulu";
// Get the temperature // Get the temperature
// (Hardwire it for now since the global property returns the temperature at the current altitude // (Hardwire it for now since the global property returns the temperature at the current altitude
@ -147,11 +153,25 @@ void FGATIS::UpdateTransmission() {
#ifdef FG_WEATHERCM #ifdef FG_WEATHERCM
sprintf(buf, "%i", int(stationweather.Temperature - 273.15)); sprintf(buf, "%i", int(stationweather.Temperature - 273.15));
#else #else
sprintf(buf, "%d", int(stationweather.get_temperature_degc())); // HACK ALERT - at the moment the new environment subsystem returns bogus temperatures
// FIXME - take out this hack when this gets fixed upstream
int temp = (int)stationweather.get_temperature_degc();
if((temp < -50) || (temp > 60)) {
temp = 15;
}
// original:
//sprintf(buf, "%d", int(stationweather.get_temperature_degc()));
// hack:
sprintf(buf, "%d", temp);
#endif #endif
transmission += " Temperature "; transmission += " / Temperature ";
transmission += buf; if(temp < 0) {
transmission += " degrees Celsius"; transmission += "minus ";
}
string tempstr1 = buf;
string tempstr2;
transmission += ConvertNumToSpokenDigits(tempstr1);
transmission += " degrees_Celsius";
// Get the visibility // Get the visibility
#ifdef FG_WEATHERCM #ifdef FG_WEATHERCM
@ -160,8 +180,9 @@ void FGATIS::UpdateTransmission() {
visibility = stationweather.get_visibility_m(); visibility = stationweather.get_visibility_m();
#endif #endif
sprintf(buf, "%i", int(visibility/1600)); sprintf(buf, "%i", int(visibility/1600));
transmission += " Visibility "; transmission += " / Visibility ";
transmission += buf; tempstr1 = buf;
transmission += ConvertNumToSpokenDigits(tempstr1);
transmission += " miles"; transmission += " miles";
// Get the cloudbase // Get the cloudbase
@ -171,9 +192,20 @@ void FGATIS::UpdateTransmission() {
fgGetDouble("/environment/clouds/layer[0]/elevation-ft"); fgGetDouble("/environment/clouds/layer[0]/elevation-ft");
// For some reason the altitude returned doesn't seem to correspond to the actual cloud altitude. // For some reason the altitude returned doesn't seem to correspond to the actual cloud altitude.
char buf3[10]; char buf3[10];
char buf4[10];
// cout << "cloudbase = " << cloudbase << endl; // cout << "cloudbase = " << cloudbase << endl;
sprintf(buf3, "%i", int(cloudbase)); sprintf(buf3, "%i", int(cloudbase)/1000);
transmission = transmission + " Cloudbase " + buf3 + " feet"; sprintf(buf4, "%i", ((int)cloudbase % 1000)/100);
transmission += " / Cloudbase";
if(int(cloudbase)/1000) {
tempstr1 = buf3;
transmission = transmission + " " + ConvertNumToSpokenDigits(tempstr1) + " thousand";
}
if(((int)cloudbase % 1000)/100) {
tempstr1 = buf4;
transmission = transmission + " " + ConvertNumToSpokenDigits(tempstr1) + " hundred";
}
transmission += " feet";
} }
// Get the pressure / altimeter // Get the pressure / altimeter
@ -181,8 +213,9 @@ void FGATIS::UpdateTransmission() {
#ifndef FG_WEATHERCM #ifndef FG_WEATHERCM
double altimeter = stationweather.get_pressure_sea_level_inhg(); double altimeter = stationweather.get_pressure_sea_level_inhg();
sprintf(buf, "%.2f", altimeter); sprintf(buf, "%.2f", altimeter);
transmission += " Altimeter "; transmission += " / Altimeter ";
transmission += buf; tempstr1 = buf;
transmission += ConvertNumToSpokenDigits(tempstr1);
#endif #endif
// Based on the airport-id and wind get the active runway // Based on the airport-id and wind get the active runway
@ -203,7 +236,7 @@ void FGATIS::UpdateTransmission() {
//If no wind use 270degrees //If no wind use 270degrees
if(speed == 0) { if(speed == 0) {
hdg = 270; hdg = 270;
transmission += " Winds light and variable"; transmission += " / Winds_light_and_variable";
} else { } else {
// //normalize the wind to get the direction // //normalize the wind to get the direction
//wind_x /= speed; wind_y /= speed; //wind_x /= speed; wind_y /= speed;
@ -213,33 +246,43 @@ void FGATIS::UpdateTransmission() {
hdg += 360.0; hdg += 360.0;
//add a description of the wind to the transmission //add a description of the wind to the transmission
char buf2[72]; char buf5[10];
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed), " knots from ", int(hdg), " degrees"); char buf6[10];
transmission += buf2; sprintf(buf5, "%i", int(speed));
sprintf(buf6, "%i", int(hdg));
tempstr1 = buf5;
tempstr2 = buf6;
transmission = transmission + " / Winds " + ConvertNumToSpokenDigits(tempstr1) + " knots from "
+ ConvertNumToSpokenDigits(tempstr2) + " degrees";
} }
#else #else
double speed = stationweather.get_wind_speed_kt(); double speed = stationweather.get_wind_speed_kt();
double hdg = stationweather.get_wind_from_heading_deg(); double hdg = stationweather.get_wind_from_heading_deg();
if (speed == 0) { if (speed == 0) {
transmission += " Winds light and variable"; transmission += " / Winds_light_and_variable";
} else { } else {
// FIXME: get gust factor in somehow // FIXME: get gust factor in somehow
char buf2[72]; char buf5[10];
sprintf(buf2, "%s %i %s %i %s", " Winds ", int(speed), char buf6[10];
" knots from ", int(hdg), " degrees"); sprintf(buf5, "%i", int(speed));
transmission += buf2; sprintf(buf6, "%i", int(hdg));
tempstr1 = buf5;
tempstr2 = buf6;
transmission = transmission + " / Winds " + ConvertNumToSpokenDigits(tempstr1) + " knots from "
+ ConvertNumToSpokenDigits(tempstr2) + " degrees";
} }
#endif #endif
string rwy_no = runways.search(ident, int(hdg)); string rwy_no = runways.search(ident, int(hdg));
if(rwy_no != (string)"NN") { if(rwy_no != (string)"NN") {
transmission += " Landing and departing runway "; transmission += " / Landing_and_departing_runway ";
transmission += rwy_no; transmission += ConvertRwyNumToSpokenString(atoi(rwy_no.c_str()));
//cout << "in atis.cxx, r.rwy_no = " << rwy_no << " r.id = " << r->id << " r.heading = " << r->heading << endl; //cout << "in atis.cxx, r.rwy_no = " << rwy_no << " r.id = " << r->id << " r.heading = " << r->heading << endl;
} }
// Anything else? // Anything else?
transmission += " Advise controller on initial contact you have "; transmission += " / Advise_controller_on_initial_contact_you_have ";
transmission += phonetic_id_string; transmission += phonetic_id_string;
transmission += " /// ";
} }