forked from awawa-dev/HyperHDR
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Will be included only on systems that can provide development protobuf compiler&libraries (for example Linux). Or you can build it yourself. That legacy library is excluded from submodules now and won't be shipped alongside HyperHDR anymore.
- Loading branch information
Showing
24 changed files
with
880 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
#pragma once | ||
|
||
// util | ||
#include <utils/Logger.h> | ||
#include <utils/settings.h> | ||
|
||
// qt | ||
#include <QVector> | ||
|
||
class QTcpServer; | ||
class ProtoClientConnection; | ||
class NetOrigin; | ||
|
||
/// | ||
/// @brief This class creates a TCP server which accepts connections wich can then send | ||
/// in Protocol Buffer encoded commands. This interface to Hyperhdr is used by various | ||
/// third-party applications | ||
/// | ||
class ProtoServer : public QObject | ||
{ | ||
Q_OBJECT | ||
|
||
public: | ||
ProtoServer(const QJsonDocument& config, QObject* parent = nullptr); | ||
~ProtoServer() override; | ||
|
||
public slots: | ||
/// | ||
/// @brief Handle settings update | ||
/// @param type The type from enum | ||
/// @param config The configuration | ||
/// | ||
void handleSettingsUpdate(settings::type type, const QJsonDocument& config); | ||
|
||
void initServer(); | ||
|
||
private slots: | ||
/// | ||
/// @brief Is called whenever a new socket wants to connect | ||
/// | ||
void newConnection(); | ||
|
||
/// | ||
/// @brief is called whenever a client disconnected | ||
/// | ||
void clientDisconnected(); | ||
|
||
private: | ||
/// | ||
/// @brief Start the server with current _port | ||
/// | ||
void startServer(); | ||
|
||
/// | ||
/// @brief Stop server | ||
/// | ||
void stopServer(); | ||
|
||
|
||
private: | ||
QTcpServer* _server; | ||
NetOrigin* _netOrigin; | ||
Logger* _log; | ||
int _timeout; | ||
quint16 _port; | ||
const QJsonDocument _config; | ||
|
||
QVector<ProtoClientConnection*> _openConnections; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
{ | ||
"type" : "object", | ||
"required" : true, | ||
"title" : "edt_conf_pbs_heading_title", | ||
"properties" : | ||
{ | ||
"enable" : | ||
{ | ||
"type" : "boolean", | ||
"format": "checkbox", | ||
"required" : true, | ||
"title" : "edt_conf_general_enable_title", | ||
"default" : true, | ||
"propertyOrder" : 1 | ||
}, | ||
"port" : | ||
{ | ||
"type" : "integer", | ||
"required" : true, | ||
"title" : "edt_conf_general_port_title", | ||
"minimum" : 1024, | ||
"maximum" : 65535, | ||
"default" : 19445 | ||
}, | ||
"timeout" : | ||
{ | ||
"type" : "integer", | ||
"required" : true, | ||
"title" : "edt_conf_pbs_timeout_title", | ||
"append" : "edt_append_s", | ||
"minimum" : 1, | ||
"default" : 5, | ||
"propertyOrder" : 3 | ||
} | ||
}, | ||
"additionalProperties" : false | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
|
||
# Define the current source locations | ||
set(CURRENT_HEADER_DIR ${CMAKE_SOURCE_DIR}/include/protoserver) | ||
set(CURRENT_SOURCE_DIR ${CMAKE_SOURCE_DIR}/libsrc/protoserver) | ||
|
||
include_directories( | ||
${CMAKE_CURRENT_BINARY_DIR} | ||
${PROTOBUF_INCLUDE_DIRS} | ||
) | ||
|
||
set(ProtoServer_PROTOS ${CURRENT_SOURCE_DIR}/message.proto ) | ||
|
||
protobuf_generate_cpp(ProtoServer_PROTO_SRCS ProtoServer_PROTO_HDRS ${ProtoServer_PROTOS} ) | ||
set_property(SOURCE ${CMAKE_SOURCE_DIR}/build/libsrc/protoserver/message.pb.cc PROPERTY SKIP_AUTOMOC ON) | ||
set_property(SOURCE ${CMAKE_SOURCE_DIR}/build/libsrc/protoserver/message.pb.h PROPERTY SKIP_AUTOMOC ON) | ||
### Split protoclient from protoserver as protoserver relates to HyperHDRDaemon and standalone capture binarys can't link to it | ||
|
||
add_library(protoclient | ||
${CURRENT_SOURCE_DIR}/ProtoClientConnection.h | ||
${CURRENT_SOURCE_DIR}/ProtoClientConnection.cpp | ||
${ProtoServer_PROTO_SRCS} | ||
${ProtoServer_PROTO_HDRS} | ||
) | ||
|
||
add_library(protoserver | ||
${CURRENT_HEADER_DIR}/ProtoServer.h | ||
${CURRENT_SOURCE_DIR}/ProtoServer.cpp | ||
) | ||
|
||
# disable warnings for auto generated proto files, we can't change the files .... | ||
SET_SOURCE_FILES_PROPERTIES ( ${ProtoServer_PROTO_SRCS} ${ProtoServer_PROTO_HDRS} ${ProtoServer_PROTOS} PROPERTIES COMPILE_FLAGS -w ) | ||
|
||
target_link_libraries(protoclient | ||
hyperhdr-base | ||
hyperhdr-utils | ||
${PROTOBUF_LIBRARY} | ||
Qt${Qt_VERSION}::Gui | ||
) | ||
|
||
target_link_libraries(protoserver | ||
hyperhdr-base | ||
hyperhdr-utils | ||
protoclient | ||
Qt${Qt_VERSION}::Gui | ||
) |
Oops, something went wrong.