Read about our upcoming Code of Conduct on this issue

This instance will be upgraded to Heptapod 0.28.0 on 2022-01-18 at 14:00 UTC+1 (a few minutes of down time)

Commit 924847fd authored by aivan_2008's avatar aivan_2008
Browse files

Updated decoder and Tcp Client/Server. OpenProject command is broken now.

--HG--
branch : ClientServerQt
parent b4800ae10874
......@@ -128,12 +128,12 @@ bool URpcDecoderCommon::IsCmdSupported(const UEPtr<URpcCommand> &command) const
else
if(cmd == "LoadProject")
{
return true;
return false;
}
else
if(cmd == "SaveProject")
{
return true;
return false;
}
else
if(cmd == "ReadImageFromVideoSource")
......@@ -318,6 +318,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
int port=xml.ReadInteger("Port",1000);
return_value=GetApplication()->GetServerControl()->UnRegisterMetadataReceiver(address, port);
}
/*
else
if(cmd == "LoadProject")
{
......@@ -334,7 +335,7 @@ const char* URpcDecoderCommon::RemoteCall(const char *request, int &return_value
{
GetApplication()->SaveProject();
return_value=0;//UServerControlForm->SaveProject();
}
}*/
}
// }
......
......@@ -268,7 +268,7 @@ void UGEngineControllWidget::loadProjectExternal(const QString &config_path)
/*QStringList list = configFileName.split("/");
list.pop_back();*/
RDK::UIVisualControllerStorage::UpdateInterface(true);
//RDK::UIVisualControllerStorage::UpdateInterface(true);
//drawEngine->updateScheme(true);
}
catch(RDK::UException& e)
......
......@@ -2,8 +2,8 @@
#define UTcpServerControlWidget_CPP
#include "UTcpServerControlWidget.h"
#include "UGEngineControllWidget.h"
#include "ui_UTcpServerControlWidget.h"
#include "UGEngineControllWidget.h"
#include <QTcpSocket>
......@@ -618,6 +618,164 @@ void UServerControlQt::AfterCalculate(void)
// --------------------------
//==========================================================================================
// --------------------------
//
// --------------------------
URpcDecoderCommonQt::URpcDecoderCommonQt(void):
engine(0)
{
}
URpcDecoderCommonQt::~URpcDecoderCommonQt(void)
{
}
// --------------------------
// --------------------------
//
// --------------------------
/// ,
/// , false
bool URpcDecoderCommonQt::IsCmdSupported(const RDK::UEPtr<RDK::URpcCommand> &command) const
{
if(!command || !command->IsDecoded)
return false;
std::string cmd=command->FunctionName;
if(cmd == "LoadProject")
{
return true;
}
else
if(cmd == "SaveProject")
{
return true;
}
return URpcDecoderCommon::IsCmdSupported(command);
}
///
URpcDecoderCommonQt* URpcDecoderCommonQt::New(void)
{
return new URpcDecoderCommonQt;
}
std::string URpcDecoderCommonQt::ARemoteCall(const std::string &cmd, RDK::USerStorageXML &xml, const std::string &component_name, int channel_index, int &return_value)
{
ControlResponseString.clear();
RDK::USerStorageXML result;
result.Create("RpcResponse");
result.WriteString("Id", xml.ReadString("Id",""));
if(cmd == "GetChannelVideoSource")
{
return_value=1;
}
else
if(cmd == "SetChannelVideoSource")
{
return_value=1;
}
else
if(cmd == "CheckChannelVideoSourceConnection")
{
//result.WriteInteger("State",UServerControlForm->CheckChannelVideoSourceConnection(channel_index));
result.WriteInteger("State",-1);
return_value=1;
}
else
if(cmd == "GetChannelBroacaster")
{
int type=xml.ReadInteger("BroadcasterType",0);
result.SelectNodeForce("Data");
result.SelectUp();
return_value=0;
}
else
if(cmd == "SetChannelBroadcaster")
{
//int type=xml.ReadInteger("BroadcasterType",0);
//result.WriteInteger("BroadcasterType",type);
return_value=1;
}
else
if(cmd == "ReadImageFromVideoSource")
{
return_value=1;
}
else
if(cmd == "StartVideoSource")
{
return_value=1;
}
else
if(cmd == "StopVideoSource")
{
return_value=1;
}
else
if(cmd == "LoadProject")
{
std::string file_name=xml.ReadString("FileName","");
if(!file_name.empty())
{
//GetApplication()->OpenProject(file_name);
//RDK::UIVisualControllerStorage::UpdateInterface(true);
if(!engine)
{
return_value=1;
}
else
{
UGEngineControllWidget* eng = dynamic_cast<UGEngineControllWidget*>(engine);
eng->loadProjectExternal(QString(file_name.c_str()));
return_value=0;
}
//UServerControlForm->LoadProject(channel_index,file_name);
}
}
else
if(cmd == "SaveProject")
{
//GetApplication()->SaveProject();
if(!engine)
{
return_value=1;
}
else
{
UGEngineControllWidget* eng = dynamic_cast<UGEngineControllWidget*>(engine);
eng->actionSaveConfig();
return_value=0;
}
//return_value=0;//UServerControlForm->SaveProject();
}
else
return_value=2001;
if(return_value=2001)
{
return URpcDecoderCommon::ARemoteCall(cmd, xml, component_name, channel_index, return_value);
}
return ControlResponseString;
}
// --------------------------
void URpcDecoderCommonQt::SetEngine(QMainWindow* e)
{
engine = e;
}
QMainWindow* URpcDecoderCommonQt::GetEngine()
{
return engine;
}
//==========================================================================================
UTcpServerControlWidget::UTcpServerControlWidget(QWidget *parent, RDK::UApplication *app) :
......
......@@ -3,6 +3,7 @@
#include "UVisualControllerWidget.h"
#include "../../Core/Application/UServerTransportTcp.h"
#include <QMainWindow>
#include <QTcpServer>
#include <QTcpSocket>
......@@ -112,8 +113,48 @@ virtual void AfterReset(void);
// ,
virtual void AfterCalculate(void);
// --------------------------
};
class URpcDecoderCommonQt: public RDK::URpcDecoderCommon
{
///
std::string ControlResponseString;
std::vector<RDK::UParamT> binary_data;
public:
// --------------------------
//
// --------------------------
URpcDecoderCommonQt(void);
virtual ~URpcDecoderCommonQt(void);
// --------------------------
// --------------------------
//
// --------------------------
/// ,
/// , false
virtual bool IsCmdSupported(const RDK::UEPtr<RDK::URpcCommand> &command) const;
///
virtual URpcDecoderCommonQt* New(void);
virtual std::string ARemoteCall(const std::string &cmd, RDK::USerStorageXML &xml, const std::string &component_name, int engine_index, int &return_value);
void SetEngine(QMainWindow* e);
QMainWindow* GetEngine();
// --------------------------
private:
QMainWindow *engine;
};
namespace Ui {
class UTcpServerControlWidget;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment