Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions EFBConnect/DataStructures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ public struct TrafficInfo

[DataItem("ATC FLIGHT NUMBER", 8)]
public string FlightNumber;

[DataItem("IS USER SIM", "bool")]
public bool UserSim;
}

[DataStruct()]
Expand Down
20 changes: 12 additions & 8 deletions EFBConnect/ForeFlightUdp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,14 +86,18 @@ public void Send(TrafficInfo t, uint dwObjectID)
{
if (udpSocket != null)
{
var trafficDatagram = string.Format(
"XTRAFFIC{0},{1},{2:0.#####},{3:0.#####},{4:0.#},{5:0.#},{6},{7:0.###},{8:0.#},{9}",
simIdent, dwObjectID, t.Latitude, t.Longitude, t.Altitude, t.VerticalSpeed,
t.OnGround ? 0 : 1, t.TrueHeading, t.GroundVelocity,
(string.IsNullOrEmpty(t.Airline) || string.IsNullOrEmpty(t.FlightNumber)) ? t.TailNumber : t.Airline + " " + t.FlightNumber
);
udpSocket.SendTo(Encoding.ASCII.GetBytes(trafficDatagram), ipEndPoint);
//log.Info(trafficDatagram);
if (t.UserSim == false)
{
var trafficDatagram = string.Format(
"XTRAFFIC{0},{1},{2:0.#####},{3:0.#####},{4:0.#},{5:0.#},{6},{7:0.###},{8:0.#},{9}",
simIdent, dwObjectID, t.Latitude, t.Longitude, t.Altitude, t.VerticalSpeed,
t.OnGround ? 0 : 1, t.TrueHeading, t.GroundVelocity,
(string.IsNullOrEmpty(t.Airline) || string.IsNullOrEmpty(t.FlightNumber)) ? t.TailNumber : t.Airline + " " + t.FlightNumber
);
udpSocket.SendTo(Encoding.ASCII.GetBytes(trafficDatagram), ipEndPoint);
//log.Info(trafficDatagram);
}

}
}
}
Expand Down