summaryrefslogtreecommitdiff
path: root/Mode/ModeConfig.h
blob: d0730c7094a0ab3b61a4e9c7ce98c8c7b466f5b2 (plain)
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
#ifndef __MODECONFIG_H__
#define __MODECONFIG_H__

#include "Mode.h"
#include "LayoutConfig.h"  
#include "mbed.h"
#include "MTSSerial.h"
#include "Commands.h"

class ModeConfig : public Mode {

public:

    ModeConfig(DOGS102* lcd, ButtonHandler* buttons, mDot* dot, LoRaHandler* lora, GPSPARSER* gps, SensorHandler* sensors);
    
    // Command error text...
    static const char command_error[];
    
    // Response texts...
    static const char newline[];
    static const char done[];
    static const char error[];

    bool start();
    
private: 

    mts::MTSSerial _serial;
    LayoutConfig _lc;
    std::vector<Command*> _commands;

    void addCommand(Command* cmd);
    
    void printHelp();

    bool readable();
    bool writeable();
    char read();
    void write(const char* message);
    void writef(const char* format, ... );
    
};

#endif // __MODECONFIG_H__