diff options
-rw-r--r-- | src/qlibsoundmanager.cpp | 25 | ||||
-rw-r--r-- | src/qlibsoundmanager.h | 5 |
2 files changed, 11 insertions, 19 deletions
diff --git a/src/qlibsoundmanager.cpp b/src/qlibsoundmanager.cpp index 39fb871..c9e002c 100644 --- a/src/qlibsoundmanager.cpp +++ b/src/qlibsoundmanager.cpp @@ -47,27 +47,22 @@ static void cbReply_static(struct json_object* replyContents) QSoundmanager::QSoundmanager(QObject *parent) : QObject(parent) { - libsm = new Soundmanager(); } QSoundmanager::~QSoundmanager() { - delete libsm; } int QSoundmanager::init(int port, const QString& token) { - if(libsm == nullptr){ - return -1; - } string ctoken = token.toStdString(); - int rc = libsm->init(port, ctoken); + int rc = Soundmanager::init(port, ctoken); if(rc != 0){ return rc; } me = this; - libsm->registerCallback( + Soundmanager::registerCallback( cbEvent_static, cbReply_static); return rc; @@ -82,27 +77,27 @@ int QSoundmanager::call(const QString &verb, const QJsonObject &arg) { return -1; } - return libsm->call(verb.toStdString().c_str(), jobj); + return Soundmanager::call(verb.toStdString().c_str(), jobj); } int QSoundmanager::connect(int sourceID, const QString& sinkName){ string str = sinkName.toStdString(); - return libsm->connect(sourceID, str); + return Soundmanager::connect(sourceID, str); } int QSoundmanager::connect(int sourceID, int sinkID){ - return libsm->connect(sourceID, sinkID); + return Soundmanager::connect(sourceID, sinkID); } int QSoundmanager::disconnect(int connectionID){ - return libsm->disconnect(connectionID); + return Soundmanager::disconnect(connectionID); } int QSoundmanager::ackSetSourceState(int handle, int errorcode){ - return libsm->ackSetSourceState(handle, errorcode); + return Soundmanager::ackSetSourceState(handle, errorcode); } int QSoundmanager::registerSource(const QString& name){ string str = name.toStdString(); - return libsm->registerSource(str); + return Soundmanager::registerSource(str); } static int create_json_object(const QJsonObject& obj, struct json_object* jobj) @@ -148,11 +143,11 @@ static bool put_val_to_jobj(const char* key, const QJsonValue& val, struct json_ void QSoundmanager::subscribe(const QString event_name) { std::string str = event_name.toStdString(); - libsm->subscribe(str); + Soundmanager::subscribe(str); } void QSoundmanager::unsubscribe(const QString event_name) { std::string str = event_name.toStdString(); - libsm->unsubscribe(str); + Soundmanager::unsubscribe(str); } diff --git a/src/qlibsoundmanager.h b/src/qlibsoundmanager.h index aefe175..36b477b 100644 --- a/src/qlibsoundmanager.h +++ b/src/qlibsoundmanager.h @@ -25,7 +25,7 @@ // Note: This wrapper library will be integrated to libqtappfw -class QSoundmanager : public QObject +class QSoundmanager : public QObject, Soundmanager { Q_OBJECT public: // method @@ -47,9 +47,6 @@ public: signals: void reply(const QVariant &msg); void event(const QVariant &event, const QVariant &msg); - -private: - Soundmanager* libsm; }; |