Skip to content

Commit

Permalink
Merge pull request #794 from wcas/wac/improve-ownship-report-v2
Browse files Browse the repository at this point in the history
Improve ownship detection for EFBs that care
  • Loading branch information
cyoung authored May 15, 2020
2 parents 89e158d + e0a22ba commit 8859b26
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions main/gen_gdl90.go
Original file line number Diff line number Diff line change
Expand Up @@ -295,21 +295,24 @@ func makeOwnshipReport() bool {
// See p.16.
msg[0] = 0x0A // Message type "Ownship".

// Ownship Target Identify (see 3.5.1.2 of GDL-90 Specifications)
// First half of byte is 0 for 'No Traffic Alert'
// Second half of byte is 0 for 'ADS-B with ICAO'
msg[1] = 0x00 // Alert status, address type.

// Retrieve ICAO code from settings
code, _ := hex.DecodeString(globalSettings.OwnshipModeS)
if len(code) != 3 {

// Ownship Target Identify (see 3.5.1.2 of GDL-90 Specifications)
// First half of byte is 0 for Alert type of 'No Traffic Alert'
// Second half of byte is 0 for traffic type 'ADS-B with ICAO'
// Send 0x01 by default, unless ICAO is set, send 0x00
if (len(code) == 3 && code[0] != 0xF0 && code[0] != 0x00) {
msg[1] = 0x00 // ADS-B Out with ICAO
msg[2] = code[0] // Mode S address.
msg[3] = code[1] // Mode S address.
msg[4] = code[2] // Mode S address.
} else {
msg[1] = 0x01 // ADS-B Out with self-assigned code
// Reserved dummy code.
msg[2] = 0xF0
msg[3] = 0x00
msg[4] = 0x00
} else {
msg[2] = code[0] // Mode S address.
msg[3] = code[1] // Mode S address.
msg[4] = code[2] // Mode S address.
}

var tmp []byte
Expand Down

0 comments on commit 8859b26

Please sign in to comment.