Remove unnecessary line from cmakelists
Restructure project for better include semantics
Fix missing include in cmakelists
This is a client framework you can use for json-rpc v2.0 communications in your project using Qt data types.
The library makes use of the generic QIODevice
for the communication, which means it should upport any generic communication protocol supported by Qt.
See the QIODevice documentation for more details on protocols available.
Only the Qt libraries.
#include <QString>
#include <QProcess>
#include <QStringList>
#include <QProcessEnvironment>
#include <QJsonValue>
#include <QJsonArray>
#include <memory>
#include <QJsonRpcClient/qjsonrpcclient.h>
// ...
auto process = std::make_unique<QProcess>();
p->setProcessEnvironment( QProcessEnvironment::systemEnvironment() );
p->setProgram( "/path/to/rpc-server" );
p->setArguments( { "server_arg_1", "server_arg_2" } );
if ( p->waitForStarted() ) {
QJsonRpcClient rpcClient = std::make_unique<QJsonRpcClient>( std::move( p ) );
int defaultResult = 0;
QJsonValue result = rpcClient->callMethod( "add", QJsonArray{ 1, 2 } );
std::cout << result.toInt( defaultResult ) << std::endl;
}