Skip to content

Commit

Permalink
More ACARS messages are human readable
Browse files Browse the repository at this point in the history
  • Loading branch information
Ysurac committed Apr 2, 2015
1 parent 253f352 commit 66e13d6
Show file tree
Hide file tree
Showing 7 changed files with 460 additions and 19 deletions.
8 changes: 8 additions & 0 deletions cron-acars.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,14 @@
// This is not a cron job... Use it like a daemon
require_once('require/class.ACARS.php');

// Check if schema is at latest version
require_once('require/class.Connection.php');
$schema = new Connection();
if ($schema::latest() === false) {
echo "You MUST update to latest schema. Run install/index.php";
exit();
}

$debug = true;

$ACARS=new ACARS();
Expand Down
9 changes: 9 additions & 0 deletions cron-sbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,15 @@
// This is not a cron job... Use it like a daemon
require_once('require/class.SBS.php');

// Check if schema is at latest version
require_once('require/class.Connection.php');
$schema = new Connection();
if ($schema::latest() === false) {
echo "You MUST update to latest schema. Run install/index.php";
exit();
}


$debug = true;

$SBS=new SBS();
Expand Down
108 changes: 108 additions & 0 deletions db/acars_label.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
CREATE TABLE IF NOT EXISTS `acars_label` (
`id` int(11) NOT NULL,
`label` varchar(3) NOT NULL,
`title` varchar(500) NOT NULL
) ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8;

INSERT INTO `acars_label` (`id`, `label`, `title`) VALUES
(1, '00', 'Emergency situation report'),
(2, '2S', 'Weather request'),
(3, '2U', 'Weather'),
(4, '4M', 'Cargo information'),
(5, '51', 'Ground GMT request/report'),
(6, '52', 'Ground UTC request/report'),
(7, '54', 'Aircrew initiated voice contact request'),
(8, '57', 'Alternate aircrew initiated position report'),
(9, '5D', 'Automatic Terminal Information Service (ATIS) request'),
(10, '5P', 'Temporary suspension of ACARS'),
(11, '5R', 'Aircraft initiated position report'),
(12, '5U', 'Weather request'),
(13, '5Y', 'Revision to previous ETA'),
(14, '5Z', 'Airline designated downlink'),
(15, '7A', 'Aircraft initiated engine data'),
(16, '7B', 'Aircraft initiated misc.message'),
(17, 'A1', 'Deliver oceanic clearance'),
(18, 'A2', 'Deliver departure clearance'),
(19, 'A4', 'Acknowledge PDC'),
(20, 'A5', 'Request position report'),
(21, 'A6', 'Request ADS report'),
(22, 'A7', 'Forward free text to aircraft'),
(23, 'A8', 'Deliver departure slot'),
(24, 'A9', 'Deliver Automatic Terminal Information Service (ATIS) information'),
(25, 'A0', 'Automatic Terminal Information Service (ATIS) Facilities notification'),
(26, 'B1', 'Request oceanic clearance'),
(27, 'B2', 'Request oceanic readback'),
(28, 'B3', 'Request departure clearance'),
(29, 'B4', 'Acknowledge departure clearance'),
(30, 'B5', 'Provide position report'),
(31, 'B6', 'Provide ADS report'),
(32, 'B7', 'Forward free text to ATS'),
(33, 'B8', 'Request departure slot'),
(34, 'B9', 'Request Automatic Terminal Information Service (ATIS) information'),
(35, 'C0', 'Uplink message to all cockpit printers'),
(36, 'C1', 'Uplink message to cockpit printer #1'),
(37, 'C2', 'Uplink message to cockpit printer #2'),
(38, 'C3', 'Uplink message to cockpit printer #3'),
(39, 'CA', 'Printer status = error'),
(40, 'CB', 'Printer status = busy'),
(41, 'CC', 'Printer status = local'),
(42, 'CD', 'Printer status = no paper'),
(43, 'CE', 'Printer status = buffer overrun'),
(44, 'CF', 'Printer status = reserved'),
(45, 'F3', 'Dedicated transceiver advisory'),
(46, 'H1', 'Message to/from terminal'),
(47, 'HX', 'Undelivered uplink report'),
(48, 'M1', 'IATA Departure message'),
(49, 'M2', 'IATA Arrival message'),
(50, 'M3', 'IATA Return to ramp message'),
(51, 'M4', 'IATA Return from airborne message'),
(52, 'Q0', 'ACARS link test'),
(53, 'Q1', 'ETA Departure/arrival reports'),
(54, 'Q2', 'ETA reports'),
(55, 'Q3', 'Clock update'),
(56, 'Q4', 'Voice circuit busy'),
(57, 'Q5', 'Unable to process uplinked messages'),
(58, 'Q6', 'Voice-to-ACARS change-over'),
(59, 'Q7', 'Delay message'),
(60, 'QA', 'Out/fuel report'),
(61, 'QB', 'Off report'),
(62, 'QC', 'On report'),
(63, 'QD', 'In/fuel report'),
(64, 'QE', 'Out/fuel destination report'),
(65, 'QF', 'Off/destination report'),
(66, 'QG', 'Out/return in report'),
(67, 'QH', 'Out report'),
(68, 'QK', 'Landing report'),
(69, 'QL', 'Arrival report'),
(70, 'QM', 'Arrival information report'),
(71, 'QN', 'Diversion report'),
(72, 'QX', 'Intercept'),
(73, 'RA', 'Command aircraft terminal to transmit data'),
(74, 'RB', 'Response of aircraft terminal to RA message'),
(75, '8X', 'Uplink ATIS Information'),
(76, 'AA', 'ATCCommunications'),
(77, 'AB', 'Terminal Weather Information for Pilots (TWIP)'),
(78, 'AC', 'Pushback Clearance'),
(79, 'AD', 'Expected Taxi Clearance'),
(80, 'AF', 'CPC Command Response'),
(81, 'B0', 'ATS Facility Notification (AFN)'),
(82, 'BA', 'ATCCommunications'),
(83, 'BB', 'Terminal Weather Information for Pilots'),
(84, 'BC', 'Pushback Clearance Request'),
(85, 'BD', 'Expected Taxi Clearance Request'),
(86, 'BE', 'CPC Log-on/Log-off Request'),
(87, 'BF', 'CPC WILCO/UnassignedBLE Response'),
(88, 'H2', 'Meteorological Report '),
(89, 'H3', 'Icing Report'),
(90, 'S1', 'VHF Network Statistics Report'),
(91, 'S2', 'VHF Performance Report'),
(92, 'S3', 'LRU Configuration Report'),
(93, 'SA', 'Media Advisory'),
(94, 'SQ', 'Squitter Message'),
(95, 'X1', 'Service Provider Defined DSP');

