Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • silecs/opensilecs
  • k.fugiel/opensilecs
  • s.kupiecki/opensilecs
3 results
Show changes
// Copyright 2016 CERN and GSI
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
Copyright (c) 2017 European Organization for Nuclear Research (CERN).
All rights reserved. This program and the accompanying materials
are made available under the terms of the GNU Public License v3.0
which accompanies this distribution, and is available at
http://www.gnu.org/licenses/gpl.html
Contributors:
.European Organization for Nuclear Research (CERN) - initial API and implementation
.GSI Helmholtzzentrum für Schwerionenforschung (GSI) - features and bugfixes
*/
#include <silecs-communication/wrapper/DeployUnit.h>
......@@ -43,14 +41,13 @@ void DeployConfig::setAutomaticConnect(bool automaticConnect)
DeployUnit* DeployUnit::_instance = NULL;
//SilecsWrapper::DeployConfig DeployUnit::_globalConfig = SilecsWrapper::DeployConfig();
DeployUnit::DeployUnit(const std::string& name, const std::string& version, const std::string& logTopics,const DeployConfig& globalConfig) :
DeployUnit::DeployUnit(const std::string& name, const std::string& version, const std::string& logTopics, const DeployConfig& globalConfig) :
_name(name),
_version(version),
_globalConfig(globalConfig)
{
// Process log topics
char *argv[2] =
{ (char *) "-plcLog", const_cast<char*>(logTopics.c_str()) };
char *argv[2] = {(char *)"-plcLog", const_cast<char*>(logTopics.c_str())};
// Get singleton instance
_silecsService = Silecs::Service::getInstance(2, argv);
......@@ -95,4 +92,4 @@ DeployUnit::~DeployUnit()
}
}
//namespace SilecsWrapper
//namespace SilecsWrapper
// Copyright 2016 CERN and GSI
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
Copyright (c) 2017 European Organization for Nuclear Research (CERN).
All rights reserved. This program and the accompanying materials
are made available under the terms of the GNU Public License v3.0
which accompanies this distribution, and is available at
http://www.gnu.org/licenses/gpl.html
Contributors:
.European Organization for Nuclear Research (CERN) - initial API and implementation
.GSI Helmholtzzentrum für Schwerionenforschung (GSI) - features and bugfixes
*/
#ifndef SILECSWRAPER_DEPLOY_UNIT_H_
#define SILECSWRAPER_DEPLOY_UNIT_H_
......@@ -23,49 +21,48 @@
namespace SilecsWrapper
{
class DeployConfig
{
public:
DeployConfig();
DeployConfig(bool automaticConnect);
bool getAutomaticConnect() const;
void setAutomaticConnect(bool automaticConnect);
class DeployConfig
{
public:
DeployConfig();
DeployConfig(bool automaticConnect);
bool getAutomaticConnect() const;
void setAutomaticConnect(bool automaticConnect);
private:
bool _automaticConnect;
private:
bool _automaticConnect;
};
};
class DeployUnit
{
public:
DeployUnit(const std::string& name, const std::string& version, const std::string& logTopics,
const DeployConfig& globalConfig);
virtual ~DeployUnit();
class DeployUnit
{
public:
DeployUnit(const std::string& name, const std::string& version, const std::string& logTopics, const DeployConfig& globalConfig);
virtual ~DeployUnit();
void deleteInstance();
void deleteInstance();
const std::string& getName() const;
const std::string& getVersion() const;
Silecs::Service* getService() const;
const std::string& getName() const;
const std::string& getVersion() const;
Silecs::Service* getService() const;
DeployConfig& getGlobalConfig();
void setGlobalConfig(DeployConfig& globalConfig);
void setGlobalConfig(DeployConfig& globalConfig);
protected:
const std::string _name;
const std::string _version;
protected:
const std::string _name;
const std::string _version;
DeployConfig _globalConfig;
Silecs::Service* _silecsService;
//singleton instance
static DeployUnit* _instance;
Silecs::Service* _silecsService;
//singleton instance
static DeployUnit* _instance;
private:
// Non copyable
DeployUnit(const DeployUnit& other);
DeployUnit& operator=(const DeployUnit&);
private:
// Non copyable
DeployUnit(const DeployUnit& other);
DeployUnit& operator=(const DeployUnit&);
};
};
} //namespace SilecsWrapper
......
// Copyright 2016 CERN and GSI
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
Copyright (c) 2017 European Organization for Nuclear Research (CERN).
All rights reserved. This program and the accompanying materials
are made available under the terms of the GNU Public License v3.0
which accompanies this distribution, and is available at
http://www.gnu.org/licenses/gpl.html
Contributors:
.European Organization for Nuclear Research (CERN) - initial API and implementation
.GSI Helmholtzzentrum für Schwerionenforschung (GSI) - features and bugfixes
*/
#include <silecs-communication/interface/equipment/SilecsPLC.h>
#include <silecs-communication/wrapper/DeployUnit.h>
#include <silecs-communication/wrapper/Design.h>
#include <silecs-communication/interface/utility/SilecsException.h>
namespace SilecsWrapper
{
......@@ -23,9 +22,9 @@ namespace SilecsWrapper
Design::Design(const std::string& name, const std::string& version, DeployUnit *deployUnit) :
_name(name),
_version(version),
_deployUnit(deployUnit)
_deployUnit(deployUnit),
_silecsPLCHandler(deployUnit->getService()->getPLCHandler())
{
_silecsCluster = _deployUnit->getService()->getCluster(_name, _version);
}
Design::~Design()
......@@ -43,9 +42,9 @@ const std::string& Design::getVersion() const
return _version;
}
Silecs::Cluster* Design::getSilecsCluster() const
Silecs::PLCHandler& Design::getSilecsPLCHandler() const
{
return _silecsCluster;
return _silecsPLCHandler;
}
DeployUnit* Design::getDeployUnit() const
......@@ -53,26 +52,4 @@ DeployUnit* Design::getDeployUnit() const
return _deployUnit;
}
void Design::setConfiguration(const DesignConfig& configuration)
{
Silecs::plcMapType plcMap = _silecsCluster->getPLCMap();
Silecs::plcMapType::iterator plcMapIter;
for (plcMapIter = plcMap.begin(); plcMapIter != plcMap.end(); ++plcMapIter)
{
//if (plcMapIter->second->isConnected({*connectNow = *}false))
if (plcMapIter->second->isEnabled())
{
//at least one PLC is already enabled (PLC object created). Does not make sense to set configuration after.
throw Silecs::SilecsException(__FILE__, __LINE__, Silecs::COMM_ALREADY_ENABLED,
std::string("Design configuration must be set before instantiating any controller! Disable the 'Automatic connect' flag of the deploy configuration if needed."));
}
}
_silecsCluster->configuration = configuration;
}
const DesignConfig& Design::getConfiguration()
{
return _silecsCluster->configuration;
}
} //namespace SilecsWrapper
// Copyright 2016 CERN and GSI
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
Copyright (c) 2017 European Organization for Nuclear Research (CERN).
All rights reserved. This program and the accompanying materials
are made available under the terms of the GNU Public License v3.0
which accompanies this distribution, and is available at
http://www.gnu.org/licenses/gpl.html
Contributors:
.European Organization for Nuclear Research (CERN) - initial API and implementation
.GSI Helmholtzzentrum für Schwerionenforschung (GSI) - features and bugfixes
*/
#ifndef SILECSWRAPER_DESIGN_H_
#define SILECSWRAPER_DESIGN_H_
#include <silecs-communication/interface/equipment/SilecsCluster.h>
#include <silecs-communication/interface/equipment/SilecsPLCHandler.h>
#include <silecs-communication/wrapper/DeployUnit.h>
#include <string>
......@@ -26,8 +24,6 @@ namespace SilecsWrapper
class DeployUnit;
class Controller;
typedef Silecs::ClusterConfig DesignConfig;
class Design
{
public:
......@@ -37,21 +33,17 @@ public:
const std::string& getVersion() const;
Silecs::Cluster* getSilecsCluster() const;
Silecs::PLCHandler& getSilecsPLCHandler() const;
DeployUnit* getDeployUnit() const;
void setConfiguration(const DesignConfig& configuration);
const DesignConfig& getConfiguration();
virtual ~Design();
protected:
const std::string _name;
const std::string _version;
DeployUnit* _deployUnit;
Silecs::Cluster* _silecsCluster;
Silecs::PLCHandler& _silecsPLCHandler;
const DeployConfig _config;
private:
......
// Copyright 2016 CERN and GSI
//
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program. If not, see <http://www.gnu.org/licenses/>.
/*
Copyright (c) 2017 European Organization for Nuclear Research (CERN).
All rights reserved. This program and the accompanying materials
are made available under the terms of the GNU Public License v3.0
which accompanies this distribution, and is available at
http://www.gnu.org/licenses/gpl.html
Contributors:
.European Organization for Nuclear Research (CERN) - initial API and implementation
.GSI Helmholtzzentrum für Schwerionenforschung (GSI) - features and bugfixes
*/
#ifndef SILECSWRAPER_DEVICE_H_
#define SILECSWRAPER_DEVICE_H_
......
cmake_minimum_required(VERSION 3.20.2)
project(silecs-diagnostic LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
# TODO: Which of these compiler options are actually required?
add_compile_options(
-Wall
-Wextra
-D_REENTRANT
-DQT_NO_DEBUG_OUTPUT
-DQT_NO_WARNING_OUTPUT
-DQT_NO_DEBUG
-DQT_GUI_LIB
-DQT_CORE_LIB
-DQT_SHARED
-DQT_WIDGETS_LIB
-fstack-protector
--param=ssp-buffer-size=4
-mtune=generic)
find_package(Qt5 COMPONENTS Widgets Core REQUIRED)
file(GLOB_RECURSE SOURCES ${PROJECT_SOURCE_DIR}/src/silecs-diagnostic/*.cpp)
add_executable(${PROJECT_NAME}
${SOURCES}
src/silecs-diagnostic/resources/images.qrc
src/silecs-diagnostic/resources/gui/diagnostictoolmainview.ui
src/silecs-diagnostic/resources/gui/displayarraydialog.ui
src/silecs-diagnostic/resources/gui/logindialog.ui
)
target_include_directories(${PROJECT_NAME}
PRIVATE
${PROJECT_SOURCE_DIR}/src
)
target_link_libraries(${PROJECT_NAME} Qt5::Widgets Qt5::Core silecs-comm)
install(
TARGETS ${PROJECT_NAME}
DESTINATION ${CMAKE_PROJECT_VERSION}/silecs-diagnostic-cpp/bin/${BUILD_TARGET}
)
install(
DIRECTORY ${PROJECT_SOURCE_DIR}/src/silecs-diagnostic/resources
DESTINATION ${CMAKE_PROJECT_VERSION}/silecs-diagnostic-cpp/
)