// database record definitions for CoPilot ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Database versions // // // CoPilot version Flt Rte W&B Pln Air Plt Way UWy Prf // // 0.1 - 0.4 0 0 0 0 0 0 0 - - // 0.5 1 // 1.0 - 1.2 1 1 // 2.0 - 2.8 1 1 2 // 3.0 1 2 2 1 3 2 2,3 // 3.1 2 3 4 3 0 // 3.2 0* // 3.3 - 3.6 4 3 // 4.0 3 - - - 5 4 4 1 // 4.1 - 4.3 6 6 3 // 4.4 - 4.8 7 3 // 5.0 7 4 // // * user waypoint incorrectly created as version 0 (should have been 3) // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // current database versions const UInt16 flightVersion = 7; const UInt16 aircraftVersion = 7; const UInt16 pilotVersion = 3; const UInt16 waypointVersion = 4; const UInt16 prefsVersion = 4; // do not change if simply adding to the end of the structure // database types const UInt32 flightDBType = 'Flgt'; // type for the flight database const UInt32 aircraftDBType = 'Airc'; // type for the aircraft database const UInt32 pilotDBType = 'pilt'; // type for the pilot database const UInt32 waypointDBType = 'wayp'; // type for the waypoint database const UInt32 prefDBType = 'Pref'; // type for the preferences database const UInt32 userWpDBType = 'wayu'; // type for the user waypoint database const UInt32 sysWaypointUpdateType = 'swpu'; // type for the system waypoint update database const UInt32 userWaypointUpdateType = 'uwpu'; // type for the user waypoint update database const UInt32 aircraftUpdateType = 'arcu'; // type for the aircraft update database const UInt32 pilotUpdateType = 'pltu'; // type for the pilot update database const UInt32 routeDBType = 'Rout'; // type for the route database - no longer used const UInt32 wbDBType = 'W&B '; // type for the w&b database - no longer used const UInt32 planDBType = 'Plan'; // type for the plan database - no longer used ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Flight database // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// enum RecordType {noRecordType, flightRecord = 321, routeRecord, wbRecord, planRecord}; // Flight record const UInt16 maxLegs = 40; const UInt16 costItems = 7; enum CostType {empty, perNm, perMi, perKm, perHour, perTakeoff, perFlight, percentSubtotal}; struct SegmentTable { UInt32 wb; // uniqueID of entry in the flight database UInt32 plan; // uniqueID of entry in the flight database }; const UInt16 maxSegments = maxLegs + 1; const SegmentTable emptySegment = {0, 0}; struct FlightStructV7 // flight version 7 { RecordType recordType; // flightRecord UInt32 aircraft; // uniqueID of entry in the aircraft database UInt32 pilot; // uniqueID of entry in the pilot database UInt32 route; // uniqueID of entry in the flight database SegmentTable segment[maxSegments]; UInt16 currentWbSegment; // currently displayed W&B segment UInt16 currentPlanSegment; // currently displayed Plan segment UInt32 seconds; // time (seconds since 1/1/1904) double fuelCost; // negative indicates checkbox should be off double cost[costItems]; // array of costs UInt32 costType[costItems]; // array of CostType UInt32 acDistance; // Boolean - true to include aircraft distance amount UInt32 acTime; // Boolean - true to include aircraft time amount UInt32 acTakeoffs; // Boolean - true to include aircraft takeoff amount // the rest of the structure is a set of packed strings Char strings[0]; // Char description[]; // Char note[]; // Char costText[costItems][]; }; // Route record const UInt16 airwaySize = 12; // field is currently limited to 6 chars const UInt16 alternateTime = UInt16(-1); // ground time that indicates an alternate leg enum WaypointType {system, user}; enum Quadrant {north, west, south, east, noIntersection}; enum AirwayType {airw, sid, star, approach}; struct Waypoint { UInt32 uniqueID; WaypointType wpType; }; struct LegStructV7 // flight version 7 { Waypoint waypoint[2]; // unique id of the from and to waypoint database entry double altitude; // flight altitude in feet Int16 windDirection; // wind direction in degrees double windSpeed; // wind speed in knots double pressure; // pressure in inches of mercury double temp; // temperature at altitude in feet Char airway[airwaySize + 1]; // text string for airway AirwayType airwayType : 3; // airway, sid, star or approach Boolean newSegment : 1; // new segment starts at this leg Boolean refuel: 1; // valid only for newSegment leg UInt16 groundTime; // minutes double intersection; // intersection (latitude or longitude) in radians Quadrant quadrant; // intersection N, E, W, or S }; struct RouteStructV7 // flight version 7 { RecordType recordType; // routeRecord UInt16 numLegs; LegStructV7 leg[maxLegs]; }; // Weight & Balance record struct WbStructV7 // flight version 7 { RecordType recordType; // wbRecord UInt32 aircraftUniqueId; double weight[]; // array of weights }; // Plan record enum PlanElement {aircraftIdent, flightRules, flightType, number, aircraftType, wakeTurbulance, equipment, departureIdent, departureTime, cruiseSpeed, altitudeRoute, destinationIdent, ete, sarTime, info, endurance, persons, elt, description, remarks, arrival, sarContact, pilotName, pilotAddress, pilotPhone, pilotLicence, alternateIdent, typeEquip, spare1, homebase, initialAltitude, americanRoute, spare2}; const UInt16 planSize = 33; enum PlanType {canadian, american, icao}; struct PlanStructV7 // flight version 7 { RecordType recordType; // planRecord Int32 planType; // type is PlanType Char strings[0]; // array (size = planSize) of strings, index by PlanElement }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Waypoint and User Waypoint databases // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// const UInt16 identSize = 10; const UInt16 nameSize = 100; struct WaypointStructV4 // database version 4 { double latitude; // latitude in radians (north is positive) double longitude; // longitude in radians (west is positive) float magVar; // magnetic variation in radians (west is positive) float elevation; // waypoint elevation in feet (even if other units are used for display) // the rest of the record is a set of zero terminated strings Char ident[]; // zero terminated string for ident (max 10 characters PLUS the zero) // Char name[]; // zero terminated string for waypoint name (max 100 characters PLUS the zero) // Cha notes[]; // zero terminated string for notes (max 1000 characters PLUS the zero) }; enum WaypointStringNumber {identStrNum, nameStrNum, notesStrNum}; struct AppInfoStruct { UInt16 version; UInt32 creationDate; Char dbInfo[]; }; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Aircraft database // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// const UInt16 aircraftIdentSize = 15; const UInt16 aircraftTypeSize = 12; const UInt16 aircraftHomebaseSize = 10; const UInt16 aircraftDescriptionSize = 30; const UInt16 cruiseItems = 8; const UInt16 wbLimitPoints = 8; const UInt16 cgItems = 8; const UInt16 wbNameSize = 20; const UInt16 climbItems = 8; enum Wake {Light, Medium, Heavy}; enum Elt {noELT, A, AD, F, AF, AP, P, W, S}; enum FuelMeasurement {climbFuelFlow, climbFuelUsed}; enum FuelUnit {usGal, impGal, pound, litre, kilo}; // must match resource struct Equip { Boolean vhf : 1; Boolean loran : 1; Boolean dme : 1; Boolean adf : 1; Boolean vfrGps : 1; Boolean ils : 1; Boolean vor : 1; Boolean modeA : 1; Boolean modeC : 1; Boolean spare : 1; Boolean ifrGps : 1; Boolean rnav : 1; UInt16 : 5; // force into second word }; struct Quadratic { double a; double b; double c; }; const Quadratic zeroZeroOne = {0, 0, 1}; struct AircraftStructV5 { // general UInt32 wake; // type is Wake UInt32 elt; // type is Elt // performance double cruiseAlt[cruiseItems]; double cruiseSpd[cruiseItems]; Quadratic cruise; // quadratic curve fit, a(x**2) + b(x) + c, based on knots // equipment Equip equipment; // weight & balance 2 double normalWeight[wbLimitPoints]; double normalCofG[wbLimitPoints]; double utilityWeight[wbLimitPoints]; double utilityCofG[wbLimitPoints]; // fuel flow double cruiseFuel[cruiseItems]; Quadratic fuel; double startTaxiFuel; // fuel units Int32 fuelUnits; // new climb information double climbTransitionAltitude; // switch from profile 1 to profile 2 at this altitude double climbAlt[climbItems]; double climbRate[climbItems]; double climbSpeed[climbItems]; double climbFuel[climbItems]; Quadratic rate1; // quadratic based on ft/hr Quadratic rate2; // quadratic based on ft/hr Quadratic speed1; // quadratic based on ft/hr, corrected for tas, horizontal component only Quadratic speed2; // quadratic based on ft/hr, corrected for tas, horizontal component only Quadratic fuel1; Quadratic fuel2; // fuel density double fuelDensity; // pounds per US gallon // cost information double perHour; double perNauticalMile; double perLeg; // climb fuel specification type UInt32 fuelMeasurement; // type is FuelMeasurement // weight & balance 1 UInt32 numStations; Char endOfFixed[]; // weight and balance stations // UInt16 fuelTank[numStations]; // added in V7 // double arm[numStations]; // double weight[numStations]; // the rest of the record is a set of zero terminated strings // Char ident[]; // max size = aircraftIdentSize // Char type[]; // Char desc[]; // Char homeBase[]; // Char wbName[][]; // numStations entries, max size is wbNameSize }; #define AircraftStructV6 AircraftStructV5 // V6 did not change defined structure #define AircraftStructV7 AircraftStructV6 // V7 did not change defined structure enum AircraftStringNumber {identStrNumber, typeStrNumber, descStrNumber, homebaseStrNumber, wbNameStrNumber}; const UInt16 sizeOfStation = 2 * sizeof(double) + sizeof(UInt16); // size of each station // macro to find the start of the strings, acStruct must point to an AircraftStruct #define acIdentPtr(acStruct) ((Char *) (UInt32(acStruct) + OffsetOf(AircraftStruct, endOfFixed) + acStruct->numStations * sizeOfStation)) ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Pilot database // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// /* struct PilotStruct { Char last[]; Char first[]; Char licence[]; Char phone[]; Char address[]; Char contact[]; Char flightRules[]; Char flightType[]; Char numAircraft[]; Char sarTime[]; }; */ enum PilotStringNumber {lastNameStr, firstNameStr, licenceNumberStr, phoneNumberStr, addressStr, contactNameStr, flightRulesStr, flightTypeStr, numAircraftStr, sarTimeStr}; ///////////////////////////////////////////////////////////////////////////////////////////////////////////// // // Preferences database // ///////////////////////////////////////////////////////////////////////////////////////////////////////////// const UInt16 numLastIdents = 7; const UInt16 costSize = 10; const UInt16 waypointCacheSize = 41; const UInt16 numActivationCodes = 8; const UInt16 numActivationFeatures = 20; struct WpCache { Waypoint waypoint; Char identStr[identSize + 1]; UInt16 dbRecordNum; }; struct CopilotPreferencesV4 { // old version 1 UInt16 currentFlightIndex; // old version 2 UInt32 defaultAircraft; UInt32 defaultPilot; Int32 defaultPlanType; // old version 3 UInt16 lastMagVar; UInt16 lastLongitude; UInt16 lastLatitude; UInt16 distanceUnits; UInt16 altitudeUnits; UInt16 pressureUnits; UInt16 weightUnits; UInt16 armUnits; UInt16 speedUnits; UInt16 windSpeedUnits; UInt16 climbRateUnits; UInt16 fuelDensityUnits; UInt16 preferencesShown; // old version 4 Char initialChar; Char lastIdents[numLastIdents]; // old version 5 Int16 windDirection; Int16 windSpeed; Int16 runway; double altitude; double pressure; double temperature; double airspeed; UInt16 calculatorUnits; // CoPilot version 3.1 Int16 trueOrIndicated; double displayResult; Char costString[costItems][costSize + 1]; Int16 costType[costItems]; Int16 acTime; Int16 acDistance; Int16 acTakeoffs; double fuelCost; UInt16 routeColumn[4]; Int16 printSoftware; Int16 printDescription; Int16 printRoute; Int16 printWB; Int16 printFlightPlan; Int16 printWaypoints; // CoPilot version 3.2 UInt16 currentWaypointDB; // CoPilot version 3.3 double previousAltitude; Int16 previousWindDirection; double previousWindSpeed; double previousPressure; double previousTemperature; Char previousAirway[airwaySize + 1]; double trueAirspeed; double groundSpeed; double magHeading; double magTrack; // CoPilot version 4.0, database version 1 WpCache waypointCache[waypointCacheSize]; UInt16 nextCacheIndex; // CoPilot version 4.1, database version 3, waypointCacheSize reduced from 50 to 21 // CoPilot version 5.0, database version 4, waypointCacheSize increased from 21 to 41 Int32 zuluOffset; // seconds, using system preferences for OS 4.0+ UInt16 previousAirwayType; UInt16 recentSort; UInt16 flightSort; UInt16 activationCode[numActivationCodes]; // CoPilot version 4.2 UInt16 featureActivated[numActivationFeatures]; // CoPilot version 4.5 UInt16 fuelSummaryUnits1; UInt16 fuelSummaryUnits2; // CoPilot version 4.6 UInt32 externalWaypointIdentifier; };