Display Alexa specific chrome when it is used
[apps/homescreen.git] / homescreen / src / chromecontroller.h
1 #pragma once
2
3 #include <QObject>
4 #include <QUrl>
5
6 class AglSocketWrapper;
7 class ChromeController : public QObject
8 {
9     Q_OBJECT
10
11     Q_PROPERTY(bool agentPresent READ agentPresent NOTIFY agentPresentChanged)
12     Q_PROPERTY(QString agentName READ agentName NOTIFY agentNameChanged)
13     Q_PROPERTY(int chromeState READ chromeState NOTIFY chromeStateChanged)
14
15 public:
16     enum ChromeState {
17         Idle = 0,
18         Listening,
19         Thinking,
20         Speaking,
21         MicrophoneOff
22     };
23     Q_ENUM(ChromeState)
24
25     explicit ChromeController(const QUrl &bindingUrl, QObject *parent = nullptr);
26     bool agentPresent() const { return m_agentPresent; }
27     int chromeState() const { return m_chromeState; }
28     QString agentName() const { return m_voiceAgentName; }
29
30 public slots:
31     void pushToTalk();
32
33 signals:
34     void agentPresentChanged();
35     void agentNameChanged();
36     void chromeStateChanged();
37
38 private:
39     void setChromeState(ChromeState state);
40
41     AglSocketWrapper *m_aglSocket;
42     QString m_voiceAgentId = "";
43     QString m_voiceAgentName = "";
44     bool m_agentPresent = false;
45     ChromeState m_chromeState = Idle;
46 };