CommunicationController.hpp 850 Bytes
Newer Older
Niels Post's avatar
Niels Post committed
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
#pragma once

#include <RF24.h>
#include <communication/handler/GeneralCommandHandler.hpp>
#include <communication/handler/ActionCommandHandler.hpp>
#include <communication/handler/MeasurementCommandHandler.hpp>
#include <queue>

class PMSVSettings;
class Command;
class ReturnCommand;

class CommunicationController {
private:
    RF24                      nrfRadio;
    GeneralCommandHandler     generalCommandHandler;
    ActionCommandHandler      actionCommandHandler;
    MeasurementCommandHandler measurementCommandHandler;

    std::queue<Command> commandQueue;


protected:
    void handleCommand(const Command &command);
    void sendReturnCommand(const ReturnCommand &command);
    void parseNextCommand();
public:
    CommunicationController(const PMSVSettings &settings, MovementController &movementController);

    void update();


};