2a760029c0a8a0c48bdce2166cd07ae807a74312
[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(int chromeState READ chromeState NOTIFY chromeStateChanged)
13
14 public:
15     enum ChromeState {
16         Idle = 0,
17         Listening,
18         Thinking,
19         Speaking,
20         MicrophoneOff
21     };
22     Q_ENUM(ChromeState)
23
24     explicit ChromeController(const QUrl &bindingUrl, QObject *parent = nullptr);
25     bool agentPresent() const { return m_agentPresent; }
26     int chromeState() const { return m_chromeState; }
27
28 public slots:
29     void pushToTalk();
30
31 signals:
32     void agentPresentChanged();
33     void chromeStateChanged();
34
35 private:
36     void setChromeState(ChromeState state);
37
38     AglSocketWrapper *m_aglSocket;
39     QString m_voiceAgentId;
40     bool m_agentPresent = false;
41     ChromeState m_chromeState = Idle;
42 };