-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathc_downlink_scheduler_tenant.h
More file actions
63 lines (52 loc) · 1.89 KB
/
Copy pathc_downlink_scheduler_tenant.h
File metadata and controls
63 lines (52 loc) · 1.89 KB
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
59
60
61
62
63
#pragma once
#include <f_core/os/c_runnable_tenant.h>
#include <f_core/radio/c_lora_frame_handler.h>
#include <f_core/state_machine/c_pad_flight_landing_state_machine.h>
#include <f_core/utils/c_hashmap.h>
#include <f_core/utils/c_soft_timer.h>
#include <memory>
class CDownlinkSchedulerTenant : public CRunnableTenant, public CPadFlightLandedStateMachine, public CLoraFrameHandler {
public:
/**
* Constructor
* @param loraDownlinkMessagePort The message port to send downlink frames to
* @param telemetryMessagePortMap The map of telemetry port to message port for that telemetry
* @param telemetryDownlinkTimes The map of telemetry port to downlink interval
*/
explicit CDownlinkSchedulerTenant(CMessagePort<LaunchLoraFrame>& loraDownlinkMessagePort,
const CHashMap<uint16_t, CMessagePort<LaunchLoraFrame>*>& telemetryMessagePortMap,
CHashMap<uint16_t, k_timeout_t>& telemetryDownlinkTimes);
/**
* See parent docs
*/
void HandleFrame(const ReceivedLaunchLoraFrame& rxFrame) override;
/**
* See parent docs
*/
void Run() override;
protected:
/**
* See parent docs
*/
void PadRun() override;
/**
* See parent docs
*/
void FlightRun() override;
/**
* See parent docs
*/
void LandedRun() override;
/**
* See parent docs
*/
void GroundRun() override;
private:
// Send a telemetry frame, piggybacking the flight phase onto GNSS frames
// (port 12005) so the ground can observe the radio's state.
void SendFrame(LaunchLoraFrame& frame);
CMessagePort<LaunchLoraFrame>& loraDownlinkMessagePort;
CHashMap<uint16_t, CMessagePort<LaunchLoraFrame>*> telemetryMessagePortMap;
CHashMap<uint16_t, std::unique_ptr<CSoftTimer>> telemetryDownlinkTimers;
bool gnssDownlinkAvailable = false;
};