Skip to content

Commit e568ff8

Browse files
committed
docs: README and install instructions
1 parent 9837fb4 commit e568ff8

1 file changed

Lines changed: 67 additions & 5 deletions

File tree

README.md

Lines changed: 67 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,72 @@ A Software Development Kit (SDK) for the ECFMP Flow Control API
44

55
## Integrating With The SDK
66

7-
Coming soon!
7+
### Create a HTTP Client
88

9-
## Building
9+
Rather than ship with an opinionated viewpoint as to what you should use for HTTP requests, this SDK
10+
provides an interface `HttpClient` that the HTTP client of your choice must implement.
11+
12+
### Create a logger
13+
14+
You can optionally pass the SDK a logging class that implements the `Logger` interface. This will allow you to log
15+
messages from the SDK.
16+
17+
### Create an instance of the SDK
18+
19+
To create an instance of the SDK, you must use the `SDKFactory` class. This class will allow you to configure the SDK,
20+
and
21+
then create an instance of it.
22+
23+
```c++
24+
#include "ECFMP/SDKFactory.h"
25+
#include "ECFMP/SDK.h"
26+
27+
auto http = std::make_shared<MyHttpClient>();
28+
auto logger = std::make_shared<MyLogger>();
29+
auto ecfmp = ECFMP::Plugin::SdkFactory::Build()
30+
.WithLogger(logger)
31+
.WithHttpClient(std::move(http)).Instance();
32+
```
33+
34+
### Add the SDK to EuroScopes timer event
35+
36+
The SDK needs to be called periodically to process events. To do this, you must add the call to the EuroScopes timer
37+
event. This is necessary because EuroScope requires that calls to its internal classes are made from the plugin thread
38+
(as opposed to something asynchronous.)
39+
40+
```c++
41+
void MyPlugin::OnTimer(int time)
42+
{
43+
ecfmp.OnEuroscopeTimerTick();
44+
}
45+
```
46+
47+
### Register event handlers
48+
49+
You can register event handlers with the SDK. These event handlers will be called when the SDK processes an event.
50+
These listeners must implement the `EventListener` interface.
51+
52+
```c++
53+
auto eventListener = std::make_shared<MyListener<ECFMP::Plugin::FlowMeasureActivatedEvent>>();
54+
ecfmp.EventBus().Subscribe<ECFMP::Plugin::FlowMeasureActivatedEvent>(eventListener);
55+
```
56+
57+
## Known Limitations
58+
59+
At the moment, the SDK has the following limitations:
60+
61+
- The SDK does not support Event Participation filters on Flow Measures. This is because EuroScope does not provide
62+
the CID of the aircraft that is being filtered on, and thus a way around this needs to be devised.
63+
64+
## Development
65+
66+
### Building
1067

1168
This project builds using CMake. You can build using a command similar to below
1269

1370
`cmake -DCMAKE_BUILD_TYPE=<Release|Debug> -DCMAKE_EXPORT_COMPILE_COMMANDS=ON -DCMAKE_DEPENDS_USE_COMPILER=FALSE -G Ninja -Bbuild`
1471

15-
## Running Tests
72+
### Running Tests
1673

1774
Tests can be run using the `ctest` command, from the build directory:
1875

@@ -24,8 +81,13 @@ The SDK has the following design rationale.
2481

2582
### Event Driven
2683

27-
Similar to how EuroScope is event driven, so is this SDK. Integrations can register a series of event handlers with the SDK, which will pass on events, such as new Flow Measures for processing.
84+
Similar to how EuroScope is event driven, so is this SDK. Integrations can register a series of event handlers with the
85+
SDK, which will pass on events, such as new Flow Measures for processing.
86+
87+
The SDK itself is also event driven, and uses an internal event bus to handle events.
2888

2989
### Async
3090

31-
EuroScope is a single-threaded application when it comes to plugins, therefore, anything that may take a while (e.g. HTTP requests) will be done aysynchronously. The results of these operations will be deferred for when the EuroScope thread comes back around, as EuroScope sometimes doesn't like things interacting with it asynchronously.
91+
EuroScope is a single-threaded application when it comes to plugins, therefore, anything that may take a while (e.g.
92+
HTTP requests) will be done asynchronously. The results of these operations will be deferred for when the EuroScope
93+
thread comes back around, as EuroScope sometimes doesn't like things interacting with it asynchronously.

0 commit comments

Comments
 (0)