X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=homescreen%2Fsrc%2Fchromecontroller.h;fp=homescreen%2Fsrc%2Fchromecontroller.h;h=2a760029c0a8a0c48bdce2166cd07ae807a74312;hb=0349f05f5885987952a2d8de03983b36722b264e;hp=0000000000000000000000000000000000000000;hpb=0bdd39b247661c1a0406d450d578d4ff3fd171b0;p=apps%2Fhomescreen.git diff --git a/homescreen/src/chromecontroller.h b/homescreen/src/chromecontroller.h new file mode 100644 index 0000000..2a76002 --- /dev/null +++ b/homescreen/src/chromecontroller.h @@ -0,0 +1,42 @@ +#pragma once + +#include +#include + +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; +};