diff --git a/desktop/CMakeLists.txt b/desktop/CMakeLists.txt new file mode 100644 index 0000000..618ff2d --- /dev/null +++ b/desktop/CMakeLists.txt @@ -0,0 +1,7 @@ +set(CMAKE_INCLUDE_CURRENT_DIR ON) + +set(REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_TYPE_NAMES ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_TYPE_NAMES} + \"RCTHttpServer\" PARENT_SCOPE) + +set(REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC ${REACT_NATIVE_DESKTOP_EXTERNAL_MODULES_SRC} + ${CMAKE_CURRENT_SOURCE_DIR}/rcthttpserver.cpp PARENT_SCOPE) diff --git a/desktop/rcthttpserver.cpp b/desktop/rcthttpserver.cpp new file mode 100644 index 0000000..74ea37e --- /dev/null +++ b/desktop/rcthttpserver.cpp @@ -0,0 +1,67 @@ +/** + * Copyright (c) 2017-present, Status Research and Development GmbH. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#include "rcthttpserver.h" +#include "bridge.h" +#include "eventdispatcher.h" + +#include +#include +#include +#include + +#include "libstatus.h" + +namespace { +struct RegisterQMLMetaType { + RegisterQMLMetaType() { + qRegisterMetaType(); + } +} registerMetaType; +} // namespace + +class RCTHttpServerPrivate { +public: + Bridge* bridge = nullptr; +}; + +RCTHttpServer::RCTHttpServer(QObject* parent) : QObject(parent), d_ptr(new RCTHttpServerPrivate) {} + +RCTHttpServer::~RCTHttpServer() {} + +void RCTHttpServer::setBridge(Bridge* bridge) { + Q_D(RCTHttpServer); + d->bridge = bridge; +} + +QString RCTHttpServer::moduleName() { + return "RCTHttpServer"; +} + +QList RCTHttpServer::methodsToExport() { + return QList{}; +} + +QVariantMap RCTHttpServer::constantsToExport() { + return QVariantMap(); +} + +void RCTHttpServer::start(int port, QString serviceName) { + +} + +void RCTHttpServer::stop() { + +} + +void RCTHttpServer::respond(int code, QString type, QString body) { + +} + diff --git a/desktop/rcthttpserver.h b/desktop/rcthttpserver.h new file mode 100644 index 0000000..8c56ae0 --- /dev/null +++ b/desktop/rcthttpserver.h @@ -0,0 +1,43 @@ +/** + * Copyright (c) 2017-present, Status Research and Development GmbH. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + */ + +#ifndef RCTHTTPSERVER_H +#define RCTHTTPSERVER_H + +#include "moduleinterface.h" + +#include + +class RCTHttpServerPrivate; +class RCTHttpServer : public QObject, public ModuleInterface { + Q_OBJECT + Q_INTERFACES(ModuleInterface) + + Q_DECLARE_PRIVATE(RCTHttpServer) + +public: + Q_INVOKABLE RCTHttpServer(QObject* parent = 0); + ~RCTHttpServer(); + + void setBridge(Bridge* bridge) override; + + QString moduleName() override; + QList methodsToExport() override; + QVariantMap constantsToExport() override; + + Q_INVOKABLE void start(int port, QString serviceName); + Q_INVOKABLE void stop(); + Q_INVOKABLE void respond(int code, QString type, QString body); + +private: + QScopedPointer d_ptr; +}; + +#endif // RCTHTTPSERVER_H