diff --git a/sdrbase/CMakeLists.txt b/sdrbase/CMakeLists.txt
index 199dd4428..ed2b48c02 100644
--- a/sdrbase/CMakeLists.txt
+++ b/sdrbase/CMakeLists.txt
@@ -65,7 +65,8 @@ set(sdrbase_SOURCES
plugin/pluginapi.cpp
plugin/pluginmanager.cpp
- webapi/webapirequestmapper.cpp
+ webapi/webapirequestmapper.cpp
+ webapi/webapiserver.cpp
)
set(sdrbase_HEADERS
@@ -155,6 +156,7 @@ set(sdrbase_HEADERS
webapi/webapiadapterinterface.h
webapi/webapirequestmapper.h
+ webapi/webapiserver
)
set(sdrbase_SOURCES
diff --git a/sdrbase/webapi/webapiserver.cpp b/sdrbase/webapi/webapiserver.cpp
new file mode 100644
index 000000000..c36ffc5ea
--- /dev/null
+++ b/sdrbase/webapi/webapiserver.cpp
@@ -0,0 +1,53 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 Edouard Griffiths, F4EXB. //
+// //
+// Swagger server adapter interface //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#include
+
+#include "httplistener.h"
+#include "webapirequestmapper.h"
+#include "webapiserver.h"
+
+WebAPIServer::WebAPIServer(WebAPIRequestMapper *requestMapper) :
+ m_requestMapper(requestMapper),
+ m_listener(0)
+{
+ m_settings.host = "127.0.0.1";
+ m_settings.port = 8001;
+}
+
+WebAPIServer::~WebAPIServer()
+{
+ if (m_listener) { delete m_listener; }
+}
+
+void WebAPIServer::start()
+{
+ if (!m_listener)
+ {
+ m_listener = new qtwebapp::HttpListener(m_settings, m_requestMapper, qApp);
+ }
+}
+
+void WebAPIServer::stop()
+{
+ if (m_listener)
+ {
+ delete m_listener;
+ m_listener = 0;
+ }
+}
diff --git a/sdrbase/webapi/webapiserver.h b/sdrbase/webapi/webapiserver.h
new file mode 100644
index 000000000..06da3a42a
--- /dev/null
+++ b/sdrbase/webapi/webapiserver.h
@@ -0,0 +1,47 @@
+///////////////////////////////////////////////////////////////////////////////////
+// Copyright (C) 2017 Edouard Griffiths, F4EXB. //
+// //
+// Swagger server adapter interface //
+// //
+// This program is free software; you can redistribute it and/or modify //
+// it under the terms of the GNU General Public License as published by //
+// the Free Software Foundation as version 3 of the License, or //
+// //
+// This program is distributed in the hope that it will be useful, //
+// but WITHOUT ANY WARRANTY; without even the implied warranty of //
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
+// GNU General Public License V3 for more details. //
+// //
+// You should have received a copy of the GNU General Public License //
+// along with this program. If not, see . //
+///////////////////////////////////////////////////////////////////////////////////
+
+#ifndef SDRBASE_WEBAPI_WEBAPISERVER_H_
+#define SDRBASE_WEBAPI_WEBAPISERVER_H_
+
+namespace qtwebapp
+{
+ class HttpListener;
+ class HttpListenerSettings;
+}
+
+class WebAPIRequestMapper;
+
+class WebAPIServer
+{
+public:
+ WebAPIServer(WebAPIRequestMapper *requestMapper);
+ ~WebAPIServer();
+
+ void start();
+ void stop();
+
+private:
+ WebAPIRequestMapper *m_requestMapper;
+ qtwebapp::HttpListener *m_listener;
+ qtwebapp::HttpListenerSettings m_settings;
+};
+
+
+
+#endif /* SDRBASE_WEBAPI_WEBAPISERVER_H_ */