2 * Copyright (c) 2017 TOYOTA MOTOR CORPORATION
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #ifndef HOMESCREENVOICE_H
18 #define HOMESCREENVOICE_H
21 #include <qlibwindowmanager.h>
24 #include <json-c/json.h>
25 #include <systemd/sd-event.h>
28 #include <afb/afb-wsj1.h>
29 #include <afb/afb-ws-client.h>
34 class HomescreenVoice : public QObject
38 explicit HomescreenVoice(QObject *parent = 0);
40 static const std::vector<std::string> state_lists;
42 int init(int port, const string& token);
43 void on_hangup(void *closure, struct afb_wsj1 *wsj);
44 void on_call(void *closure, const char *api, const char *verb, struct afb_wsj1_msg *msg);
45 void on_event(void *closure, const char *event, struct afb_wsj1_msg *msg);
46 void on_reply(void *closure, struct afb_wsj1_msg *msg);
47 Q_INVOKABLE int startListening(void);
49 void statusChanged(bool status);
52 int initialize_websocket(void);
53 int subscribe(const string event_name);
55 struct afb_wsj1* sp_websock;
56 struct afb_wsj1_itf minterface;
60 std::string mtoken = "hs";
64 #endif // HOMESCREENVOICE_H