ALTER TABLE `acars_label`
ADD PRIMARY KEY (`id`), ADD UNIQUE KEY `label` (`label`);

ALTER TABLE `acars_label`
MODIFY `id` int(11) NOT NULL AUTO_INCREMENT,AUTO_INCREMENT=96;
33 changes: 29 additions & 4 deletions install/class.update_schema.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,8 +112,6 @@ private static function update_from_1() {
return "error (update schema_version) : ".$e->getMessage()."\n";
}
return $error;

return $error;
}

private static function update_from_2() {
Expand Down Expand Up @@ -169,6 +167,25 @@ private static function update_from_3() {
}
return $error;
}

private static function update_from_4() {
$Connection = new Connection();

$error = '';
// Create table acars_label
$error .= create_db::import_file('../db/acars_label.sql');
if ($error == '') {
// Update schema_version to 5
$query = "UPDATE `config` SET `value` = '5' WHERE `name` = 'schema_version'";
try {
$sth = Connection::$db->prepare($query);
$sth->execute();
} catch(PDOException $e) {
return "error (update schema_version) : ".$e->getMessage()."\n";
}
}
return $error;
}

public static function check_version($update = false) {
$version = 0;
Expand All @@ -192,14 +209,22 @@ public static function check_version($update = false) {
$error = self::update_from_2();
if ($error != '') return $error;
else return self::check_version(true);
} elseif ($result['value'] == '3') self::update_from_3();
else return '';
} elseif ($result['value'] == '3') {
self::update_from_3();
if ($error != '') return $error;
else return self::check_version(true);
} elseif ($result['value'] == '4') {
self::update_from_4();
if ($error != '') return $error;
else return self::check_version(true);
} else return '';
}
else return $result['value'];
}

} else return $version;
}

}
//echo update_schema::check_version();
?>
Loading

0 comments on commit 66e13d6

Please sign in to comment.