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.
16 #ifndef QLIBSOUNDMANAGER_H
17 #define QLIBSOUNDMANAGER_H
21 #include <QtCore/QJsonObject>
22 #include <libsoundmanager.hpp>
27 class QLibSoundmanager : public QObject
31 explicit QLibSoundmanager(QObject *parent = nullptr);
33 int init(int port, const QString& token);
35 using sm_event_handler = std::function<void(int sourceid, int handle)>;
37 void subscribe(const QString &event_name);
38 void unsubscribe(const QString &event_name);
40 void emit_event(const QString &event, const QJsonObject &msg);
41 void emit_reply(const QJsonObject &msg);
45 Q_INVOKABLE int call(const QString &verb, const QJsonObject &arg);
46 Q_INVOKABLE int connect(int sourceID, const QString& sinkName);
47 Q_INVOKABLE int disconnect(int connectionID);
48 Q_INVOKABLE int ackSetSourceState(int handle, int errorcode);
49 Q_INVOKABLE int registerSource(const QString& name);
52 void reply(const QVariant &msg);
53 void event(const QVariant &event, const QVariant &msg);
56 LibSoundmanager* libsm;
60 #endif /*QLIBSOUNDMANAGER_H*/