aboutsummaryrefslogtreecommitdiffstats
path: root/homescreen/src/chromecontroller.h
blob: 2a760029c0a8a0c48bdce2166cd07ae807a74312 (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
#pragma once

#include <QObject>
#include <QUrl>

class AglSocketWrapper;
class ChromeController : public QObject
{
    Q_OBJECT

    Q_PROPERTY(bool agentPresent READ agentPresent NOTIFY agentPresentChanged)
    Q_PROPERTY(int chromeState READ chromeState NOTIFY chromeStateChanged)

public:
    enum ChromeState {
        Idle = 0,
        Listening,
        Thinking,
        Speaking,
        MicrophoneOff
    };
    Q_ENUM(ChromeState)

    explicit ChromeController(const QUrl &bindingUrl, QObject *parent = nullptr);
    bool agentPresent() const { return m_agentPresent; }
    int chromeState() const { return m_chromeState; }

public slots:
    void pushToTalk();

signals:
    void agentPresentChanged();
    void chromeStateChanged();

private:
    void setChromeState(ChromeState state);

    AglSocketWrapper *m_aglSocket;
    QString m_voiceAgentId;
    bool m_agentPresent = false;
    ChromeState m_chromeState = Idle;
};