Format DLAC newlines.

pull/226/head
Christopher Young 2015-12-15 10:29:54 -05:00
rodzic b15bcf4f5d
commit 2b05579b92
1 zmienionych plików z 14 dodań i 6 usunięć

Wyświetl plik

@ -158,8 +158,8 @@ func (f *UATFrame) decodeTimeFormat() {
} }
} }
func (f *UATFrame) decodeTextFrame() { // Format newlines.
p := dlac_decode(f.FISB_data, f.FISB_length) func formatDLACData(p string) []string {
ret := make([]string, 0) ret := make([]string, 0)
for { for {
pos := strings.Index(p, "\x1E") pos := strings.Index(p, "\x1E")
@ -173,8 +173,14 @@ func (f *UATFrame) decodeTextFrame() {
ret = append(ret, p[:pos]) ret = append(ret, p[:pos])
p = p[pos+1:] p = p[pos+1:]
} }
return ret
}
f.Text_data = ret // Whole frame contents is DLAC encoded text.
func (f *UATFrame) decodeTextFrame() {
p := dlac_decode(f.FISB_data, f.FISB_length)
f.Text_data = formatDLACData(p)
} }
//TODO: Ignoring flags (segmentation, etc.) //TODO: Ignoring flags (segmentation, etc.)
@ -236,7 +242,7 @@ func (f *UATFrame) decodeAirmet() {
text_data_len := record_length - 5 text_data_len := record_length - 5
text_data := dlac_decode(f.FISB_data[11:], uint32(text_data_len)) text_data := dlac_decode(f.FISB_data[11:], uint32(text_data_len))
fmt.Printf("text_data=%s\n", text_data) fmt.Printf("text_data=%s\n", text_data)
f.Text_data = []string{text_data} f.Text_data = formatDLACData(text_data)
case 8: case 8:
// (6-1). (6.22 - Graphical Overlay Record Format). // (6-1). (6.22 - Graphical Overlay Record Format).
record_data := f.FISB_data[6:] // Start after the record header. record_data := f.FISB_data[6:] // Start after the record header.
@ -346,9 +352,11 @@ func (f *UATFrame) decodeAirmet() {
} }
f.Points = points f.Points = points
} }
//case 1: // Unformatted ASCII Text.
fmt.Printf("\n\n\n") default:
fmt.Printf("unknown record format: %d\n", record_format)
} }
fmt.Printf("\n\n\n")
} }
func (f *UATFrame) decodeInfoFrame() { func (f *UATFrame) decodeInfoFrame() {