-
Notifications
You must be signed in to change notification settings - Fork 0
/
robotservice.h
54 lines (40 loc) · 1.25 KB
/
robotservice.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
#ifndef ROBOTSERVICE_H
#define ROBOTSERVICE_H
#include <QObject>
class QLowEnergyController;
namespace EvoBot {
class RobotService : public QObject
{
Q_OBJECT
Q_PROPERTY(int state READ state NOTIFY stateChanged FINAL)
Q_PROPERTY(QList<int> currentMessage READ currentMessage WRITE setCurrentMessage NOTIFY currentMessageChanged FINAL)
Q_PROPERTY(int currentSound READ currentSound NOTIFY currentSoundChanged FINAL)
public:
enum State {
DisconnectedState,
ConnectingState,
ConnectedState,
};
Q_ENUM(State)
explicit RobotService(QObject *parent = {});
~RobotService();
bool attach(QLowEnergyController *central);
void setCurrentMessage(const QList<int> &message);
QList<int> currentMessage() const;
int currentSound() const;
State state() const;
public slots:
bool startAction(QChar action, int index = 0);
bool stopAction(QChar action, int index = 0);
bool playSound(int index);
bool playLoop(int index);
signals:
void currentMessageChanged(const QByteArray &message);
void currentSoundChanged(int currentSound);
void stateChanged(int newState, int oldState);
private:
class Private;
Private *const d;
};
} // namespace EvoBot
#endif // ROBOTSERVICE_H