kopia lustrzana https://github.com/cyoung/stratux
commit
c4762633b0
|
@ -1,14 +1,13 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"net"
|
||||
"fmt"
|
||||
"bufio"
|
||||
"fmt"
|
||||
"net"
|
||||
"strconv"
|
||||
"strings"
|
||||
"time"
|
||||
"sync"
|
||||
"github.com/sevlyar/go-daemon"
|
||||
"time"
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -17,7 +16,6 @@ const (
|
|||
maxDatagramSize = 8192
|
||||
)
|
||||
|
||||
|
||||
type PositionInfo struct {
|
||||
lat string
|
||||
lng string
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
package main
|
||||
|
||||
import (
|
||||
"os"
|
||||
"fmt"
|
||||
"bufio"
|
||||
"strings"
|
||||
"encoding/hex"
|
||||
"log"
|
||||
"bytes"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"log"
|
||||
"os"
|
||||
"strings"
|
||||
)
|
||||
|
||||
|
||||
const (
|
||||
UPLINK_BLOCK_DATA_BITS = 576
|
||||
UPLINK_BLOCK_BITS = (UPLINK_BLOCK_DATA_BITS + 160)
|
||||
|
@ -33,7 +32,6 @@ const (
|
|||
var logger *log.Logger
|
||||
var buf bytes.Buffer
|
||||
|
||||
|
||||
func dlac_decode(data []byte, data_len uint32) string {
|
||||
fmt.Printf("dlac on %s\n", hex.Dump(data))
|
||||
step := 0
|
||||
|
@ -47,7 +45,7 @@ fmt.Printf("dlac on %s\n", hex.Dump(data))
|
|||
case 1:
|
||||
ch = ((uint32(data[i-1]) & 0x03) << 4) | (uint32(data[i+0]) >> 4)
|
||||
case 2:
|
||||
ch = ((uint32(data[i-1]) & 0x0f) << 2) | (uint32(data[i+0]) >> 6);
|
||||
ch = ((uint32(data[i-1]) & 0x0f) << 2) | (uint32(data[i+0]) >> 6)
|
||||
i = i - 1
|
||||
case 3:
|
||||
ch = uint32(data[i+0]) & 0x3f
|
||||
|
@ -118,8 +116,8 @@ func decodeUplink(frame []byte) {
|
|||
|
||||
utc_coupled := (uint32(frame[6]) & 0x80) != 0
|
||||
app_data_valid := (uint32(frame[6]) & 0x20) != 0
|
||||
slot_id := uint32(frame[6]) & 0x1f;
|
||||
tisb_site_id := uint32(frame[7]) >> 4;
|
||||
slot_id := uint32(frame[6]) & 0x1f
|
||||
tisb_site_id := uint32(frame[7]) >> 4
|
||||
|
||||
logger.Printf("position_valid=%t, %.04f, %.04f, %t, %t, %d, %d\n", position_valid, lat, lon, utc_coupled, app_data_valid, slot_id, tisb_site_id)
|
||||
|
||||
|
@ -182,7 +180,6 @@ func parseInput(buf string) {
|
|||
decodeUplink(frame)
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
logger = log.New(&buf, "logger: ", log.Lshortfile)
|
||||
reader := bufio.NewReader(os.Stdin)
|
||||
|
|
14
gen_gdl90.go
14
gen_gdl90.go
|
@ -1,14 +1,13 @@
|
|||
package main
|
||||
|
||||
|
||||
import (
|
||||
"net"
|
||||
"encoding/hex"
|
||||
"time"
|
||||
"strings"
|
||||
"fmt"
|
||||
"bufio"
|
||||
"encoding/hex"
|
||||
"fmt"
|
||||
"net"
|
||||
"os"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
// http://www.faa.gov/nextgen/programs/adsb/wsa/media/GDL90_Public_ICD_RevA.PDF
|
||||
|
@ -32,7 +31,6 @@ const (
|
|||
UPLINK_MAX_INFO_FRAMES = (424 / 6)
|
||||
)
|
||||
|
||||
|
||||
var Crc16Table [256]uint16
|
||||
var outConn *net.UDPConn
|
||||
|
||||
|
@ -130,7 +128,6 @@ func heartBeatSender() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
func parseInput(buf string) []byte {
|
||||
buf = strings.Trim(buf, "\r\n") // Remove newlines.
|
||||
x := strings.Split(buf, ";") // We want to discard everything before the first ';'.
|
||||
|
@ -164,7 +161,6 @@ func parseInput(buf string) []byte {
|
|||
return frame
|
||||
}
|
||||
|
||||
|
||||
func main() {
|
||||
crcInit() // Initialize CRC16 table.
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue