SDRAngel  4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
Public Member Functions | Private Attributes | List of all members
WebAPIServer Class Reference

#include <webapiserver.h>

+ Collaboration diagram for WebAPIServer:

Public Member Functions

 WebAPIServer (const QString &host, uint16_t port, WebAPIRequestMapper *requestMapper)
 
 ~WebAPIServer ()
 
void start ()
 
void stop ()
 
void setHostAndPort (const QString &host, uint16_t port)
 
const QString & getHost () const
 
int getPort () const
 

Private Attributes

WebAPIRequestMapperm_requestMapper
 
qtwebapp::HttpListenerm_listener
 
qtwebapp::HttpListenerSettings m_settings
 

Detailed Description

Definition at line 33 of file webapiserver.h.

Constructor & Destructor Documentation

◆ WebAPIServer()

WebAPIServer::WebAPIServer ( const QString &  host,
uint16_t  port,
WebAPIRequestMapper requestMapper 
)

Definition at line 26 of file webapiserver.cpp.

References qtwebapp::HttpListenerSettings::host, m_settings, and qtwebapp::HttpListenerSettings::port.

26  :
27  m_requestMapper(requestMapper),
28  m_listener(0)
29 {
30  m_settings.host = host;
31  m_settings.port = port;
32 }
qtwebapp::HttpListenerSettings m_settings
Definition: webapiserver.h:49
qtwebapp::HttpListener * m_listener
Definition: webapiserver.h:48
WebAPIRequestMapper * m_requestMapper
Definition: webapiserver.h:47

◆ ~WebAPIServer()

WebAPIServer::~WebAPIServer ( )

Definition at line 34 of file webapiserver.cpp.

References m_listener.

35 {
36  if (m_listener) { delete m_listener; }
37 }
qtwebapp::HttpListener * m_listener
Definition: webapiserver.h:48

Member Function Documentation

◆ getHost()

const QString& WebAPIServer::getHost ( ) const
inline

Definition at line 43 of file webapiserver.h.

Referenced by MainWindow::commandKeyPressed(), and MainWindow::on_commandRun_clicked().

43 { return m_settings.host; }
qtwebapp::HttpListenerSettings m_settings
Definition: webapiserver.h:49
+ Here is the caller graph for this function:

◆ getPort()

int WebAPIServer::getPort ( ) const
inline

Definition at line 44 of file webapiserver.h.

Referenced by MainWindow::commandKeyPressed(), and MainWindow::on_commandRun_clicked().

44 { return m_settings.port; }
qtwebapp::HttpListenerSettings m_settings
Definition: webapiserver.h:49
+ Here is the caller graph for this function:

◆ setHostAndPort()

void WebAPIServer::setHostAndPort ( const QString &  host,
uint16_t  port 
)

Definition at line 58 of file webapiserver.cpp.

References qtwebapp::HttpListenerSettings::host, m_listener, m_requestMapper, m_settings, qtwebapp::HttpListenerSettings::port, and stop().

59 {
60  stop();
61  m_settings.host = host;
62  m_settings.port = port;
64 }
qtwebapp::HttpListenerSettings m_settings
Definition: webapiserver.h:49
qtwebapp::HttpListener * m_listener
Definition: webapiserver.h:48
WebAPIRequestMapper * m_requestMapper
Definition: webapiserver.h:47
+ Here is the call graph for this function:

◆ start()

void WebAPIServer::start ( )

Definition at line 39 of file webapiserver.cpp.

References qtwebapp::HttpListenerSettings::host, m_listener, m_requestMapper, m_settings, and qtwebapp::HttpListenerSettings::port.

Referenced by MainCore::MainCore(), and MainWindow::MainWindow().

40 {
41  if (!m_listener)
42  {
44  qInfo("WebAPIServer::start: starting web API server at http://%s:%d", qPrintable(m_settings.host), m_settings.port);
45  }
46 }
qtwebapp::HttpListenerSettings m_settings
Definition: webapiserver.h:49
qtwebapp::HttpListener * m_listener
Definition: webapiserver.h:48
WebAPIRequestMapper * m_requestMapper
Definition: webapiserver.h:47
+ Here is the caller graph for this function:

◆ stop()

void WebAPIServer::stop ( )

Definition at line 48 of file webapiserver.cpp.

References qtwebapp::HttpListenerSettings::host, m_listener, m_settings, and qtwebapp::HttpListenerSettings::port.

Referenced by setHostAndPort(), MainCore::~MainCore(), and MainWindow::~MainWindow().

49 {
50  if (m_listener)
51  {
52  delete m_listener;
53  m_listener = 0;
54  qInfo("WebAPIServer::stop: stopped web API server at http://%s:%d", qPrintable(m_settings.host), m_settings.port);
55  }
56 }
qtwebapp::HttpListenerSettings m_settings
Definition: webapiserver.h:49
qtwebapp::HttpListener * m_listener
Definition: webapiserver.h:48
+ Here is the caller graph for this function:

Member Data Documentation

◆ m_listener

qtwebapp::HttpListener* WebAPIServer::m_listener
private

Definition at line 48 of file webapiserver.h.

Referenced by setHostAndPort(), start(), stop(), and ~WebAPIServer().

◆ m_requestMapper

WebAPIRequestMapper* WebAPIServer::m_requestMapper
private

Definition at line 47 of file webapiserver.h.

Referenced by setHostAndPort(), and start().

◆ m_settings

qtwebapp::HttpListenerSettings WebAPIServer::m_settings
private

Definition at line 49 of file webapiserver.h.

Referenced by setHostAndPort(), start(), stop(), and WebAPIServer().


The documentation for this class was generated from the following files: