-
Notifications
You must be signed in to change notification settings - Fork 1
/
ADSBListener.h
58 lines (47 loc) · 1.6 KB
/
ADSBListener.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#pragma once
#include "CommonMacros.h"
SUPPRESS_WARNINGS_START
SUPPRESS_STL_WARNINGS
#include <chrono>
SUPPRESS_WARNINGS_END
#include <memory>
#include <string_view>
namespace ADSB
{
struct Config
{
std::chrono::duration<std::chrono::system_clock> ttl;
};
struct IAirCraft
{
using time_point = std::chrono::time_point<std::chrono::system_clock>;
virtual ~IAirCraft() = default;
virtual uint8_t SourceId() const = 0;
virtual uint32_t MessageCount() const = 0;
virtual uint32_t Addr() const = 0;
virtual std::string_view FlightNumber() const = 0;
virtual time_point LastSeen() const = 0;
virtual uint32_t SquakCode() const = 0;
virtual int32_t Altitude() const = 0;
virtual uint32_t Speed() const = 0;
virtual uint32_t Heading() const = 0;
virtual int32_t Climb() const = 0;
virtual int32_t Lat1E7() const = 0;
virtual int32_t Lon1E7() const = 0;
};
struct IListener
{
virtual ~IListener() = default;
virtual void OnChanged(IAirCraft const&) = 0;
};
struct IDataProvider
{
virtual ~IDataProvider() = default;
virtual void Start(IListener& listener) = 0;
virtual void Stop() = 0;
virtual void NotifySelfLocation(IAirCraft const&) = 0;
};
std::unique_ptr<IDataProvider> CreateDump1090Provider();
std::unique_ptr<ADSB::IDataProvider> CreateFlightRadar24();
std::unique_ptr<ADSB::IDataProvider> CreateProvider();
} // namespace ADSB