@@ -68,6 +68,10 @@ discard block |
||
| 68 | 68 | 't', 'u', 'v', 'w' // 119 |
| 69 | 69 | ); // char 64 |
| 70 | 70 | */ |
| 71 | + |
|
| 72 | + /** |
|
| 73 | + * @param integer $ascii |
|
| 74 | + */ |
|
| 71 | 75 | private function asciidec_2_8bit($ascii) { |
| 72 | 76 | //only process in the following range: 48-87, 96-119 |
| 73 | 77 | if ($ascii < 48) { } |
@@ -93,6 +97,10 @@ discard block |
||
| 93 | 97 | return(substr($bin, -6)); |
| 94 | 98 | } |
| 95 | 99 | |
| 100 | + /** |
|
| 101 | + * @param integer $_start |
|
| 102 | + * @param integer $_size |
|
| 103 | + */ |
|
| 96 | 104 | private function binchar($_str, $_start, $_size) { |
| 97 | 105 | // ' ' --- '?', // 0x20 - 0x3F |
| 98 | 106 | // '@' --- '_', // 0x40 - 0x5F |
@@ -118,6 +126,10 @@ discard block |
||
| 118 | 126 | } |
| 119 | 127 | |
| 120 | 128 | // function for decoding the AIS Message ITU Payload |
| 129 | + |
|
| 130 | + /** |
|
| 131 | + * @param string $_aisdata |
|
| 132 | + */ |
|
| 121 | 133 | private function decode_ais($_aisdata) { |
| 122 | 134 | $ro = new stdClass(); // return object |
| 123 | 135 | $ro->cls = 0; // AIS class undefined, also indicate unparsed msg |
@@ -351,6 +363,12 @@ discard block |
||
| 351 | 363 | elseif ($code == 99) return 'Other Type, no additional information'; |
| 352 | 364 | } |
| 353 | 365 | |
| 366 | + /** |
|
| 367 | + * @param string $_itu |
|
| 368 | + * @param integer $_len |
|
| 369 | + * @param integer $_filler |
|
| 370 | + * @param string $aux |
|
| 371 | + */ |
|
| 354 | 372 | public function process_ais_itu($_itu, $_len, $_filler, $aux /*, $ais_ch*/) { |
| 355 | 373 | global $port; // tcpip port... |
| 356 | 374 | |
@@ -371,6 +389,10 @@ discard block |
||
| 371 | 389 | |
| 372 | 390 | // char* - AIS \r terminated string |
| 373 | 391 | // TCP based streams which send messages in full can use this instead of calling process_ais_buf |
| 392 | + |
|
| 393 | + /** |
|
| 394 | + * @param string $rawdata |
|
| 395 | + */ |
|
| 374 | 396 | public function process_ais_raw($rawdata, $aux = '') { // return int |
| 375 | 397 | static $num_seq; // 1 to 9 |
| 376 | 398 | static $seq; // 1 to 9 |
@@ -513,6 +535,9 @@ discard block |
||
| 513 | 535 | return $lond; |
| 514 | 536 | } |
| 515 | 537 | |
| 538 | + /** |
|
| 539 | + * @param integer $max_len |
|
| 540 | + */ |
|
| 516 | 541 | private function char2bin($name, $max_len) { |
| 517 | 542 | $len = strlen($name); |
| 518 | 543 | if ($len > $max_len) $name = substr($name,0,$max_len); |
@@ -540,6 +565,9 @@ discard block |
||
| 540 | 565 | return $rv.$pad; |
| 541 | 566 | } |
| 542 | 567 | |
| 568 | + /** |
|
| 569 | + * @param string $_enc |
|
| 570 | + */ |
|
| 543 | 571 | private function mk_ais($_enc, $_part=1,$_total=1,$_seq='',$_ch='A') { |
| 544 | 572 | $len_bit = strlen($_enc); |
| 545 | 573 | $rem6 = $len_bit % 6; |
@@ -593,6 +621,9 @@ discard block |
||
| 593 | 621 | return $result; |
| 594 | 622 | } |
| 595 | 623 | |
| 624 | + /** |
|
| 625 | + * @param string $mmsi |
|
| 626 | + */ |
|
| 596 | 627 | public function mmsitype($mmsi) { |
| 597 | 628 | if (strlen($mmsi) == 9) { |
| 598 | 629 | if (substr($mmsi,0,3) == '974') return 'EPIRB (Emergency Position Indicating Radio Beacon) AIS'; |