├── .CI ├── CI_summary.html ├── run_test_case.py ├── test_cases │ ├── test_async_methods │ │ ├── Design.xml │ │ ├── config.xml │ │ ├── description.txt │ │ └── generate_test_design_methods.py │ ├── test_cache_variables │ │ ├── DTestClass.test.cpp │ │ ├── DTestClass.test.h │ │ ├── Design.xml │ │ ├── config.xml │ │ ├── description.txt │ │ ├── generate_test_design_cache_variables.py │ │ └── reference_ns2.xml │ ├── test_calculated_variables │ │ ├── Design.xml │ │ ├── config.xml │ │ └── reference_ns2.xml │ ├── test_config_entries │ │ ├── Design.xml │ │ ├── config.xml │ │ ├── generate_test_design_config_entries.py │ │ └── reference_ns2.xml │ ├── test_config_restrictions │ │ ├── Design.xml │ │ └── generate_test_design_config_restrictions.py │ ├── test_default_quasar_design │ │ └── reference_ns2.xml │ ├── test_defaulted_instance_name │ │ ├── Design.xml │ │ ├── config.xml │ │ └── reference_ns2.xml │ ├── test_instantiation_from_design │ │ ├── Design.xml │ │ ├── config.xml │ │ ├── description.txt │ │ └── reference_ns2.xml │ ├── test_methods │ │ ├── Design.xml │ │ ├── config.xml │ │ ├── description.txt │ │ ├── generate_test_design_methods.py │ │ └── reference_ns2.xml │ ├── test_recurrent_hasobjects │ │ ├── Design.xml │ │ └── config.xml │ ├── test_single_variable_node │ │ ├── Design.xml │ │ ├── config.xml │ │ └── description.txt │ └── test_source_variables │ │ ├── Design.xml │ │ ├── config.xml │ │ ├── description.txt │ │ ├── generate_test_design_source_variables.py │ │ └── reference_ns2.xml └── travis │ ├── build_configs │ └── uasdk-eval.cmake │ ├── non_public_tests.yml │ ├── run_all_travis_tests_locally.py │ └── server_fixture.py ├── .github └── workflows │ └── deploy_documentation.yml ├── .gitignore ├── .gitmodules ├── .travis.yml ├── AddressSpace ├── CMakeLists.txt ├── include │ ├── ASCommon.h │ ├── ASDelegatingMethod.h │ ├── ASDelegatingVariable.h │ ├── ASNodeManager.h │ ├── ASNodeQueries.h │ ├── ASSourceVariable.h │ ├── ASSourceVariableIoManager.h │ ├── ArrayTools.h │ ├── ChangeNotifyingVariable.h │ └── FreeVariablesEngine.h ├── src │ ├── ASNodeManager.cpp │ ├── ASSourceVariableIoManager.cpp │ ├── ArrayTools.cpp │ ├── ChangeNotifyingVariable.cpp │ └── FreeVariablesEngine.cpp └── templates │ ├── designToAddressSpaceDocHtml.jinja │ ├── designToAddressSpaceDocMd.jinja │ ├── designToClassBody.jinja │ ├── designToClassHeader.jinja │ ├── designToGeneratedCmakeAddressSpace.jinja │ ├── designToInformationModelBody.jinja │ ├── designToInformationModelHeader.jinja │ ├── designToSourceVariablesBody.jinja │ └── designToSourceVariablesHeader.jinja ├── CMakeLists.txt ├── CalculatedVariables ├── CMakeLists.txt ├── doc │ ├── CalculatedVariables.html │ ├── CalculatedVariablesClassDiagram.png │ ├── SynchronizationExample.odg │ ├── SynchronizationExample.png │ └── sample_design.png ├── ext_components │ ├── amalgamate_header.json │ ├── clone_and_amalgamate_muparser.sh │ └── muparser-amalgamated │ │ ├── include │ │ └── muParser.h │ │ └── src │ │ └── muParser.cpp ├── include │ ├── CalculatedVariable.h │ ├── CalculatedVariablesChangeListener.h │ ├── CalculatedVariablesEngine.h │ ├── CalculatedVariablesLogComponentId.h │ ├── ParserVariable.h │ └── ParserVariableRequestUserData.h └── src │ ├── CalculatedVariable.cpp │ ├── CalculatedVariablesChangeListener.cpp │ ├── CalculatedVariablesEngine.cpp │ └── ParserVariable.cpp ├── Common ├── CMakeLists.txt ├── include │ ├── ASUtils.h │ ├── QuasarThreadPool.h │ └── Utils.h ├── src │ ├── ASUtils.cpp │ └── QuasarThreadPool.cpp ├── templates │ └── headers.jinja └── test │ └── test_quasar_threadpool.cpp ├── Configuration ├── CMakeLists.txt ├── Configurator.h ├── include │ └── ConfigurationDecorationUtils.h └── templates │ ├── designToConfigDocumentationHtml.jinja │ ├── designToConfigDocumentationMd.jinja │ ├── designToConfigValidator.jinja │ ├── designToConfigurationXSD.jinja │ └── designToConfigurator.jinja ├── Design ├── Design.xml ├── Design.xsd ├── quasarVersion.txt └── templates │ └── designToDot.jinja ├── Device ├── CMakeLists.txt ├── DeviceCustom.cmake └── templates │ ├── commonDeviceTemplates.jinja │ ├── designToDeviceBaseBody.jinja │ ├── designToDeviceBaseHeader.jinja │ ├── designToDeviceBody.jinja │ ├── designToDeviceHeader.jinja │ ├── designToGeneratedCmakeDevice.jinja │ ├── designToGeneratedCmakeDeviceBase.jinja │ ├── designToRootBody.jinja │ └── designToRootHeader.jinja ├── Documentation ├── Addons │ └── prepare.sh ├── Doxyfile ├── External │ ├── diagram.png │ ├── enice_win_configuration.cmake │ ├── transformations.odg │ ├── transformations.pdf │ └── variable_types.png ├── Makefile ├── Notes │ ├── Main_restructuring.odt │ ├── Main_restructuring_UML.xmi │ ├── Open62541_UaToolkit_compat.png │ ├── Open62541_UaToolkit_compat.xmi │ ├── QuasarThreadPoolScheduling.pdf │ ├── open62541_vs_uatoolkit.odt │ ├── open62541_vs_uatoolkit.pdf │ ├── quasarSanitizers.pdf │ └── quasar_files_txt_proposal.pdf ├── make.bat ├── quasarCommands.html ├── requirements.txt ├── source │ ├── AlternativeBackends.rst │ ├── CalculatedVariables.rst │ ├── ChangeLog.rst │ ├── DesignManual.rst │ ├── LogIt.rst │ ├── UserDefinedCommandLineParameters.rst │ ├── UserDefinedRuntimeConfigurationModification.rst │ ├── WindowsSetup.rst │ ├── _init_ext.rst │ ├── _init_index.rst │ ├── _init_notes.rst │ ├── _static │ │ ├── css │ │ │ └── default.css │ │ ├── favicon.ico │ │ ├── js │ │ │ └── doc-version.js │ │ ├── quasar_logo.png │ │ └── versions.json │ ├── conf.py │ ├── external_files.rst │ ├── forQuasarDevelopers.rst │ ├── images │ │ ├── CalculatedVariablesClassDiagram.png │ │ ├── SynchronizationExample.png │ │ ├── diagram.png │ │ ├── opc-ua-items-for-logging-verbosity.PNG │ │ ├── quasar_engine_small_smooth_square_128x128.png │ │ ├── quasar_logo.ai │ │ ├── sample_design.png │ │ └── variable_types.png │ ├── index.rst │ ├── notes_files.rst │ ├── quasar.rst │ ├── quasarBuildSystem.rst │ ├── quasarCommands.rst │ ├── quasar_OPC_UA_servers.rst │ ├── yocto.rst │ └── youtube_links.rst └── tools │ └── update_versions.py ├── Extra └── yocto │ ├── CMakeEpilogue.cmake │ ├── my-opcua-server.bb │ ├── pygit2_0.24.1.bb │ ├── python-enum34_1.1.6.bb │ ├── xsd_4.0.0.bb │ └── yocto_open62541_config.cmake ├── FrameworkInternals ├── BoostSetup.cmake ├── DesignInspector.py ├── DesignValidator.py ├── EnabledModules │ ├── open62541-compat.minVersion │ ├── open62541-compat.tag │ └── open62541-compat.url ├── OptionalModule.cmake ├── OptionalModules.cmake ├── Oracle.py ├── UrlHandling.cmake ├── addressSpaceGenerators.py ├── automated_build.py ├── commandMap.py ├── configurationGenerators.py ├── convert_files_to_json.py ├── create_release.sh ├── default_configuration.cmake ├── designTools.py ├── deviceGenerators.py ├── distclean.py ├── externalToolCheck.py ├── files.txt ├── generateCmake.py ├── generateHonkyTonk.py ├── install_framework.py ├── manage_files.py ├── merge_design_and_meta.py ├── meta_build_info.py ├── optionalModules.py ├── original_files.txt ├── parser_module.py ├── quasarCommands.py ├── quasarExceptions.py ├── quasar_basic_utils.py ├── quasar_utils.py ├── release_nebula.py ├── runDoxygen.py ├── transformDesign.py ├── transform_filters.py └── version_control_interface.py ├── LICENSE.TXT ├── Meta ├── CMakeLists.txt ├── design │ └── meta-design.xml ├── include │ ├── DLogLevel.h │ ├── DSourceVariableThreadPool.h │ ├── MetaBuildInfo.h │ ├── meta.h │ └── metaBackwardsCompatibilityUtils.h └── src │ ├── DLogLevel.cpp │ ├── DSourceVariableThreadPool.cpp │ ├── MetaBuildInfo.cpp │ ├── meta.cpp │ └── metaBackwardsCompatibilityUtils.cpp ├── ProjectSettings.cmake ├── README.md ├── Server ├── CMakeLists.txt ├── include │ ├── BaseQuasarServer.h │ ├── OpcuaToolkitInfo.hpp.in │ ├── QuasarServer.h │ ├── QuasarUaTraceHook.hpp │ ├── QuasarVersion.h │ ├── opcserver.h │ ├── opcserver_open62541.h │ ├── serverconfigxml_quasar.h │ ├── shutdown.h │ └── version.h └── src │ ├── BaseQuasarServer.cpp │ ├── QuasarServer.cpp │ ├── QuasarUaTraceHook.cpp │ ├── main.cpp │ ├── opcserver.cpp │ ├── opcserver_open62541.cpp │ ├── serverconfigxml.cpp │ └── shutdown.cpp ├── bin ├── ServerConfig.xml ├── ServerConfig.xsd └── config.xml ├── cmake ├── FindOpcUaToolkit.cmake └── QuasarSanitizers.cmake ├── open62541_config.cmake ├── open6_win_configuration.cmake ├── python_requirements.txt └── quasar.py /.CI/CI_summary.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | quasar CI summary 7 | 8 | 9 |

CI stages for quasar CI testing

10 |
11 |
12 |
13 |
14 |

Test cases

15 |
16 | 17 | 18 | 19 | 21 | 23 | 25 | 27 | 28 | 29 | 31 | 33 | 35 | 36 | 37 | 38 | 40 | 42 | 44 | 45 | 46 | 47 | 49 | 52 | 54 | 56 | 57 | 58 | 60 | 62 | 64 | 65 | 66 | 67 | 69 | 70 | 72 | 75 | 76 | 77 | 79 | 80 | 82 | 84 | 85 | 86 | 88 | 89 | 91 | 93 | 94 | 95 | 97 | 98 | 99 | 101 | 102 | 103 |
test case name
20 |
For open62541-compat?
22 |
For UA-SDK?
24 |
Reference nodeset validation?
26 |
default_quasar_design
30 |

32 |

34 |
cache_variables
39 |

41 |

43 |
source_variables
48 |
- (no support in 50 | open62541-compat)
51 |

53 |
-
55 |
config_entries
59 |

61 |

63 |
methods
68 |
✓ (sync and async variants)
71 |
(used only for UA-SDK, see 73 | OPCUA-2353)
74 |
recurrent_hasobjects
78 |
-
81 |
-
83 |
single_variable_node
87 |
-
90 |
-
92 |
instantiation_from_design
96 |
--
100 |
104 |
105 | 106 | 107 | -------------------------------------------------------------------------------- /.CI/run_test_case.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | 3 | #TODO authors etc 4 | import os 5 | import argparse 6 | import shutil 7 | import sys 8 | from colorama import Fore, Style 9 | 10 | def invoke_and_check(cmd): 11 | print(f'{Fore.BLUE}{Style.BRIGHT}Will invoke{Style.RESET_ALL} {cmd}') 12 | ret_val = os.system(cmd) 13 | if ret_val != 0: 14 | raise Exception (f'Stopping because the command {cmd} returned wrong return value of {ret_val}') 15 | 16 | def clone_quasar(test_branch): 17 | invoke_and_check(f'git clone --recursive -b {test_branch} --depth=1 https://github.com/quasar-team/quasar.git') 18 | os.chdir('quasar') 19 | 20 | def prepare_opcua_backend(opcua_backend, open62541_compat_branch): 21 | if opcua_backend == 'o6': 22 | invoke_and_check(f'./quasar.py enable_module open62541-compat {open62541_compat_branch}') 23 | invoke_and_check(f'./quasar.py set_build_config open62541_config.cmake') 24 | elif opcua_backend == 'uasdk': 25 | invoke_and_check('./quasar.py set_build_config .CI/travis/build_configs/uasdk-eval.cmake') 26 | else: 27 | raise Exception(f"OPCUA backend {opcua_backend} was not recognized") 28 | 29 | def build(): 30 | invoke_and_check('./quasar.py build Release') 31 | 32 | def run_and_dump_address_space(): 33 | invoke_and_check('./.CI/travis/server_fixture.py --command_to_run uasak_dump') 34 | 35 | def compare_with_nodeset(reference_ns): 36 | invoke_and_check(f'/opt/NodeSetTools/nodeset_compare.py {reference_ns} build/bin/dump.xml --ignore_nodeids StandardMetaData') 37 | 38 | def main(): 39 | parser = argparse.ArgumentParser() 40 | 41 | parser.add_argument('--clone', action='store_true') 42 | parser.add_argument('--quasar_branch', default='master') 43 | parser.add_argument('--opcua_backend') 44 | parser.add_argument('--open62541_compat_branch') 45 | parser.add_argument('--design', default=None) 46 | parser.add_argument('--config', default=None) 47 | parser.add_argument('--compare_with_nodeset', default=None) 48 | parser.add_argument('--generate_all_devices', action='store_true') 49 | args = parser.parse_args() 50 | 51 | if args.clone: 52 | clone_quasar(args.quasar_branch) 53 | 54 | prepare_opcua_backend(args.opcua_backend, args.open62541_compat_branch) 55 | 56 | if args.design: 57 | shutil.copyfile(args.design, 'Design/Design.xml') 58 | 59 | if args.generate_all_devices: 60 | invoke_and_check('./quasar.py generate device --all') 61 | 62 | build() 63 | 64 | if args.config: 65 | shutil.copyfile(args.config, 'build/bin/config.xml') 66 | 67 | run_and_dump_address_space() 68 | if args.compare_with_nodeset: 69 | compare_with_nodeset(args.compare_with_nodeset) 70 | 71 | print('a') 72 | pass 73 | 74 | if __name__ == "__main__": 75 | try: 76 | main() 77 | except Exception as ex: 78 | print(f'{Fore.RED}Caught exception{Style.RESET_ALL} {str(ex)}, returning as failed') 79 | sys.exit(1) 80 | -------------------------------------------------------------------------------- /.CI/test_cases/test_async_methods/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.CI/test_cases/test_async_methods/description.txt: -------------------------------------------------------------------------------- 1 | In this test case, 2 | we try to test all method/functions signatures regarding methods, call paths etc... 3 | 4 | 5 | We therefore have a test case where a list of methods is declared per class, 6 | each method has between 0..2 arguments and 0..2 return values, each of different 7 | data type, variation of scalar/included. 8 | 9 | This is a variant of test_methods besides we do everything asynchronous. 10 | 11 | 12 | Pass criteria 13 | ------------- 14 | Successful build. 15 | -------------------------------------------------------------------------------- /.CI/test_cases/test_async_methods/generate_test_design_methods.py: -------------------------------------------------------------------------------- 1 | from Oracle import Oracle 2 | import random 3 | 4 | def create_scenario_name(num_args, num_rvs, it): 5 | return 'args{0}_rvs{1}_it{2}'.format(num_args, num_rvs, it) 6 | 7 | f=open('Design.out', 'w') 8 | 9 | 10 | def output(s): 11 | f.write(s) 12 | f.write('\n') 13 | print(s) 14 | 15 | 16 | 17 | def make_dts(): 18 | dts = [] 19 | for basicDataType in Oracle.AllQuasarDataTypes: 20 | for scalarArray in ['scalar', 'array']: 21 | dts.append({'scalarArray':scalarArray, 'dataType':basicDataType}) 22 | return dts 23 | 24 | 25 | 26 | def get_dts(dts): 27 | #random.shuffle(dts) #<-- not good for repetitivity of conditions 28 | return dts.pop() 29 | 30 | 31 | def generate(): 32 | # below is list of data types that we want to use for testing as types of arguments or return values 33 | # as scalars and arrays 34 | # None will be interpreted as no argument or no return value 35 | 36 | dts_args = make_dts() 37 | dts_rvs = make_dts() 38 | 39 | Num_arguments = [0, 1, 2] 40 | Num_return_values = [0, 1, 2] 41 | Random_Options = ['no', 'of_this_method', 'of_containing_object'] 42 | it = 0 43 | try: 44 | while it<10: 45 | for num_arguments in Num_arguments: 46 | for num_return_values in Num_return_values: 47 | scenario_name = create_scenario_name(num_arguments, num_return_values, it) 48 | output(f'') 49 | for arg in range(0, num_arguments): 50 | dt = get_dts(dts_args) 51 | output(''.format(arg, dt['dataType']) ) 52 | if dt['scalarArray'] == 'array': 53 | output('') 54 | output ('') 55 | for rv in range(0, num_return_values): 56 | dt = get_dts(dts_rvs) 57 | output(''.format(rv, dt['dataType']) ) 58 | if dt['scalarArray'] == 'array': 59 | output('') 60 | output ('') 61 | output('') 62 | it += 1 63 | except IndexError: 64 | output('') 65 | pass # this is expected, we just want to saturate the collection... 66 | 67 | 68 | 69 | output('') 70 | output('') 71 | output('') 72 | output('') 73 | generate() 74 | output('') 75 | output('') 76 | output('') 77 | output('') 78 | output('') 79 | -------------------------------------------------------------------------------- /.CI/test_cases/test_cache_variables/description.txt: -------------------------------------------------------------------------------- 1 | In this test case, 2 | we try to generate the space of all possible cache-variables from the following 3 | variables: 4 | - scalars and arrays: both 5 | - initializers from configuration as well as using valueAndStatus 6 | - all known quasar data types, restricting to legal combinations (for example, 7 | arrays are not legal in valueAndStatus) 8 | - with forbidden write as well as with write delegates 9 | 10 | There is one class (TestClass) with Device Logic. 11 | 12 | 13 | Pass criteria 14 | ------------- 15 | Successful build. 16 | -------------------------------------------------------------------------------- /.CI/test_cases/test_calculated_variables/Design.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | -------------------------------------------------------------------------------- /.CI/test_cases/test_calculated_variables/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 12 | 13 | 14 | 15 | 16 | 17 | 19 | 21 | 22 | 23 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /.CI/test_cases/test_config_entries/Design.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | 49 | 50 | 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /.CI/test_cases/test_config_entries/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 8 | 9 | true 10 | false 11 | true 12 | 13 | 14 | 66 15 | 67 16 | 68 17 | 18 | 19 | -66 20 | -67 21 | -68 22 | 23 | 24 | 6666 25 | 6667 26 | 6668 27 | 28 | 29 | -6666 30 | -6667 31 | -6668 32 | 33 | 34 | 6666 35 | 6667 36 | 6668 37 | 38 | 39 | -6666 40 | -6667 41 | -6668 42 | 43 | 44 | 666666 45 | 666667 46 | 666668 47 | 48 | 49 | -666666 50 | -666667 51 | -666668 52 | 53 | 54 | 1.23456789 55 | 56 | 57 | 1.234 58 | 59 | 60 | abcdef 61 | rst 62 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /.CI/test_cases/test_config_entries/generate_test_design_config_entries.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | sys.path.insert(0, '../../../FrameworkInternals') 4 | 5 | from Oracle import Oracle 6 | from transform_filters import cap_first 7 | 8 | def create_scenario_name(dataType, scalarArray): 9 | assert dataType in Oracle.AllQuasarDataTypes 10 | assert scalarArray in ['scalar', 'array'] 11 | return '{0}_{1}'.format(dataType.replace('_',''), scalarArray) 12 | 13 | f=open('Design.out', 'w') 14 | f_devicelogic = open('DTestClass.cpp', 'w') 15 | 16 | def output_devicelogic(s): 17 | f_devicelogic.write(s) 18 | f_devicelogic.write('\n') 19 | 20 | def output(s): 21 | f.write(s) 22 | f.write('\n') 23 | print(s) 24 | 25 | 26 | def generate(): 27 | oracle = Oracle() 28 | # TODO: missing conditions: arrays and restrictions 29 | for scalarArray in ['scalar', 'array']: 30 | dataTypes = Oracle.InitializeFromConfigDataTypes 31 | for dataType in dataTypes: 32 | scenario_name = create_scenario_name(dataType, scalarArray) 33 | print(scenario_name) 34 | 35 | if scalarArray == 'scalar': 36 | output(''.format( 37 | scenario_name, 38 | dataType, 39 | )) 40 | else: 41 | output(''.format( 42 | scenario_name, 43 | dataType, 44 | )) 45 | output('') 46 | output('') 47 | 48 | 49 | 50 | 51 | 52 | output('') 53 | output('') 54 | output('') 55 | generate() 56 | output('') 57 | output('') 58 | output('') 59 | output('') 60 | output('') 61 | -------------------------------------------------------------------------------- /.CI/test_cases/test_default_quasar_design/reference_ns2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | -------------------------------------------------------------------------------- /.CI/test_cases/test_defaulted_instance_name/Design.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.CI/test_cases/test_defaulted_instance_name/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /.CI/test_cases/test_instantiation_from_design/Design.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | -------------------------------------------------------------------------------- /.CI/test_cases/test_instantiation_from_design/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.CI/test_cases/test_instantiation_from_design/description.txt: -------------------------------------------------------------------------------- 1 | Test case aims to exercise instantiation by design 2 | e.g. in Design.xml ). 6 | * orphan device classes (parent class has no ). 7 | * ambiguous parent device classes (class is child of multiple parent types) 8 | 9 | Pass criteria 10 | ------------- 11 | Test server instance matches reference nodeset -------------------------------------------------------------------------------- /.CI/test_cases/test_methods/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.CI/test_cases/test_methods/description.txt: -------------------------------------------------------------------------------- 1 | In this test case, 2 | we try to test all method/functions signatures regarding methods, call paths etc... 3 | 4 | We therefore have a test case where a list of methods is declared per class, 5 | each method has between 0..2 arguments and 0..2 return values, each of different 6 | data type, variation of scalar/included. 7 | 8 | Pass criteria 9 | ------------- 10 | Successful build. 11 | -------------------------------------------------------------------------------- /.CI/test_cases/test_methods/generate_test_design_methods.py: -------------------------------------------------------------------------------- 1 | from Oracle import Oracle 2 | import random 3 | 4 | def create_scenario_name(num_args, num_rvs, it): 5 | return 'args{0}_rvs{1}_it{2}'.format(num_args, num_rvs, it) 6 | 7 | f=open('Design.out', 'w') 8 | 9 | 10 | def output(s): 11 | f.write(s) 12 | f.write('\n') 13 | print(s) 14 | 15 | 16 | 17 | def make_dts(): 18 | dts = [] 19 | for basicDataType in Oracle.AllQuasarDataTypes: 20 | for scalarArray in ['scalar', 'array']: 21 | dts.append({'scalarArray':scalarArray, 'dataType':basicDataType}) 22 | return dts 23 | 24 | 25 | 26 | def get_dts(dts): 27 | random.shuffle(dts) 28 | return dts.pop() 29 | 30 | 31 | def generate(): 32 | # below is list of data types that we want to use for testing as types of arguments or return values 33 | # as scalars and arrays 34 | # None will be interpreted as no argument or no return value 35 | 36 | dts_args = make_dts() 37 | dts_rvs = make_dts() 38 | 39 | Num_arguments = [0, 1, 2] 40 | Num_return_values = [0, 1, 2] 41 | it = 0 42 | try: 43 | while it<10: 44 | for num_arguments in Num_arguments: 45 | for num_return_values in Num_return_values: 46 | scenario_name = create_scenario_name(num_arguments, num_return_values, it) 47 | output(''.format(scenario_name)) 48 | for arg in range(0, num_arguments): 49 | dt = get_dts(dts_args) 50 | output(''.format(arg, dt['dataType']) ) 51 | if dt['scalarArray'] == 'array': 52 | output('') 53 | output ('') 54 | for rv in range(0, num_return_values): 55 | dt = get_dts(dts_rvs) 56 | output(''.format(rv, dt['dataType']) ) 57 | if dt['scalarArray'] == 'array': 58 | output('') 59 | output ('') 60 | output('') 61 | it += 1 62 | except IndexError: 63 | output('') 64 | pass # this is expected, we just want to saturate the collection... 65 | 66 | 67 | 68 | output('') 69 | output('') 70 | output('') 71 | output('') 72 | generate() 73 | output('') 74 | output('') 75 | output('') 76 | output('') 77 | output('') 78 | -------------------------------------------------------------------------------- /.CI/test_cases/test_recurrent_hasobjects/Design.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 | 21 | 22 | 23 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /.CI/test_cases/test_recurrent_hasobjects/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | -------------------------------------------------------------------------------- /.CI/test_cases/test_single_variable_node/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | -------------------------------------------------------------------------------- /.CI/test_cases/test_single_variable_node/description.txt: -------------------------------------------------------------------------------- 1 | by Piotr Nikiel, 15-Sep-2020 2 | 3 | This test case is inspired by the power supply server which massively use singleVariableNode feature. 4 | -------------------------------------------------------------------------------- /.CI/test_cases/test_source_variables/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.CI/test_cases/test_source_variables/description.txt: -------------------------------------------------------------------------------- 1 | This test is based on a space of sourcevariables, which are elements from a cartesion product of following individual dimensions: 2 | 1) all "basic" quasar data types, 3 | 2) sync or async, whenever either read or write is chosen (note that when rw is chosen then both will have same sync/async settings, this limits the phase space significantly!), 4 | 3) r, w or rw 5 | 4) lock options, note: same lock option will be chosen[ for both r and w (this limits the space significantly!), also note that "of_parent_of_containing_object" is not there 6 | 7 | ----- 8 | Pass conditions: it builds 9 | -------------------------------------------------------------------------------- /.CI/test_cases/test_source_variables/generate_test_design_source_variables.py: -------------------------------------------------------------------------------- 1 | # author: pnikiel 2 | # date: 31-Mar-2020 3 | 4 | from Oracle import Oracle 5 | 6 | def create_scenario_name(dataType, scalarArray, sync, rw, lock): 7 | return '{0}_{1}_{2}_{3}_{4}'.format(dataType.replace('_',''), scalarArray, sync, rw, lock) 8 | 9 | f=open('Design.out', 'w') 10 | 11 | 12 | def output(s): 13 | f.write(s+'\n') 14 | print(s) 15 | 16 | def generate(): 17 | for basicDataType in Oracle.AllQuasarDataTypes: 18 | for scalarArray in ['scalar']: # TODO @pnikiel forgotten that we have no arrays support for source-vars 19 | for sync in ['synchronous', 'asynchronous']: 20 | for rw in ['r', 'w', 'rw']: 21 | for lock in ['no_mutex', 'mutex_this_operation', 'mutex_this_variable', 'mutex_containing_object']: 22 | if sync == 'synchronous' and lock != 'no_mutex': 23 | continue # that setting is excluded by quasar constraints 24 | scenario_name = create_scenario_name(basicDataType, scalarArray, sync, rw, lock) 25 | asWrite = 'forbidden' if 'w' not in rw else sync 26 | asRead = 'forbidden' if 'r' not in rw else sync 27 | QuasarLock = { 28 | 'no_mutex' : 'no', 29 | 'mutex_this_operation' : 'of_this_operation', 30 | 'mutex_this_variable' : 'of_this_variable', 31 | 'mutex_containing_object' : 'of_containing_object' 32 | } 33 | output(''.format( 36 | scenario_name, 37 | basicDataType, 38 | asWrite, 39 | asRead, 40 | QuasarLock[lock])) 41 | if scalarArray == 'array': 42 | output('') 43 | output('') 44 | 45 | 46 | 47 | output('') 48 | output('') 49 | output('') 50 | output('') 51 | generate() 52 | output('') 53 | output('') 54 | output('') 55 | output('') 56 | output('') 57 | -------------------------------------------------------------------------------- /.CI/travis/build_configs/uasdk-eval.cmake: -------------------------------------------------------------------------------- 1 | # Please see http://quasar.docs.cern.ch/quasarBuildSystem.html for 2 | # information how to use this file. 3 | # LICENSE: 4 | # Copyright (c) 2015, CERN 5 | # All rights reserved. 6 | # 7 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 8 | # 9 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 10 | # 11 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 12 | # 13 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 14 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 15 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 16 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 17 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | # 19 | # Author: Piotr Nikiel 20 | # @author pnikiel 21 | # @date 03-Sep-2015 22 | # The purpose of this file is to set default parameters in case no build configuration file (aka toolchain) was specified. 23 | 24 | # The approach is to satisfy the requirements as much as possible. 25 | 26 | #------- 27 | #Boost 28 | #------- 29 | # this will be resolved by BoostSetup.cmake since quasar 1.3.13, nothing to do 30 | 31 | #------ 32 | #OPCUA 33 | #------ 34 | 35 | SET( OPCUA_TOOLKIT_PATH /opt/uasdk ) 36 | SET( OPCUA_TOOLKIT_LIBS_DEBUG "-luamoduled -lcoremoduled -luabasecppd -luastackd -luapkicppd -lxmlparsercppd -lxml2 -lssl -lcrypto -lpthread" ) 37 | SET( OPCUA_TOOLKIT_LIBS_RELEASE "-luamodule -lcoremodule -luabasecpp -luastack -luapkicpp -lxmlparsercpp -lxml2 -lssl -lcrypto -lpthread" ) 38 | 39 | add_custom_target( quasar_opcua_backend_is_ready ) 40 | 41 | include_directories ( 42 | ${OPCUA_TOOLKIT_PATH}/include/platform/linux 43 | ${OPCUA_TOOLKIT_PATH}/include 44 | ${OPCUA_TOOLKIT_PATH}/include/uabasecpp 45 | ${OPCUA_TOOLKIT_PATH}/include/uaservercpp 46 | ${OPCUA_TOOLKIT_PATH}/include/uapkicpp 47 | ${OPCUA_TOOLKIT_PATH}/include/uastack 48 | ${OPCUA_TOOLKIT_PATH}/include/xmlparsercpp 49 | ) 50 | 51 | #----- 52 | #XML Libs 53 | #----- 54 | #As of 03-Sep-2015 I see no FindXerces or whatever in our Cmake 2.8 installation, so no find_package can be user... 55 | # TODO perhaps also take it from environment if requested 56 | SET( XML_LIBS "-lxerces-c" ) 57 | 58 | #----- 59 | #General settings 60 | #----- 61 | 62 | # TODO: split between Win / MSVC, perhaps MSVC has different notation for these 63 | add_definitions(-Wall -Wno-deprecated -std=gnu++0x -DBACKEND_UATOOLKIT ) 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | CMakeFiles 2 | CMakeCache.txt 3 | cmake_install.cmake 4 | *.o 5 | *.generated 6 | *.orig 7 | *.pyc 8 | *.log 9 | bin/PKI 10 | Makefile 11 | **/*.dir 12 | **/*.vcxproj* 13 | **/*.tmp 14 | **/*.removeme 15 | **/*.suo 16 | **/*.opensdf 17 | **/*.sln 18 | **/x64/ 19 | **/*.sdf 20 | **/generated/ 21 | **/cmake_generated.cmake 22 | build/ 23 | env/ 24 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "LogIt"] 2 | path = LogIt 3 | url = https://github.com/quasar-team/LogIt.git 4 | -------------------------------------------------------------------------------- /AddressSpace/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2015, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Piotr Nikiel 18 | 19 | # QUASAR_IS_CMAKE_BUILD_ENTRY_POINT should evaluate to true whenever plain CMake is the entry point, like in Yocto 20 | if(${QUASAR_IS_CMAKE_BUILD_ENTRY_POINT}) 21 | include(${PROJECT_SOURCE_DIR}/AddressSpace/cmake_generated.cmake) 22 | else(${QUASAR_IS_CMAKE_BUILD_ENTRY_POINT}) 23 | include(${PROJECT_BINARY_DIR}/AddressSpace/cmake_generated.cmake) 24 | endif(${QUASAR_IS_CMAKE_BUILD_ENTRY_POINT}) 25 | 26 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/AddressSpace/include/ASInformationModel.h ${PROJECT_BINARY_DIR}/AddressSpace/src/ASInformationModel.cpp 27 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 28 | COMMAND ${PYTHON_COMMAND} quasar.py generate info_model --project_binary_dir ${PROJECT_BINARY_DIR} 29 | DEPENDS ${DESIGN_FILE} templates/designToInformationModelHeader.jinja templates/designToInformationModelBody.jinja ${QUASAR_TRANSFORM_SENSITIVE_FILES} 30 | ) 31 | 32 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/AddressSpace/src/SourceVariables.cpp ${PROJECT_BINARY_DIR}/AddressSpace/include/SourceVariables.h 33 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 34 | COMMAND ${PYTHON_COMMAND} quasar.py generate source_variables --project_binary_dir ${PROJECT_BINARY_DIR} 35 | DEPENDS 36 | ${DESIGN_FILE} 37 | ${PROJECT_SOURCE_DIR}/AddressSpace/templates/designToSourceVariablesHeader.jinja 38 | ${PROJECT_SOURCE_DIR}/AddressSpace/templates/designToSourceVariablesBody.jinja 39 | DeviceBase 40 | ) 41 | 42 | add_library (AddressSpace OBJECT 43 | src/ASInformationModel.cpp 44 | src/ASNodeManager.cpp 45 | src/ASSourceVariableIoManager.cpp 46 | src/SourceVariables.cpp 47 | src/ArrayTools.cpp 48 | src/ChangeNotifyingVariable.cpp 49 | src/FreeVariablesEngine.cpp 50 | ${ADDRESSSPACE_CLASSES} 51 | 52 | ) 53 | 54 | 55 | add_custom_target(AddressSpaceGeneratedHeaders DEPENDS ${ADDRESSSPACE_HEADERS} include/ASInformationModel.h include/SourceVariables.h) 56 | add_dependencies (AddressSpace AddressSpaceGeneratedHeaders DeviceGeneratedHeaders Configuration.hxx_GENERATED ) 57 | -------------------------------------------------------------------------------- /AddressSpace/include/ASCommon.h: -------------------------------------------------------------------------------- 1 | /* (C) Copyright CERN, 2020. All rights not expressly granted are reserved. 2 | * ASCommon.h 3 | * 4 | * Created on: 03 Nov 2020 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace AddressSpace 25 | { 26 | 27 | /** The intent is to simplify the AS class API by overloading. Should map to simplest possible C++ 28 | type (potentially a void struct) that can be passed as an argument. */ 29 | struct QuasarNullDataType {}; 30 | 31 | const std::string SingleItemNodeObjectPrefix ("__single_item_node__"); 32 | 33 | } 34 | -------------------------------------------------------------------------------- /AddressSpace/include/ASDelegatingMethod.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 2 | * ASDelegatingVariable.h 3 | * 4 | * Created on: Dec 31, 2016 5 | * Author: Piotr Nikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef ADDRESSSPACE_INCLUDE_ASDELEGATINGMETHOD_H_ 23 | #define ADDRESSSPACE_INCLUDE_ASDELEGATINGMETHOD_H_ 24 | 25 | #include 26 | 27 | namespace AddressSpace 28 | { 29 | template 30 | class ASDelegatingMethod: public OpcUa::BaseMethod 31 | 32 | { 33 | 34 | public: 35 | ASDelegatingMethod( 36 | const UaNodeId & nodeId, 37 | const UaString & name, 38 | OpcUa_UInt16 browseNameNameSpaceIndex, 39 | UaMutexRefCounted * pSharedMutex = 0 40 | ) : OpcUa::BaseMethod ( 41 | nodeId, 42 | name, 43 | browseNameNameSpaceIndex, 44 | pSharedMutex), 45 | m_object(0), 46 | m_method(0) 47 | { 48 | 49 | } 50 | 51 | UaStatus call ( 52 | MethodManagerCallback* pCallback, 53 | OpcUa_UInt32 callbackHandle, 54 | const UaVariantArray& inputArguments 55 | ) 56 | { 57 | // TODO: missing arguments 58 | if (m_object && m_method) 59 | { 60 | return (m_object->*m_method)( pCallback, callbackHandle, inputArguments ); 61 | } 62 | else 63 | { 64 | LOG(Log::ERR) << "Method was called but handler isn't set."; 65 | return OpcUa_BadNotImplemented; 66 | } 67 | } 68 | 69 | 70 | void assignHandler( 71 | ObjectType* object, 72 | UaStatus (ObjectType::*method)(MethodManagerCallback* pCallback, OpcUa_UInt32 callbackHandle, const UaVariantArray& inputArguments) 73 | ) 74 | { 75 | m_method = method; 76 | m_object = object; 77 | } 78 | 79 | private: 80 | 81 | // this is address space object to which the call will be routed 82 | ObjectType* m_object; 83 | UaStatus (ObjectType::*m_method)(MethodManagerCallback* pCallback, OpcUa_UInt32 callbackHandle, const UaVariantArray& inputArguments) ; 84 | 85 | 86 | }; 87 | 88 | } 89 | 90 | 91 | #endif /* ADDRESSSPACE_INCLUDE_ASDELEGATINGMETHOD_H_ */ 92 | -------------------------------------------------------------------------------- /AddressSpace/include/ASDelegatingVariable.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 2 | * ASDelegatingVariable.h 3 | * 4 | * Created on: Jul 4, 2014 5 | * Author: Piotr Nikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef ASDELEGATINGVARIABLE_H_ 23 | #define ASDELEGATINGVARIABLE_H_ 24 | 25 | #include 26 | 27 | namespace AddressSpace 28 | { 29 | 30 | template 31 | class ASDelegatingVariable: public ChangeNotifyingVariable 32 | 33 | { 34 | public: 35 | 36 | ASDelegatingVariable ( 37 | const UaNodeId& nodeId, 38 | const UaString& name, 39 | OpcUa_UInt16 browseNameNameSpaceIndex, 40 | const UaVariant& initialValue, 41 | OpcUa_Byte accessLevel, 42 | NodeManagerConfig* pNodeConfig, 43 | UaMutexRefCounted* pSharedMutex = NULL): 44 | ChangeNotifyingVariable (nodeId, name, browseNameNameSpaceIndex, initialValue, accessLevel, pNodeConfig, pSharedMutex), 45 | m_write(0), 46 | m_object(0) {} 47 | virtual ~ASDelegatingVariable () {}; 48 | 49 | UaStatus setValue(Session* pSession, const UaDataValue& dataValue, OpcUa_Boolean checkAccessLevel = OpcUa_True) 50 | { 51 | if (m_object && m_write && pSession!=0) 52 | { 53 | UaStatus status = (m_object->*m_write) (pSession, dataValue, checkAccessLevel); 54 | if (status.isGood()) 55 | ChangeNotifyingVariable::setValue (pSession, dataValue, checkAccessLevel); 56 | return status; 57 | } 58 | else 59 | { 60 | return ChangeNotifyingVariable::setValue(pSession, dataValue, checkAccessLevel); 61 | } 62 | } 63 | UaStatus assignHandler (ObjectType* object, UaStatus (ObjectType::*method)(Session*, const UaDataValue&, OpcUa_Boolean)) 64 | { 65 | m_object = object; 66 | m_write = method; 67 | return OpcUa_Good; 68 | } 69 | private: 70 | UaStatus (ObjectType::* m_write)(Session* pSession, const UaDataValue& dataValue, OpcUa_Boolean checkAccessLevel); 71 | ObjectType* m_object; 72 | }; 73 | 74 | } 75 | #endif /* ASDELEGATINGVARIABLE_H_ */ 76 | -------------------------------------------------------------------------------- /AddressSpace/include/ASNodeManager.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, PNPI, 2015. All rights not expressly granted are reserved. 2 | * ASNodeManager.h 3 | * 4 | * Created on: Jun 20, 2014 5 | * Author: Piotr Nikiel 6 | * Author: Viatcheslav Filimonov 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #ifndef ASNODEMANAGER_H_ 24 | #define ASNODEMANAGER_H_ 25 | 26 | #include // for std::function 27 | 28 | #include 29 | 30 | #include 31 | 32 | namespace AddressSpace 33 | 34 | { 35 | 36 | class ASNodeManager : public NodeManagerBase 37 | { 38 | 39 | public: 40 | ASNodeManager(); 41 | 42 | ASNodeManager(const ASNodeManager& other) = delete; 43 | ASNodeManager& operator= (const ASNodeManager& other) = delete; 44 | 45 | virtual ~ASNodeManager(); 46 | 47 | /* Wrapper on top of UA-SDK that throws when the call wasn't successful */ 48 | UaStatus addNodeAndReferenceThrows( 49 | const UaNodeId& parentNodeId, 50 | UaReferenceLists* pNewNode, 51 | const UaNodeId& referenceTypeId, 52 | const UaNodeId& targetNodeId); 53 | 54 | UaStatus addNodeAndReferenceThrows( 55 | UaReferenceLists* pSourceNode, 56 | UaReferenceLists* pNewNode, 57 | const UaNodeId& referenceTypeId, 58 | const UaNodeId& sourceNodeId, 59 | const UaNodeId& targetNodeId); 60 | 61 | 62 | 63 | virtual UaStatus afterStartUp(); 64 | virtual UaStatus beforeShutDown(); 65 | 66 | #ifndef BACKEND_OPEN62541 67 | UaObject * getInstanceDeclarationObjectType (OpcUa_UInt32 typeId); 68 | 69 | virtual IOManager* getIOManager(UaNode* pUaNode, OpcUa_Int32 attributeId) const; 70 | #endif 71 | 72 | UaNodeId makeChildNodeId (const UaNodeId &parent, const UaString& childName); 73 | 74 | const UaNodeId getTypeNodeId (unsigned int numericalType); 75 | void setAfterStartupDelegate( std::function afterStartUpDelegate ); 76 | 77 | UaStatus addUnreferencedNode( UaNode* node ); 78 | const std::list& getUnreferencedNodes () const { return m_unreferencedNodes; } 79 | 80 | private: 81 | UaStatus createTypeNodes(); 82 | std::function m_afterStartUpDelegate; 83 | std::list m_unreferencedNodes; 84 | }; 85 | 86 | 87 | 88 | 89 | 90 | } 91 | 92 | 93 | 94 | #endif /* ASNODEMANAGER_H_ */ 95 | -------------------------------------------------------------------------------- /AddressSpace/include/ASSourceVariable.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 2 | * ASSourceVariable.h 3 | * 4 | * Created on: Sep 16, 2014 5 | * Author: Piotr Nikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef ASSOURCEVARIABLE_H_ 23 | #define ASSOURCEVARIABLE_H_ 24 | 25 | #ifndef BACKEND_OPEN62541 26 | 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace AddressSpace 33 | { 34 | 35 | 36 | class ASSourceVariable: public OpcUa::BaseDataVariableType 37 | 38 | { 39 | public: 40 | 41 | ASSourceVariable ( 42 | const UaNodeId& nodeId, 43 | const UaString& name, 44 | OpcUa_UInt16 browseNameNameSpaceIndex, 45 | const UaVariant& initialValue, 46 | OpcUa_Byte accessLevel, 47 | NodeManagerConfig* pNodeConfig, 48 | const UaNode* pParentObjectNode, 49 | ASSourceVariableJobId readJobId, 50 | ASSourceVariableJobId writeJobId, 51 | UaMutexRefCounted* pSharedMutex = NULL): 52 | OpcUa::BaseDataVariableType (nodeId, name, browseNameNameSpaceIndex, initialValue, accessLevel, pNodeConfig, pSharedMutex), 53 | m_readOperationJobId(readJobId), 54 | m_writeOperationJobId(writeJobId), 55 | m_parentObjectNode(pParentObjectNode), 56 | m_ioManager(new ASSourceVariableIoManager(m_readOperationJobId, m_writeOperationJobId, m_parentObjectNode) ) 57 | {} 58 | virtual ~ASSourceVariable () 59 | { 60 | delete m_ioManager; 61 | }; 62 | 63 | IOManager* getIOManager () const { return m_ioManager; } 64 | 65 | 66 | private: 67 | ASSourceVariableJobId m_readOperationJobId; 68 | ASSourceVariableJobId m_writeOperationJobId; 69 | const UaNode* m_parentObjectNode; 70 | ASSourceVariableIoManager *m_ioManager; 71 | 72 | 73 | }; 74 | 75 | } 76 | 77 | #endif // BACKEND_OPEN62541 78 | 79 | 80 | #endif /* ASSOURCEVARIABLE_H_ */ 81 | -------------------------------------------------------------------------------- /AddressSpace/include/ChangeNotifyingVariable.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * ChangeNotifyingVariable.h 3 | * 4 | * Created on: 12 Nov 2018 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef ADDRESSSPACE_INCLUDE_CHANGENOTIFYINGVARIABLE_H_ 23 | #define ADDRESSSPACE_INCLUDE_CHANGENOTIFYINGVARIABLE_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | 29 | namespace AddressSpace 30 | { 31 | 32 | class ChangeNotifyingVariable: public OpcUa::BaseDataVariableType 33 | { 34 | public: 35 | 36 | typedef std::function OnChangeListener; 37 | 38 | ChangeNotifyingVariable( 39 | const UaNodeId& nodeId, 40 | const UaString& name, 41 | OpcUa_UInt16 browseNameNameSpaceIndex, 42 | const UaVariant& initialValue, 43 | OpcUa_Byte accessLevel, 44 | NodeManagerConfig* pNodeConfig, 45 | UaMutexRefCounted* pSharedMutex = NULL); 46 | 47 | virtual ~ChangeNotifyingVariable(); 48 | 49 | virtual UaStatus setValue( 50 | Session* pSession, 51 | const UaDataValue& dataValue, 52 | OpcUa_Boolean checkAccessLevel); 53 | 54 | virtual void addChangeListener (OnChangeListener onChangeListener); 55 | virtual size_t changeListenerSize () const { return m_changeListeners.size(); } 56 | virtual void removeAllChangeListeners () { m_changeListeners.clear(); } 57 | 58 | private: 59 | std::list m_changeListeners; 60 | }; 61 | 62 | } 63 | 64 | 65 | 66 | #endif /* ADDRESSSPACE_INCLUDE_CHANGENOTIFYINGVARIABLE_H_ */ 67 | -------------------------------------------------------------------------------- /AddressSpace/include/FreeVariablesEngine.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2020. All rights not expressly granted are reserved. 2 | * FreeVariablesEngine.h 3 | * 4 | * Created on: 23 Jun 2020 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef ADDRESSSPACE_INCLUDE_FREEVARIABLESENGINE_H_ 23 | #define ADDRESSSPACE_INCLUDE_FREEVARIABLESENGINE_H_ 24 | 25 | #include 26 | #include 27 | 28 | namespace AddressSpace 29 | { 30 | 31 | class ASNodeManager; // forward-decl 32 | 33 | class FreeVariablesEngine 34 | { 35 | public: 36 | 37 | static void instantiateFreeVariable( 38 | AddressSpace::ASNodeManager* nm, 39 | UaNodeId parentNodeId, 40 | const Configuration::FreeVariable& config); 41 | 42 | }; 43 | 44 | } /* namespace AddressSpace */ 45 | 46 | #endif /* ADDRESSSPACE_INCLUDE_FREEVARIABLESENGINE_H_ */ 47 | -------------------------------------------------------------------------------- /AddressSpace/src/ASSourceVariableIoManager.cpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 2 | * ASSourceVariable.h 3 | * 4 | * Created on: Sep 16, 2014 5 | * Author: Piotr Nikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef BACKEND_OPEN62541 23 | 24 | #include 25 | #include 26 | 27 | using namespace std; 28 | 29 | namespace AddressSpace 30 | { 31 | 32 | UaStatus ASSourceVariableIoManager::beginTransaction ( 33 | IOManagerCallback* pCallback, 34 | const ServiceContext& serviceContext, 35 | OpcUa_UInt32 hTransaction, 36 | OpcUa_UInt32 totalItemCountHint, 37 | OpcUa_Double maxAge, 38 | OpcUa_TimestampsToReturn timestampsToReturn, 39 | TransactionType transactionType, 40 | OpcUa_Handle& hIOManagerContext) 41 | { 42 | m_callback = pCallback; 43 | m_transaction = hTransaction; 44 | return OpcUa_Good; 45 | } 46 | 47 | UaStatus ASSourceVariableIoManager::beginRead ( 48 | OpcUa_Handle hIOManagerContext, 49 | OpcUa_UInt32 callbackHandle, 50 | VariableHandle* pVariableHandle, 51 | OpcUa_ReadValueId* pReadValueId) 52 | { 53 | m_callbackHandle = callbackHandle; 54 | LOG(Log::DBG) << "beginRead op=" << m_readOperationJobId << " cbkHandle=" <getNameSpaceIndex()), /* locale id*/UaString(""), /*is abstract*/OpcUa_False); 41 | addStatus = nm->addNodeAndReference(OpcUaId_BaseObjectType, type, OpcUaId_HasSubtype); 42 | if (!addStatus.isGood()) 43 | { 44 | LOG(Log::ERR) << "While adding a type definition node: " << addStatus.toString().toUtf8(); 45 | throw std::runtime_error (std::string("in ASInformationModel::createNodesOfTypes: ") + addStatus.toString().toUtf8()); 46 | } 47 | {% endfor %} 48 | {% endif %} 49 | #endif // BACKEND_OPEN62541 50 | } 51 | 52 | } 53 | -------------------------------------------------------------------------------- /AddressSpace/templates/designToInformationModelHeader.jinja: -------------------------------------------------------------------------------- 1 | {# © Copyright CERN, 2015. #} 2 | {# All rights not expressly granted are reserved. #} 3 | {# This file is part of Quasar. #} 4 | {# #} 5 | {# Quasar is free software: you can redistribute it and/or modify #} 6 | {# it under the terms of the GNU Lesser General Public Licence as published by #} 7 | {# the Free Software Foundation, either version 3 of the Licence. #} 8 | {# Quasar is distributed in the hope that it will be useful, #} 9 | {# but WITHOUT ANY WARRANTY; without even the implied warranty of #} 10 | {# #} 11 | {# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #} 12 | {# GNU Lesser General Public Licence for more details. #} 13 | {# #} 14 | {# You should have received a copy of the GNU Lesser General Public License #} 15 | {# along with Quasar. If not, see #} 16 | {# #} 17 | {# Created: Jun 2014 (the original XSLT version) #} 18 | {# 23 Mar 2020 (translated to Jinja2) #} 19 | {# Authors: #} 20 | {# Piotr Nikiel #} 21 | 22 | {% import 'headers.jinja' as headers %} 23 | {{ headers.cppFullGeneratedHeader() }} 24 | 25 | #ifndef __ASINFORMATIONMODEL__H__ 26 | #define __ASINFORMATIONMODEL__H__ 27 | 28 | #include 29 | 30 | namespace AddressSpace 31 | { 32 | 33 | class ASInformationModel 34 | { 35 | public: 36 | 37 | enum 38 | { 39 | AS_TYPE_INTEQUASAR_PLACEHOLDER = 1000 40 | {% for className in designInspector.get_names_of_all_classes() -%}, 41 | AS_TYPE_{{className|upper}} 42 | {% endfor %} 43 | }; 44 | 45 | static void createNodesOfTypes (ASNodeManager *nm); 46 | }; 47 | 48 | } 49 | 50 | #endif // __ASINFORMATIONMODEL__H__ 51 | -------------------------------------------------------------------------------- /CalculatedVariables/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2018, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Piotr Nikiel 18 | 19 | include_directories(ext_components/muparser-amalgamated/include) 20 | 21 | file(GLOB muparser_srcs "ext_components/muparser-amalgamated/src/*.cpp" ) 22 | 23 | add_definitions(-DMUPARSER_STATIC) 24 | 25 | add_library( 26 | CalculatedVariables OBJECT 27 | src/CalculatedVariable.cpp 28 | src/CalculatedVariablesEngine.cpp 29 | src/CalculatedVariablesChangeListener.cpp 30 | src/ParserVariable.cpp 31 | ${muparser_srcs} 32 | ) 33 | 34 | add_dependencies( CalculatedVariables Configuration.hxx_GENERATED ) -------------------------------------------------------------------------------- /CalculatedVariables/doc/CalculatedVariablesClassDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/CalculatedVariables/doc/CalculatedVariablesClassDiagram.png -------------------------------------------------------------------------------- /CalculatedVariables/doc/SynchronizationExample.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/CalculatedVariables/doc/SynchronizationExample.odg -------------------------------------------------------------------------------- /CalculatedVariables/doc/SynchronizationExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/CalculatedVariables/doc/SynchronizationExample.png -------------------------------------------------------------------------------- /CalculatedVariables/doc/sample_design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/CalculatedVariables/doc/sample_design.png -------------------------------------------------------------------------------- /CalculatedVariables/ext_components/amalgamate_header.json: -------------------------------------------------------------------------------- 1 | { 2 | "project": "muParser-header.h", 3 | "target": "../muparser-amalgamated/include/muParser.h", 4 | "sources": [ 5 | "muParser.h", 6 | "muParserInt.h", 7 | "muParserTest.h", 8 | "muParserDLL.h" 9 | ], 10 | "include_paths": [ 11 | "." 12 | ] 13 | } 14 | 15 | -------------------------------------------------------------------------------- /CalculatedVariables/ext_components/clone_and_amalgamate_muparser.sh: -------------------------------------------------------------------------------- 1 | rm -Rf amalgamate 2 | git clone https://github.com/edlund/amalgamate.git || exit 1 3 | rm -Rf muparser-cloned 4 | git clone https://github.com/beltoforion/muparser.git -b v2.2.6.1 --depth=1 muparser-cloned || exit 1 5 | ln -s `readlink -f muparser-cloned` amalgamate/muparser || exit 1 6 | ln -s `readlink -f amalgamate_header.json` amalgamate || exit 1 7 | ln -s `readlink -f amalgamate_source.json` amalgamate || exit 1 8 | cat muparser-cloned/src/*.cpp > muparser-amalgamated/src/muParser.cpp 9 | sed -e "s/#include \"muParser.*/\/\/amalgamated header include by Piotrs script \0/" -i muparser-amalgamated/src/muParser.cpp 10 | sed -i '1i #include ' muparser-amalgamated/src/muParser.cpp 11 | cd amalgamate 12 | python amalgamate.py -c amalgamate_header.json -s muparser/include -v yes 13 | cd .. 14 | rm -Rf amalgamate 15 | rm -Rf muparser-cloned 16 | 17 | 18 | -------------------------------------------------------------------------------- /CalculatedVariables/include/CalculatedVariablesChangeListener.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * CalculatedVariablesChangeListener.h 3 | * 4 | * Created on: 20 Nov 2018 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef CALCULATEDVARIABLES_INCLUDE_CALCULATEDVARIABLESCHANGELISTENER_H_ 23 | #define CALCULATEDVARIABLES_INCLUDE_CALCULATEDVARIABLESCHANGELISTENER_H_ 24 | 25 | class UaDataValue; 26 | 27 | namespace AddressSpace 28 | { 29 | class ChangeNotifyingVariable; 30 | } 31 | 32 | namespace CalculatedVariables 33 | { 34 | 35 | class ParserVariable; 36 | 37 | class ChangeListener 38 | { 39 | public: 40 | ChangeListener(ParserVariable& variable); 41 | 42 | void operator()( 43 | AddressSpace::ChangeNotifyingVariable& fromWhere, 44 | const UaDataValue& newValue); 45 | private: 46 | ParserVariable& m_variable; 47 | }; 48 | 49 | } /* namespace CalculatedVariables */ 50 | 51 | #endif /* CALCULATEDVARIABLES_INCLUDE_CALCULATEDVARIABLESCHANGELISTENER_H_ */ 52 | -------------------------------------------------------------------------------- /CalculatedVariables/include/CalculatedVariablesLogComponentId.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * CalculatedVariablesLogComponentId.h 3 | * 4 | * Created on: 20 Nov 2018 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef CALCULATEDVARIABLES_INCLUDE_CALCULATEDVARIABLESLOGCOMPONENTID_H_ 23 | #define CALCULATEDVARIABLES_INCLUDE_CALCULATEDVARIABLESLOGCOMPONENTID_H_ 24 | 25 | #include 26 | 27 | namespace CalculatedVariables 28 | { 29 | 30 | extern Log::LogComponentHandle logComponentId; 31 | 32 | } 33 | 34 | 35 | 36 | #endif /* CALCULATEDVARIABLES_INCLUDE_CALCULATEDVARIABLESLOGCOMPONENTID_H_ */ 37 | -------------------------------------------------------------------------------- /CalculatedVariables/include/ParserVariable.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * ParserVariable.h 3 | * 4 | * Created on: 20 Nov 2018 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef CALCULATEDVARIABLES_INCLUDE_PARSERVARIABLE_H_ 23 | #define CALCULATEDVARIABLES_INCLUDE_PARSERVARIABLE_H_ 24 | 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | // forward-decls 31 | namespace AddressSpace 32 | { 33 | class ChangeNotifyingVariable; 34 | } 35 | 36 | namespace CalculatedVariables 37 | { 38 | 39 | typedef boost::recursive_mutex Synchronizer; 40 | typedef std::shared_ptr SharedSynchronizer; 41 | 42 | class CalculatedVariable; 43 | 44 | class ParserVariable 45 | { 46 | public: 47 | enum State 48 | { 49 | WaitingInitialData, 50 | Good, 51 | Bad 52 | }; 53 | 54 | ParserVariable(AddressSpace::ChangeNotifyingVariable* notifyingVariable, const std::string& name); 55 | 56 | double value() const { return m_value; } 57 | double* valuePtr() { return &m_value; } 58 | State state() const { return m_state; } 59 | 60 | void setValue(double v, State state); 61 | 62 | //! Will match our address space counterpart address 63 | std::string name() const; 64 | 65 | void addNotifiedVariable( CalculatedVariable* notifiedVariable ); 66 | std::list notifiedVariables() { return m_notifiedVariables; } 67 | 68 | AddressSpace::ChangeNotifyingVariable* notifyingVariable() { return m_notifyingVariable; } 69 | 70 | SharedSynchronizer& synchronizer() { return m_synchronizer; } 71 | 72 | bool isConstant() const { return m_isConstant; } 73 | void setIsConstant(bool v) { m_isConstant = v; } 74 | 75 | private: 76 | //! Ptr to our Address Space counterpart, will notify us on change 77 | AddressSpace::ChangeNotifyingVariable* const m_notifyingVariable; 78 | 79 | const std::string m_name; 80 | 81 | //! This is the current numerical value 82 | double m_value; 83 | 84 | State m_state; 85 | 86 | //! List of all variables that should be recomputed in case this one changes value. 87 | std::list m_notifiedVariables; 88 | 89 | SharedSynchronizer m_synchronizer; 90 | 91 | bool m_isConstant; 92 | 93 | void setValueNonSynchronized(double v, State state); 94 | void setValueSynchronized(double v, State state); 95 | 96 | }; 97 | 98 | } /* namespace CalculatedVariables */ 99 | 100 | #endif /* CALCULATEDVARIABLES_INCLUDE_PARSERVARIABLE_H_ */ 101 | -------------------------------------------------------------------------------- /CalculatedVariables/include/ParserVariableRequestUserData.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * ParserVariableRequestUserData.h 3 | * 4 | * Created on: 22 Nov 2018 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef CALCULATEDVARIABLES_INCLUDE_PARSERVARIABLEREQUESTUSERDATA_H_ 23 | #define CALCULATEDVARIABLES_INCLUDE_PARSERVARIABLEREQUESTUSERDATA_H_ 24 | 25 | namespace CalculatedVariables 26 | { 27 | 28 | class CalculatedVariable; 29 | 30 | struct ParserVariableRequestUserData 31 | { 32 | enum Type 33 | { 34 | Value, 35 | Status 36 | }; 37 | Type type; 38 | CalculatedVariable* requestor; 39 | }; 40 | 41 | } 42 | 43 | 44 | 45 | #endif /* CALCULATEDVARIABLES_INCLUDE_PARSERVARIABLEREQUESTUSERDATA_H_ */ 46 | -------------------------------------------------------------------------------- /CalculatedVariables/src/CalculatedVariablesChangeListener.cpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * CalculatedVariablesChangeListener.cpp 3 | * 4 | * Created on: 20 Nov 2018 5 | * Author: pnikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #include 23 | 24 | #include 25 | #include 26 | #include 27 | 28 | #include 29 | 30 | namespace CalculatedVariables 31 | { 32 | 33 | ChangeListener::ChangeListener(ParserVariable& variable): 34 | m_variable(variable) 35 | { 36 | } 37 | 38 | void CalculatedVariables::ChangeListener::operator ()( 39 | AddressSpace::ChangeNotifyingVariable& fromWhere, 40 | const UaDataValue& newValue) 41 | { 42 | LOG(Log::TRC, logComponentId) << "ChangeListener fired, fromWhere=" << fromWhere.nodeId().toString().toUtf8(); 43 | if (newValue.statusCode() == OpcUa_BadWaitingForInitialData) 44 | m_variable.setValue(0, ParserVariable::WaitingInitialData); 45 | else if ((newValue.statusCode() & 0x80000000) != 0) 46 | m_variable.setValue(0, ParserVariable::State::Bad); 47 | else if (newValue.value()) 48 | { 49 | UaVariant variant (*newValue.value()); 50 | if (variant.isEmpty()) 51 | { 52 | LOG(Log::DBG, logComponentId) << "Variant empty, probably storing NULL."; 53 | m_variable.setValue(0, ParserVariable::State::Bad); 54 | } 55 | else 56 | { 57 | OpcUa_Double value; 58 | if (variant.toDouble(value) == OpcUa_Good) 59 | { 60 | LOG(Log::TRC, logComponentId) << "new value is: " << value; 61 | m_variable.setValue(value, ParserVariable::State::Good); 62 | } 63 | else 64 | { 65 | LOG(Log::WRN, logComponentId) << "didnt manage to convert the value to double"; 66 | m_variable.setValue(0, ParserVariable::State::Bad); 67 | } 68 | } 69 | } 70 | else 71 | { 72 | LOG(Log::WRN, logComponentId) << "passed null value"; 73 | m_variable.setValue(0, ParserVariable::State::Bad); 74 | } 75 | } 76 | 77 | } /* namespace CalculatedVariables */ 78 | 79 | 80 | -------------------------------------------------------------------------------- /Common/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | 2 | 3 | add_library (Common OBJECT 4 | src/ASUtils.cpp 5 | src/QuasarThreadPool.cpp 6 | ) 7 | 8 | if (BUILD_QUASAR_TESTS) 9 | link_directories( 10 | ${OPCUA_TOOLKIT_PATH}/lib 11 | ${BOOST_PATH_LIBS} 12 | ${SERVER_LINK_DIRECTORIES} 13 | ) 14 | 15 | add_executable(test_quasar_threadpool 16 | test/test_quasar_threadpool.cpp 17 | $ 18 | $ 19 | 20 | ) 21 | 22 | 23 | target_link_libraries( test_quasar_threadpool 24 | ${OPCUA_TOOLKIT_LIBS_DEBUG} 25 | ) 26 | endif(BUILD_QUASAR_TESTS) -------------------------------------------------------------------------------- /Common/include/ASUtils.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. */ 2 | /* 3 | * ASUtils.h 4 | * 5 | * Created on: Jun 12, 2014 6 | * Author: Piotr Nikiel 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #ifndef ASUTILS_H_ 24 | #define ASUTILS_H_ 25 | 26 | #include 27 | #include 28 | #include 29 | 30 | void abort_with_message(const char* file, int line, const char* message); 31 | void abort_with_message(const char* file, int line, const std::string& message); 32 | 33 | 34 | #define ASSERT_GOOD(status) { if (!(status).isGood()) { abort_with_message(__FILE__, __LINE__, status.toString().toUtf8()); } } 35 | 36 | #define ABORT_MESSAGE(message) { abort_with_message(__FILE__, __LINE__, message); } 37 | #define CONCAT2(s1,s2) ((" " +std::string(s1)+" "+std::string(s2)+" ").c_str()) 38 | #define CONCAT3(s1,s2,s3) (CONCAT2(s1,CONCAT2(s2,s3))) 39 | 40 | #ifndef __GNUC__ 41 | #define __PRETTY_FUNCTION__ __FUNCSIG__ 42 | #endif 43 | #define PRINT(t) std::cout << t << std::endl; 44 | #define PRINT_LOCATION() std::cout << __PRETTY_FUNCTION__ << std::endl 45 | 46 | 47 | #endif /* ASUTILS_H_ */ 48 | -------------------------------------------------------------------------------- /Common/include/QuasarThreadPool.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * QuasarThreadPool.h 3 | * 4 | * Created on: 4 May 2018 5 | * Author: Piotr Nikiel 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef COMMON_INCLUDE_QUASARTHREADPOOL_H_ 23 | #define COMMON_INCLUDE_QUASARTHREADPOOL_H_ 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | namespace Quasar 38 | { 39 | 40 | class ThreadPoolJob 41 | { 42 | public: 43 | virtual ~ThreadPoolJob() {}; 44 | 45 | virtual void execute() = 0; 46 | 47 | virtual std::string describe() const = 0; 48 | 49 | // Can be nullptr if this job is not protected by any mutex. 50 | virtual std::mutex* associatedMutex() const = 0; 51 | }; 52 | 53 | class ThreadPool 54 | { 55 | public: 56 | ThreadPool (unsigned int maxThreads, unsigned int maxJobs); 57 | ~ThreadPool (); 58 | 59 | UaStatus addJob (std::unique_ptr && job); 60 | UaStatus addJob (const std::function& functor, const std::string& description, std::mutex* mutex = nullptr); 61 | 62 | void notifyExternalEvent () { m_conditionVariable.notify_one(); }; 63 | 64 | //! How many jobs are buffered for execution ? 65 | size_t getNumPendingJobs (); 66 | 67 | size_t getNumJobsAccepted () { return m_jobsAcceptedCounter.load(); } 68 | size_t getNumJobsFinished () { return m_jobsFinishedCounter.load(); } 69 | 70 | 71 | private: 72 | void work(); 73 | 74 | std::mutex m_accessLock; 75 | bool m_quit; 76 | std::vector m_workers; 77 | std::list> m_pendingJobs; 78 | 79 | const unsigned int m_maxJobs; 80 | 81 | // this is the notification business for conditional variable notification 82 | std::condition_variable m_conditionVariable; 83 | 84 | struct Duty 85 | { 86 | std::unique_ptr job; 87 | std::unique_lock lock; 88 | Duty() : job(nullptr) {}; 89 | }; 90 | 91 | //! Search for a job that can be presently executed, if found remove it from the list. 92 | Duty findSomeDuty (); 93 | 94 | std::atomic_size_t m_jobsAcceptedCounter; 95 | std::atomic_size_t m_jobsFinishedCounter; 96 | 97 | Log::LogComponentHandle m_threadPoolLogId; 98 | 99 | }; 100 | 101 | } 102 | 103 | #endif /* COMMON_INCLUDE_QUASARTHREADPOOL_H_ */ 104 | -------------------------------------------------------------------------------- /Common/include/Utils.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. */ 2 | /* 3 | * Utils.h 4 | * 5 | * Created on: Oct 22, 2014 6 | * Author: Piotr Nikiel 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #ifndef UTILS_H_ 24 | #define UTILS_H_ 25 | 26 | #include 27 | #include 28 | 29 | #define throw_runtime_error_with_origin(MSG) throw std::runtime_error(std::string("At ")+__FILE__+":"+Utils::toString(__LINE__)+" "+MSG) 30 | 31 | class Utils 32 | { 33 | public: 34 | template 35 | static std::string toString (const T t) 36 | { 37 | std::ostringstream oss; 38 | oss << t; 39 | return oss.str (); 40 | } 41 | 42 | template 43 | static std::string toHexString (const T t) 44 | { 45 | std::ostringstream oss; 46 | oss << std::hex << (unsigned long)t << std::dec; 47 | return oss.str (); 48 | } 49 | 50 | static unsigned int fromHexString (const std::string &s) 51 | { 52 | unsigned int x; 53 | std::istringstream iss (s); 54 | iss >> std::hex >> x; 55 | if (iss.bad()) 56 | throw std::runtime_error ("Given string '"+s+"' not convertible from hex to uint"); 57 | return x; 58 | } 59 | 60 | }; 61 | 62 | namespace Quasar 63 | { 64 | class TermColors 65 | /** These are simple ANSI control codes. Implemented as static methods in case we had to deal with runtime platform dependencies */ 66 | { 67 | public: 68 | static std::string ForeBold () { return "\033[1m"; } 69 | static std::string ForeRed () { return "\033[1;31m"; } 70 | static std::string ForeGreen () { return "\033[1;32m"; } 71 | static std::string ForeYellow () { return "\033[1;33m"; } 72 | static std::string ForeBlue () { return "\033[1;34m"; } 73 | static std::string StyleReset () { return "\033[0m"; } 74 | }; 75 | } 76 | 77 | 78 | #endif /* UTILS_H_ */ 79 | -------------------------------------------------------------------------------- /Common/src/ASUtils.cpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. */ 2 | /* 3 | * ASUtils.cpp 4 | * 5 | * Created on: Jun 12, 2014 6 | * Author: Piotr Nikiel 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #include 24 | #include 25 | #include 26 | 27 | 28 | #include "ASUtils.h" 29 | 30 | using namespace std; 31 | 32 | void abort_with_message(const char* file, int line, const char* message) 33 | { 34 | std::cout << "ABORT WITH MESSAGE:" << std::endl; 35 | std::cout << message << std::endl; 36 | std::cout << "At " << file << ":" << line << std::endl; 37 | abort (); 38 | } 39 | void abort_with_message(const char* file, int line, const std::string& msg) 40 | { 41 | abort_with_message(file, line, msg.c_str()); 42 | } 43 | namespace AddressSpace 44 | { 45 | 46 | 47 | 48 | } 49 | -------------------------------------------------------------------------------- /Common/test/test_quasar_threadpool.cpp: -------------------------------------------------------------------------------- 1 | /* 2 | * test_quasar_threadpool.cpp 3 | * 4 | * Created on: 7 May 2018 5 | * Author: pnikiel 6 | */ 7 | 8 | 9 | #include 10 | #include 11 | 12 | #include 13 | 14 | 15 | 16 | class MyJob: public Quasar::ThreadPoolJob 17 | { 18 | public: 19 | virtual void execute() 20 | { 21 | std::cout << "Starting job" << std::endl; 22 | double x = M_PI; 23 | for (unsigned int i=0; i<50E6; ++i) 24 | x *= 1.00000001; 25 | std::cout << "Finishing job, output=" << x << std::endl; 26 | } 27 | virtual std::string describe() const { return ""; } 28 | }; 29 | 30 | // check if the CPU load scales to 300% (if you have at least 3 cores) 31 | 32 | int main () 33 | { 34 | Log::initializeLogging(Log::WRN); 35 | Quasar::ThreadPool threadPool (3, 1E6); 36 | for (int i=0; i<100E3; ++i) 37 | threadPool.addJob(new MyJob()); 38 | usleep(30E6); 39 | } 40 | -------------------------------------------------------------------------------- /Configuration/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2015, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Piotr Nikiel 18 | 19 | MESSAGE( STATUS "Design file=" ${DESIGN_FILE} ) 20 | 21 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/Configuration/Configuration.xsd 22 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 23 | COMMAND ${PYTHON_COMMAND} quasar.py generate config_xsd --project_binary_dir ${PROJECT_BINARY_DIR} 24 | DEPENDS ${DESIGN_FILE} templates/designToConfigurationXSD.jinja validateDesign ${PROJECT_SOURCE_DIR}/quasar.py ${QUASAR_TRANSFORM_SENSITIVE_FILES} 25 | ) 26 | 27 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/Configuration/Configuration.cxx ${PROJECT_BINARY_DIR}/Configuration/Configuration.hxx 28 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/Configuration 29 | COMMAND xsdcxx cxx-tree --std c++11 --ordered-type-all --generate-serialization --namespace-map http://cern.ch/quasar/Configuration=Configuration --output-dir ${PROJECT_BINARY_DIR}/Configuration ${PROJECT_BINARY_DIR}/Configuration/Configuration.xsd 30 | DEPENDS ${PROJECT_BINARY_DIR}/Configuration/Configuration.xsd 31 | ) 32 | 33 | add_custom_target(Configuration.hxx_GENERATED DEPENDS ${PROJECT_BINARY_DIR}/Configuration/Configuration.hxx ) 34 | 35 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/Configuration/Configurator.cpp 36 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 37 | COMMAND ${PYTHON_COMMAND} quasar.py generate config_cpp --project_binary_dir ${PROJECT_BINARY_DIR} 38 | DEPENDS ${DESIGN_FILE} templates/designToConfigurator.jinja ${PROJECT_SOURCE_DIR}/quasar.py AddressSpace Device 39 | ) 40 | 41 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/Configuration/ConfigValidator.cpp 42 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 43 | COMMAND ${PYTHON_COMMAND} quasar.py generate config_validator --project_binary_dir ${PROJECT_BINARY_DIR} 44 | DEPENDS ${DESIGN_FILE} templates/designToConfigValidator.jinja ${PROJECT_SOURCE_DIR}/quasar.py AddressSpace Device 45 | ) 46 | 47 | add_library (Configuration OBJECT 48 | Configuration.cxx 49 | Configuration.hxx 50 | Configurator.cpp 51 | ConfigValidator.cpp 52 | ) 53 | -------------------------------------------------------------------------------- /Configuration/include/ConfigurationDecorationUtils.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2020. All rights not expressly granted are reserved. */ 2 | /* 3 | * ConfigurationDecorationUtils.h 4 | * 5 | * Created on: May 14, 2020 6 | * Author: Ben Farnham 7 | * Author: Piotr Nikiel 8 | * 9 | * This file is part of Quasar. 10 | * 11 | * Quasar is free software: you can redistribute it and/or modify 12 | * it under the terms of the GNU Lesser General Public Licence as published by 13 | * the Free Software Foundation, either version 3 of the Licence. 14 | * 15 | * Quasar is distributed in the hope that it will be useful, 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 | * GNU Lesser General Public Licence for more details. 19 | * 20 | * You should have received a copy of the GNU Lesser General Public License 21 | * along with Quasar. If not, see . 22 | * 23 | */ 24 | 25 | #ifndef CONFIGURATION_DECORATION_UTILS_H_ 26 | #define CONFIGURATION_DECORATION_UTILS_H_ 27 | 28 | #include 29 | 30 | namespace Configuration 31 | { 32 | namespace DecorationUtils 33 | { 34 | /** 35 | * push_back is a configuration decoration helper function. This function *MUST* 36 | * be used when decorating the configuration object tree (i.e. adding new 37 | * object instances). This function handles both 38 | * 1. Addition: adding the object in the specified tree location. 39 | * 2. Content Ordering: maintaining the ordering mechanism quasar uses to process 40 | * configuration elements in the correct order. 41 | * 42 | * @param parent: Parent tree node. 43 | * @param children: The collection of children (owned by the parent) to which the 44 | * new child will be appended. 45 | * @param child: The new child object 46 | * @param childTypeId: The ordering type ID (as gen'd by xsdcxx) of the new child 47 | * object 48 | */ 49 | template< typename TParent, typename TChildren, typename TChild > 50 | void push_back(TParent& parent, TChildren& children, const TChild& child, const size_t childTypeId) 51 | { 52 | children.push_back(child); 53 | const xml_schema::content_order orderingElement(childTypeId, children.size()-1); 54 | parent.content_order().push_back(orderingElement); 55 | }; 56 | 57 | template< typename TParent, typename TChildren> 58 | void clear(TParent& parent, TChildren& children, const size_t childTypeId) 59 | { 60 | 61 | children.clear(); 62 | 63 | auto one_past_removed_iter = std::remove_if( 64 | std::begin(parent.content_order()), 65 | std::end(parent.content_order()), 66 | [childTypeId](decltype(parent.content_order().front())& content_order_elem){return content_order_elem.id == childTypeId;}); 67 | 68 | parent.content_order().erase(one_past_removed_iter, std::end(parent.content_order())); 69 | } 70 | 71 | } // namespace DecorationUtils 72 | } // namespace Configuration 73 | 74 | #endif /* CONFIGURATION_DECORATION_UTILS_H_ */ 75 | -------------------------------------------------------------------------------- /Design/Design.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /Design/quasarVersion.txt: -------------------------------------------------------------------------------- 1 | v1.7.1 -------------------------------------------------------------------------------- /Device/DeviceCustom.cmake: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2020, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Initial author: Piotr Nikiel <-- specific users: remove this line and put your own name ;-) 18 | # This file *WILL NOT* be overwritten by quasar tools. 19 | 20 | set(DEVICE_CUSTOM_SOURCES 21 | # here place the list of your custom sources from Device module, 22 | # e.g. src/MyFile1.cpp src/DeviceClass.cpp 23 | ) 24 | -------------------------------------------------------------------------------- /Device/templates/designToGeneratedCmakeDevice.jinja: -------------------------------------------------------------------------------- 1 | {# © Copyright CERN, 2015. #} 2 | {# All rights not expressly granted are reserved. #} 3 | {# This file is part of Quasar. #} 4 | {# #} 5 | {# Quasar is free software: you can redistribute it and/or modify #} 6 | {# it under the terms of the GNU Lesser General Public Licence as published by #} 7 | {# the Free Software Foundation, either version 3 of the Licence. #} 8 | {# Quasar is distributed in the hope that it will be useful, #} 9 | {# but WITHOUT ANY WARRANTY; without even the implied warranty of #} 10 | {# #} 11 | {# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #} 12 | {# GNU Lesser General Public Licence for more details. #} 13 | {# #} 14 | {# You should have received a copy of the GNU Lesser General Public License #} 15 | {# along with Quasar. If not, see #} 16 | {# #} 17 | {# Created: Apr 2015 (XSLT version, pnikiel) #} 18 | {# 05-Mar-2020 (translating XSLT to Jinja2, pnikiel) #} 19 | {# Authors: #} 20 | {# Piotr Nikiel #} 21 | 22 | set(DEVICE_CLASSES 23 | {% for className in designInspector.get_names_of_all_classes(only_with_device_logic=True) %} 24 | src/D{{className}}.cpp 25 | {% endfor %} 26 | ) -------------------------------------------------------------------------------- /Device/templates/designToGeneratedCmakeDeviceBase.jinja: -------------------------------------------------------------------------------- 1 | {# © Copyright CERN, 2015. #} 2 | {# All rights not expressly granted are reserved. #} 3 | {# This file is part of Quasar. #} 4 | {# #} 5 | {# Quasar is free software: you can redistribute it and/or modify #} 6 | {# it under the terms of the GNU Lesser General Public Licence as published by #} 7 | {# the Free Software Foundation, either version 3 of the Licence. #} 8 | {# Quasar is distributed in the hope that it will be useful, #} 9 | {# but WITHOUT ANY WARRANTY; without even the implied warranty of #} 10 | {# #} 11 | {# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #} 12 | {# GNU Lesser General Public Licence for more details. #} 13 | {# #} 14 | {# You should have received a copy of the GNU Lesser General Public License #} 15 | {# along with Quasar. If not, see #} 16 | {# #} 17 | {# Created: Apr 2015 (XSLT version, pnikiel) #} 18 | {# 05-Mar-2020 (translating XSLT to Jinja2, pnikiel) #} 19 | {# Authors: #} 20 | {# Piotr Nikiel #} 21 | 22 | {% for className in designInspector.get_names_of_all_classes() %} 23 | add_custom_command(OUTPUT ${PROJECT_BINARY_DIR}/Device/generated/Base_D{{className}}.h 24 | WORKING_DIRECTORY ${PROJECT_SOURCE_DIR} 25 | COMMAND ${PYTHON_COMMAND} quasar.py generate base_h {{className}} --project_binary_dir ${PROJECT_BINARY_DIR} 26 | DEPENDS 27 | ${DESIGN_FILE} 28 | validateDesign 29 | ${PROJECT_SOURCE_DIR}/quasar.py 30 | ${PROJECT_SOURCE_DIR}/Device/templates/designToDeviceBaseHeader.jinja 31 | Configuration.hxx_GENERATED 32 | templates/commonDeviceTemplates.jinja 33 | ${QUASAR_TRANSFORM_SENSITIVE_FILES} 34 | ) 35 | {% endfor %} 36 | 37 | set(DEVICEBASE_GENERATED_FILES 38 | include/DRoot.h 39 | src/DRoot.cpp 40 | generated/Base_All.cpp 41 | {% for className in designInspector.get_names_of_all_classes(only_with_device_logic=True) %} 42 | generated/Base_D{{className}}.h 43 | {% endfor %} 44 | ) -------------------------------------------------------------------------------- /Device/templates/designToRootHeader.jinja: -------------------------------------------------------------------------------- 1 | {# © Copyright CERN, 2015. #} 2 | {# All rights not expressly granted are reserved. #} 3 | {# This file is part of Quasar. #} 4 | {# #} 5 | {# Quasar is free software: you can redistribute it and/or modify #} 6 | {# it under the terms of the GNU Lesser General Public Licence as published by #} 7 | {# the Free Software Foundation, either version 3 of the Licence. #} 8 | {# Quasar is distributed in the hope that it will be useful, #} 9 | {# but WITHOUT ANY WARRANTY; without even the implied warranty of #} 10 | {# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #} 11 | {# GNU Lesser General Public Licence for more details. #} 12 | {# #} 13 | {# You should have received a copy of the GNU Lesser General Public License #} 14 | {# along with Quasar. If not, see #} 15 | {# #} 16 | {# Created: Jun 2014 (original XSLT version) #} 17 | {# Mar 2020 (converted to Jinja2 #} 18 | {# Authors: #} 19 | {# Piotr Nikiel 31 | 32 | #include 33 | #include 34 | 35 | namespace Device 36 | { 37 | 38 | {% for hasobjects in root.hasobjects %} 39 | {% if designInspector.class_has_device_logic(hasobjects.get('class')) %} 40 | class D{{hasobjects.get('class')}}; 41 | {% endif %} 42 | {% endfor %} 43 | 44 | class DRoot 45 | { 46 | public: 47 | /* yes, it's a singleton */ 48 | static DRoot* getInstance (); 49 | 50 | DRoot (); 51 | DRoot (const DRoot& other) = delete; 52 | DRoot& operator= (const DRoot& other) = delete; 53 | 54 | virtual ~DRoot (); 55 | 56 | /* To gracefully quit */ 57 | void unlinkAllChildren () const; 58 | 59 | /* For constructing the tree of devices and for browsing children. */ 60 | {{ commonDeviceTemplates.hasobjectsAccessors(root, designInspector, oracle) }} 61 | 62 | /* find methods for children */ 63 | {{ commonDeviceTemplates.deviceLogicFindByKeyHeaders(root, designInspector, oracle) }} 64 | 65 | /* query address-space for full name (mostly for debug purposes) */ 66 | std::string getFullName () const { return "[ROOT]"; } 67 | 68 | private: 69 | static DRoot *m_instance; /* it's a singleton class */ 70 | 71 | /* Collections of device logic children objects */ 72 | {{ commonDeviceTemplates.hasobjectsChildrenCollection(root, designInspector, oracle) }} 73 | 74 | }; 75 | 76 | } 77 | #endif // include guard 78 | -------------------------------------------------------------------------------- /Documentation/Addons/prepare.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | export CC="/sw/opt/swtools/x-tools7h/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-gcc" 4 | export CXX="/sw/opt/swtools/x-tools7h/arm-unknown-linux-gnueabihf/bin/arm-unknown-linux-gnueabihf-g++" 5 | export ORIGDIR=`pwd` 6 | 7 | prep_libxml2() 8 | { 9 | cd $ORIGDIR 10 | LIBXML2_NAME="libxml2-2.7.2" 11 | LIBXML2_FULLNAME="$LIBXML2_NAME"".tar.gz" 12 | LIBXML2_URL="ftp://xmlsoft.org/libxml2/$LIBXML2_FULLNAME" 13 | cd downloaded 14 | wget $LIBXML2_URL 15 | tar xf $LIBXML2_FULLNAME 16 | cd $LIBXML2_NAME 17 | ./configure --host=arm --disable-shared --with-c14n=no --with-catalog=no --with-docbook=no --with-ftp=no --with-html=yes --with-http=no --with-iconv=no --with-iso8859x=no --with-legacy=no --with-output=no --with-pattern=yes --with-push=no --with-python=no --with-reader=no --with-regexps=no --with-sax1=no --with-schematron=no --with-tree=no --with-xpath=no --with-xinclude=no --with-xptr=no --with-valid=no --with-modules=no --prefix=$ORIGDIR/target 18 | make && make install 19 | 20 | 21 | } 22 | 23 | prep_openssl() 24 | { 25 | cd $ORIGDIR 26 | OPENSSL_NAME="openssl-1.0.0s" 27 | OPENSSL_FULLNAME="$OPENSSL_NAME"".tar.gz" 28 | OPENSSL_URL="http://openssl.org/source/$OPENSSL_FULLNAME" 29 | cd downloaded 30 | wget $OPENSSL_URL 31 | tar xf $OPENSSL_FULLNAME 32 | cd $OPENSSL_NAME 33 | ./Configure --prefix=$ORIGDIR/target linux-generic32 34 | make && make install 35 | } 36 | 37 | prep_xercesc() 38 | { 39 | cd $ORIGDIR 40 | XERCESC_NAME="xerces-c-3.0.1" 41 | XERCESC_FULLNAME="$XERCESC_NAME"".tar.gz" 42 | XERCESC_URL="http://archive.apache.org/dist/xerces/c/3/sources/$XERCESC_FULLNAME" 43 | cd downloaded 44 | wget $XERCESC_URL 45 | tar xf $XERCESC_FULLNAME 46 | cd $XERCESC_NAME 47 | ./configure --prefix=$ORIGDIR/target --host=arm --enable-shared=no --disable-network 48 | make && make install 49 | } 50 | 51 | prep_boost() 52 | { 53 | cd $ORIGDIR 54 | BOOST_NAME=boost_1_59_0 55 | BOOST_FULLNAME="$BOOST_NAME".tar.bz2 56 | BOOST_URL="http://downloads.sourceforge.net/project/boost/boost/1.59.0/$BOOST_FULLNAME" 57 | cd downloaded 58 | wget $BOOST_URL 59 | tar xf $BOOST_FULLNAME 60 | cd $BOOST_NAME 61 | #bash 62 | 63 | # build Boost.Build 64 | cd tools/build 65 | ./bootstrap.sh 66 | mkdir BoostBuildBin 67 | ./b2 install --prefix=BoostBuildBin 68 | export PATH=`pwd`/BoostBuildBin/bin:$PATH 69 | cd ../../ 70 | echo "using gcc : arm : $CC ;" > user-config.jam 71 | export BOOST_BUILD_PATH=`pwd` 72 | b2 toolset=gcc-arm --with-program_options --with-system link=static threading=multi --prefix=$ORIGDIR/target install 73 | 74 | 75 | } 76 | 77 | prep_xsd() 78 | { 79 | cd $ORIGDIR 80 | XSD_NAME="xsd-3.3.0-2" 81 | XSD_FULLNAME="$XSD_NAME".tar.bz2 82 | XSD_URL="http://www.codesynthesis.com/download/xsd/3.3/$XSD_FULLNAME" 83 | cd downloaded 84 | wget $XSD_URL 85 | tar xf $XSD_FULLNAME 86 | cd $XSD_NAME 87 | mkdir $ORIGDIR/target 88 | mkdir $ORIGDIR/target/include 89 | cp -Rv libxsd/xsd/ $ORIGDIR/target/include/ 90 | } 91 | 92 | rm -rf downloaded 93 | rm -rf target 94 | mkdir downloaded 95 | mkdir target 96 | prep_libxml2 97 | prep_openssl 98 | prep_xercesc 99 | prep_boost 100 | prep_xsd 101 | -------------------------------------------------------------------------------- /Documentation/External/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/External/diagram.png -------------------------------------------------------------------------------- /Documentation/External/transformations.odg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/External/transformations.odg -------------------------------------------------------------------------------- /Documentation/External/transformations.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/External/transformations.pdf -------------------------------------------------------------------------------- /Documentation/External/variable_types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/External/variable_types.png -------------------------------------------------------------------------------- /Documentation/Makefile: -------------------------------------------------------------------------------- 1 | # Minimal makefile for Sphinx documentation 2 | # 3 | 4 | # You can set these variables from the command line, and also 5 | # from the environment for the first two. 6 | SPHINXOPTS ?= 7 | SPHINXBUILD ?= sphinx-build 8 | SOURCEDIR = source 9 | BUILDDIR = build 10 | 11 | # Put it first so that "make" without argument is like "make help". 12 | help: 13 | @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 14 | 15 | .PHONY: help Makefile 16 | 17 | # Catch-all target: route all unknown targets to Sphinx using the new 18 | # "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS). 19 | %: Makefile 20 | @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O) 21 | -------------------------------------------------------------------------------- /Documentation/Notes/Main_restructuring.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/Main_restructuring.odt -------------------------------------------------------------------------------- /Documentation/Notes/Open62541_UaToolkit_compat.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/Open62541_UaToolkit_compat.png -------------------------------------------------------------------------------- /Documentation/Notes/QuasarThreadPoolScheduling.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/QuasarThreadPoolScheduling.pdf -------------------------------------------------------------------------------- /Documentation/Notes/open62541_vs_uatoolkit.odt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/open62541_vs_uatoolkit.odt -------------------------------------------------------------------------------- /Documentation/Notes/open62541_vs_uatoolkit.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/open62541_vs_uatoolkit.pdf -------------------------------------------------------------------------------- /Documentation/Notes/quasarSanitizers.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/quasarSanitizers.pdf -------------------------------------------------------------------------------- /Documentation/Notes/quasar_files_txt_proposal.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/Notes/quasar_files_txt_proposal.pdf -------------------------------------------------------------------------------- /Documentation/make.bat: -------------------------------------------------------------------------------- 1 | @ECHO OFF 2 | 3 | pushd %~dp0 4 | 5 | REM Command file for Sphinx documentation 6 | 7 | if "%SPHINXBUILD%" == "" ( 8 | set SPHINXBUILD=sphinx-build 9 | ) 10 | set SOURCEDIR=source 11 | set BUILDDIR=build 12 | 13 | %SPHINXBUILD% >NUL 2>NUL 14 | if errorlevel 9009 ( 15 | echo. 16 | echo.The 'sphinx-build' command was not found. Make sure you have Sphinx 17 | echo.installed, then set the SPHINXBUILD environment variable to point 18 | echo.to the full path of the 'sphinx-build' executable. Alternatively you 19 | echo.may add the Sphinx directory to PATH. 20 | echo. 21 | echo.If you don't have Sphinx installed, grab it from 22 | echo.https://www.sphinx-doc.org/ 23 | exit /b 1 24 | ) 25 | 26 | if "%1" == "" goto help 27 | 28 | %SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 29 | goto end 30 | 31 | :help 32 | %SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O% 33 | 34 | :end 35 | popd 36 | -------------------------------------------------------------------------------- /Documentation/requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx_rtd_theme==1.0.0 2 | sphinx==5.0.2 3 | pypandoc==1.8.1 -------------------------------------------------------------------------------- /Documentation/source/DesignManual.rst: -------------------------------------------------------------------------------- 1 | | The Generic OPC UA Server Framework 2 | | Design File Manual 3 | 4 | Class 5 | ===== 6 | 7 | | 8 | 9 | Cachevariable 10 | ------------- 11 | 12 | Attributes of cachevariable 13 | --------------------------- 14 | 15 | addressSpaceWrite 16 | ~~~~~~~~~~~~~~~~~ 17 | 18 | makeSetGet 19 | ~~~~~~~~~~ 20 | 21 | | This attribute is deprecated and will be completely removed soon. 22 | 23 | dataType 24 | ~~~~~~~~ 25 | 26 | | 27 | 28 | initializeWith 29 | ~~~~~~~~~~~~~~ 30 | 31 | | Determines what the cachevariable will be initialized with before any 32 | custom code or any OPC UA client write is effective. 33 | 34 | - When configuration, an appropriate entry is made in the 35 | Configuration.xsd file which in turn adds s 36 | 37 | | 38 | | initialValue 39 | 40 | initialStatus 41 | ~~~~~~~~~~~~~ 42 | 43 | | When initializeWith=valueAndStatus, this attribute gives the initial 44 | status of the cachevariable. 45 | | When initializeWith is different, this attribute is ignored. 46 | 47 | isKey 48 | ~~~~~ 49 | 50 | nullPolicy 51 | ~~~~~~~~~~ 52 | 53 | - When nullForbidden, the cachevariable is never allowed to contain 54 | NULL. This applies to setters (Device Logic can't set NULL), OPC UA 55 | Client write operations (write operation carrying NULL will be 56 | denied) and initialization (when initializeFrom=valueAndStatus, 57 | initialValue is mandatory to be given). Also, thanks to this setting 58 | a short getter will be created. 59 | - When nullAllowed, there is no restriction towards NULL. 60 | 61 | | 62 | 63 | Relations between nullPolicy, initializeWith and initialValue attributes 64 | ------------------------------------------------------------------------ 65 | 66 | | 67 | 68 | +-----------------+-----------------+-----------------+-----------------+ 69 | | nullPolicy | initializeWith | initialValue | Comment | 70 | +-----------------+-----------------+-----------------+-----------------+ 71 | | nullAllowed | configuration | NOT RELEVANT | | 72 | +-----------------+-----------------+-----------------+-----------------+ 73 | | nullAllowed | valueAndStatus | - If not | | 74 | | | | present, the | | 75 | | | | value is | | 76 | | | | initialized | | 77 | | | | as NULL. | | 78 | | | | - If present, | | 79 | | | | the value is | | 80 | | | | initialized | | 81 | | | | with the | | 82 | | | | attribute | | 83 | | | | contents. | | 84 | +-----------------+-----------------+-----------------+-----------------+ 85 | | nullForbidden | configuration | NOT RELEVANT | | 86 | +-----------------+-----------------+-----------------+-----------------+ 87 | | nullForbidden | valueAndStatus | MUST BE PRESENT | | 88 | +-----------------+-----------------+-----------------+-----------------+ 89 | 90 | | 91 | -------------------------------------------------------------------------------- /Documentation/source/_init_ext.rst: -------------------------------------------------------------------------------- 1 | External files 2 | ============== 3 | 4 | 5 | -------------------------------------------------------------------------------- /Documentation/source/_init_index.rst: -------------------------------------------------------------------------------- 1 | Quasar 2 | ====== 3 | 4 | | The quick opcua server generation framework. 5 | 6 | | For quick start-up, see our `YouTube 7 | tutorial `__. 8 | 9 | | Primary contact: quasar-developers@cern.ch 10 | 11 | 12 | -------------- 13 | 14 | 15 | .. toctree:: 16 | :hidden: 17 | :caption: Documentation 18 | 19 | 20 | 21 | 22 | .. toctree:: 23 | :hidden: 24 | :caption: Additional files 25 | 26 | 27 | 28 | 29 | .. toctree:: 30 | :hidden: 31 | :caption: Quasar OpcUa Server 32 | 33 | Summary of known quasar-based OPC UA servers <./quasar_OPC_UA_servers> 34 | 35 | -------------------------------------------------------------------------------- /Documentation/source/_init_notes.rst: -------------------------------------------------------------------------------- 1 | Notes 2 | ================ 3 | 4 | 5 | -------------------------------------------------------------------------------- /Documentation/source/_static/css/default.css: -------------------------------------------------------------------------------- 1 | * { 2 | table-layout: fixed !important; 3 | } 4 | 5 | #changelog table { 6 | width: 175% !important; 7 | } 8 | 9 | #changelog table th td { 10 | white-space: normal !important; 11 | } 12 | 13 | .wy-nav-content-wrap { 14 | background: #fcfcfc !important; 15 | } 16 | 17 | #changelog .wy-table-responsive { 18 | overflow: visible !important; 19 | } 20 | 21 | #changelog table td:nth-child(1) { 22 | max-width: 10% !important; 23 | width: 10% !important; 24 | } 25 | 26 | #changelog table td:nth-child(4) { 27 | max-width: 30% !important; 28 | width: 30% !important; 29 | } 30 | 31 | table.sortable { 32 | font-family: Arial, Helvetica, sans-serif; 33 | } 34 | 35 | table.sortable { 36 | border-width: 10px; 37 | border-collapse: collapse; 38 | } 39 | table.sortable td, th { 40 | border: 1px solid #bbb; 41 | padding: 4px; 42 | } 43 | table.sortable th { 44 | background-color: #4CAF50; 45 | color: white; 46 | text-align: left; 47 | padding-top: 12px; 48 | padding-bottom: 12px; 49 | } 50 | table.sortable .tr_phase { 51 | background-color: #bce3be; 52 | text-align: center; 53 | font-style: italic; 54 | } 55 | 56 | .wy-table-responsive table td { 57 | white-space: normal !important; 58 | } 59 | .wy-table-responsive { 60 | overflow: visible !important; 61 | } -------------------------------------------------------------------------------- /Documentation/source/_static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/_static/favicon.ico -------------------------------------------------------------------------------- /Documentation/source/_static/quasar_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/_static/quasar_logo.png -------------------------------------------------------------------------------- /Documentation/source/_static/versions.json: -------------------------------------------------------------------------------- 1 | { 2 | "versions": [ 3 | "latest", 4 | "v1.7.1", 5 | "v1.7.0", 6 | "v1.6.1", 7 | "v1.6.0", 8 | "v1.5.18", 9 | "v1.5.17", 10 | "v1.5.16", 11 | "v1.5.15", 12 | "v1.5.14", 13 | "v1.5.13", 14 | "v1.5.12", 15 | "v1.5.11", 16 | "v1.5.10", 17 | "v1.5.9", 18 | "v1.5.8", 19 | "v1.5.7", 20 | "v1.5.6", 21 | "v1.5.0", 22 | "v1.4.0", 23 | "v1.3.0", 24 | "v1.2.0" 25 | ], 26 | "labels": { 27 | "latest": "Latest" 28 | }, 29 | "warnings": {}, 30 | "latest": "latest" 31 | } -------------------------------------------------------------------------------- /Documentation/source/conf.py: -------------------------------------------------------------------------------- 1 | # Configuration file for the Sphinx documentation builder. 2 | # 3 | # This file only contains a selection of the most common options. For a full 4 | # list see the documentation: 5 | # https://www.sphinx-doc.org/en/master/usage/configuration.html 6 | 7 | # -- Path setup -------------------------------------------------------------- 8 | 9 | # If extensions (or modules to document with autodoc) are in another directory, 10 | # add these directories to sys.path here. If the directory is relative to the 11 | # documentation root, use os.path.abspath to make it absolute, like shown here. 12 | # 13 | # import os 14 | # import sys 15 | # sys.path.insert(0, os.path.abspath('.')) 16 | 17 | import subprocess 18 | import datetime 19 | 20 | def get_git_commit_hash(): 21 | try: 22 | return subprocess.check_output(['git', 'rev-parse', '--short', 'HEAD']).decode('ascii').strip() 23 | except Exception: 24 | return 'N/A' 25 | 26 | def get_current_date(): 27 | return datetime.datetime.now().strftime("%Y-%m-%d") 28 | 29 | # -- Project information ----------------------------------------------------- 30 | 31 | project = 'quasar' 32 | copyright = '2021-2024, Paris Moschovakos' 33 | author = 'Paris Moschovakos' 34 | 35 | 36 | # -- General configuration --------------------------------------------------- 37 | 38 | # Add any Sphinx extension module names here, as strings. They can be 39 | # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom 40 | # ones. 41 | extensions = [ ] 42 | 43 | # Add any paths that contain templates here, relative to this directory. 44 | templates_path = ['_templates'] 45 | 46 | # List of patterns, relative to source directory, that match files and 47 | # directories to ignore when looking for source files. 48 | # This pattern also affects html_static_path and html_extra_path. 49 | exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] 50 | 51 | 52 | # -- Options for HTML output ------------------------------------------------- 53 | 54 | # The theme to use for HTML and HTML Help pages. See the documentation for 55 | # a list of builtin themes. 56 | # 57 | html_theme = 'sphinx_rtd_theme' 58 | 59 | # Add any paths that contain custom static files (such as style sheets) here, 60 | # relative to this directory. They are copied after the builtin static files, 61 | # so a file named "default.css" will overwrite the builtin "default.css". 62 | html_static_path = ['_static'] 63 | html_logo = "_static/quasar_logo.png" 64 | 65 | html_css_files = [ 66 | 'css/default.css' 67 | ] 68 | 69 | html_js_files = [ 70 | 'js/doc-version.js' 71 | ] 72 | 73 | html_favicon = '_static/favicon.ico' 74 | 75 | locale_dirs = ['../locales'] 76 | 77 | html_context = { 78 | "display_github": False, 79 | "commit": get_git_commit_hash(), 80 | "last_updated": get_current_date(), 81 | } -------------------------------------------------------------------------------- /Documentation/source/external_files.rst: -------------------------------------------------------------------------------- 1 | External files 2 | ============== 3 | 4 | - `Diagram.png `_ 5 | - `Enice win configuration.cmake `_ 6 | - `Transformations.odg `_ 7 | - `Transformations.pdf `_ 8 | - `Variable types.png `_ 9 | 10 | -------------------------------------------------------------------------------- /Documentation/source/images/CalculatedVariablesClassDiagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/CalculatedVariablesClassDiagram.png -------------------------------------------------------------------------------- /Documentation/source/images/SynchronizationExample.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/SynchronizationExample.png -------------------------------------------------------------------------------- /Documentation/source/images/diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/diagram.png -------------------------------------------------------------------------------- /Documentation/source/images/opc-ua-items-for-logging-verbosity.PNG: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/opc-ua-items-for-logging-verbosity.PNG -------------------------------------------------------------------------------- /Documentation/source/images/quasar_engine_small_smooth_square_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/quasar_engine_small_smooth_square_128x128.png -------------------------------------------------------------------------------- /Documentation/source/images/quasar_logo.ai: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/quasar_logo.ai -------------------------------------------------------------------------------- /Documentation/source/images/sample_design.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/sample_design.png -------------------------------------------------------------------------------- /Documentation/source/images/variable_types.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/Documentation/source/images/variable_types.png -------------------------------------------------------------------------------- /Documentation/source/index.rst: -------------------------------------------------------------------------------- 1 | quasar 2 | ====== 3 | 4 | | The quick opcua server generation framework. 5 | 6 | | For quick start-up, see our `YouTube 7 | tutorial `__. 8 | 9 | | Primary contact: quasar-developers@cern.ch 10 | 11 | 12 | -------------- 13 | 14 | 15 | .. toctree:: 16 | :hidden: 17 | :caption: Documentation 18 | 19 | 20 | Alternative backends <./AlternativeBackends> 21 | Calculated variables <./CalculatedVariables> 22 | ChangeLog <./ChangeLog> 23 | Design manual <./DesignManual> 24 | For quasar developers <./forQuasarDevelopers> 25 | LogIt <./LogIt> 26 | quasar <./quasar> 27 | 28 | quasar build system <./quasarBuildSystem> 29 | quasar commands <./quasarCommands> 30 | User defined command line parameters <./UserDefinedCommandLineParameters> 31 | User defined runtime configuration modification <./UserDefinedRuntimeConfigurationModification> 32 | Windows setup <./WindowsSetup> 33 | Yocto <./yocto> 34 | Youtube links <./youtube_links> 35 | 36 | .. toctree:: 37 | :hidden: 38 | :caption: Additional files 39 | 40 | 41 | External files <./external_files> 42 | Notes files <./notes_files> 43 | 44 | 45 | .. toctree:: 46 | :hidden: 47 | :caption: quasar OPC UA Servers 48 | 49 | Summary of known quasar-based OPC UA servers <./quasar_OPC_UA_servers> 50 | 51 | -------------------------------------------------------------------------------- /Documentation/source/notes_files.rst: -------------------------------------------------------------------------------- 1 | Notes 2 | ================ 3 | 4 | - `Main restructuring.odt `_ 5 | - `Main restructuring uml.xmi `_ 6 | - `Open62541 ua toolkit compat.png `_ 7 | - `Open62541 ua toolkit compat.xmi `_ 8 | - `Open62541 vs uatoolkit.odt `_ 9 | - `Open62541 vs uatoolkit.pdf `_ 10 | - `QuasarThreadPoolScheduling.pdf `_ 11 | - `quasarSanitizers.pdf `_ 12 | -------------------------------------------------------------------------------- /Documentation/source/quasar_OPC_UA_servers.rst: -------------------------------------------------------------------------------- 1 | quasar OPC UA servers 2 | ====================== 3 | 4 | .. raw:: html 5 | :url: https://gitlab.cern.ch/atlas-dcs-opcua-servers/ListKnownQuasarOpcUaServers/-/raw/master/quasar_opcua_servers.html 6 | -------------------------------------------------------------------------------- /Documentation/source/youtube_links.rst: -------------------------------------------------------------------------------- 1 | YouTube Links 2 | ============= 3 | 4 | `Quasar YouTube 5 | channel `__ 6 | -------------------------------------------------------------------------------- /Documentation/tools/update_versions.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import json 4 | 5 | QUASAR_PASS = os.environ.get('QUASAR_PASS') 6 | 7 | JSON_FILE = './Documentation/source/_static/versions.json' 8 | JSON_FILE_LOCAL = '/home/quasar/quasar/versions.json' 9 | 10 | VERSIONS_FOLDER = '/usr/share/nginx/quasar/version' 11 | EOS_VERSIONS_FOLDER = '/eos/project-q/quasar/www/version' 12 | 13 | if __name__ == '__main__': 14 | cp_local_command = f'cp {JSON_FILE} {JSON_FILE_LOCAL}' 15 | print(f'Copying last version.json to local folder: ', cp_local_command) 16 | os.system(cp_local_command) 17 | 18 | for folder_version in os.listdir(VERSIONS_FOLDER): 19 | print('Processing version: ', folder_version) 20 | 21 | cp_nginx_command = f'echo \"{QUASAR_PASS}\" | sudo -S cp {JSON_FILE_LOCAL} {VERSIONS_FOLDER}/{folder_version}/_static/versions.json' 22 | os.system(cp_nginx_command) 23 | 24 | cp_eos_command = f'cp {JSON_FILE_LOCAL} {EOS_VERSIONS_FOLDER}/{folder_version}/_static/versions.json' 25 | os.system(cp_eos_command) 26 | 27 | exit(0) 28 | -------------------------------------------------------------------------------- /Extra/yocto/CMakeEpilogue.cmake: -------------------------------------------------------------------------------- 1 | INSTALL(TARGETS ${EXECUTABLE} DESTINATION ${CMAKE_INSTALL_PREFIX} ) 2 | INSTALL(FILES 3 | ${PROJECT_SOURCE_DIR}/bin/config.xml 4 | ${PROJECT_BINARY_DIR}/Configuration/Configuration.xsd 5 | DESTINATION 6 | ${CMAKE_INSTALL_PREFIX} 7 | ) -------------------------------------------------------------------------------- /Extra/yocto/my-opcua-server.bb: -------------------------------------------------------------------------------- 1 | # Author: Piotr Nikiel 2 | # Author: Giordon Stark 3 | 4 | LICENSE = "LGPL" 5 | LIC_FILES_CHKSUM = "file://LICENSE.TXT;md5=e94f6920e0f51ea34f43be88dc810edc" 6 | 7 | # No information for SRC_URI yet (only an external source tree was specified) 8 | SRC_URI = "git:///home/pnikiel/gitProjects/poky-quasar/;rev=master" 9 | S = "${WORKDIR}/git" 10 | 11 | inherit cmake pythonnative 12 | 13 | DEPENDS = "boost python-lxml-native xsd-native xerces-c python-enum34-native python-six-native " 14 | 15 | # add "pygit2-native python-cffi-native " to DEPENDS to properly provide embedding of git commit id 16 | 17 | # install it correctly, manually 18 | do_install() { 19 | # install configuration files to /etc/quasar/* 20 | install -d ${D}${sysconfdir}/quasar/ 21 | install -m 0755 ${B}/Configuration/Configuration.xsd ${D}${sysconfdir}/quasar/ 22 | install -m 0755 ${S}/bin/config.xml ${D}${sysconfdir}/quasar/ 23 | # install binary to /usr/bin 24 | install -d ${D}${bindir}/ 25 | install -m 0755 ${B}/bin/OpcUaServer ${D}${bindir}/ 26 | } 27 | -------------------------------------------------------------------------------- /Extra/yocto/pygit2_0.24.1.bb: -------------------------------------------------------------------------------- 1 | inherit pypi setuptools 2 | SUMMARY = "Pygit2 is a set of Python bindings to the libgit2 shared library" 3 | LICENSE = "MIT" 4 | LIC_FILES_CHKSUM = "file://LICENSE;md5=6f00d4a50713fa859858dd9abaa35b21" 5 | 6 | SRC_URI[md5sum] = "dd98b6a9fded731e36ca5a40484c8545" 7 | SRC_URI[sha256sum] = "4d1d0196b38d6012faf0a7c45e235c208315672b6035da504566c605ba494064" 8 | 9 | do_compile_append() { 10 | ${PYTHON} setup.py -q bdist_egg --dist-dir ./ 11 | } 12 | do_install_append() { 13 | install -m 0644 ${S}/*.egg ${D}/${PYTHON_SITEPACKAGES_DIR}/ 14 | } 15 | 16 | DEPENDS_${PN} += "libgit2-native_0.24.1 " 17 | 18 | BBCLASSEXTEND = "native nativesdk" 19 | 20 | 21 | -------------------------------------------------------------------------------- /Extra/yocto/python-enum34_1.1.6.bb: -------------------------------------------------------------------------------- 1 | SUMMARY = "backport of Python 3.4's enum package" 2 | LICENSE = "BSD-3-Clause" 3 | LIC_FILES_CHKSUM = "file://enum/LICENSE;md5=0a97a53a514564c20efd7b2e8976c87e" 4 | 5 | SRC_URI[md5sum] = "5f13a0841a61f7fc295c514490d120d0" 6 | SRC_URI[sha256sum] = "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1" 7 | 8 | 9 | BBCLASSEXTEND = "native" 10 | 11 | inherit pypi setuptools 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /Extra/yocto/xsd_4.0.0.bb: -------------------------------------------------------------------------------- 1 | # 2 | # This file is protected by Copyright. Please refer to the COPYRIGHT file distributed 3 | # with this source distribution. 4 | # 5 | # This file is part of Geon Technology's meta-redhawk-sdr. 6 | # 7 | # Geon Technology's meta-redhawk-sdr is free software: you can redistribute it and/or 8 | # modify it under the terms of the GNU Lesser General Public License as published by 9 | # the Free Software Foundation, either version 3 of the License, or (at your option) 10 | # any later version. 11 | # 12 | # Geon Technology's meta-redhawk-sdr is distributed in the hope that it will be useful, 13 | # but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 14 | # FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more 15 | # details. 16 | # 17 | # You should have received a copy of the GNU Lesser General Public License 18 | # along with this program. If not, see http://www.gnu.org/licenses/. 19 | # 20 | 21 | DESCRIPTION = "XSD Libraries for XML parsing" 22 | SECTION = "devel" 23 | PRIORITY = "optional" 24 | LICENSE = "GPL-2.0" 25 | LIC_FILES_CHKSUM = "file://xsd/LICENSE;md5=79e31466c4d9f3a85f2f987c11ebcd83" 26 | 27 | DEPENDS = "" 28 | DEPENDS_virtclass-native = "xerces-c xsd-dev" 29 | BBCLASSEXTEND = "native" 30 | 31 | PROVIDES += "${PN}-dev ${PN}-dev-native" 32 | 33 | SRC_URI = "\ 34 | http://www.codesynthesis.com/download/xsd/4.0/xsd-4.0.0+dep.tar.bz2 \ 35 | " 36 | SRC_URI[md5sum] = "ae64d7fcd258addc9b045fe3f96208bb" 37 | SRC_URI[sha256sum] = "eca52a9c8f52cdbe2ae4e364e4a909503493a0d51ea388fc6c9734565a859817" 38 | 39 | 40 | S = "${WORKDIR}/xsd-4.0.0+dep" 41 | 42 | # Per http://www.codesynthesis.com/pipermail/xsde-users/2012-October/000535.html 43 | # Boris says to get the binary for the host, then cross-compile and install libxsd... 44 | # However libxsd is header-only, so this is really just making the executable visible 45 | # to the host and the headers installed on the target. 46 | 47 | do_configure () { 48 | : 49 | } 50 | do_compile () { 51 | : 52 | } 53 | do_install () { 54 | install -d ${D}${includedir} 55 | cp -r ${S}/xsd/libxsd/xsd ${D}${includedir}/xsd 56 | } 57 | 58 | do_compile_virtclass-native () { 59 | oe_runmake 60 | } 61 | 62 | do_install_virtclass-native () { 63 | install -m 0755 -D ${S}/xsd/xsd/xsd ${D}${bindir}/xsdcxx 64 | } 65 | -------------------------------------------------------------------------------- /Extra/yocto/yocto_open62541_config.cmake: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2015, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | # 17 | # Author: Piotr Nikiel 18 | # @author pnikiel 19 | # @date May-2018 20 | # This file is a build config for a quasar-based project specially dedicated to Yocto/PetaLinux builds. 21 | 22 | #----- 23 | #General settings 24 | #----- 25 | 26 | add_definitions(-Wall -Wno-deprecated) 27 | 28 | # open62541-compat has no uatrace 29 | set (LOGIT_HAS_UATRACE FALSE) 30 | 31 | # need C++11 32 | set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" ) 33 | 34 | set( QUASAR_IS_CMAKE_BUILD_ENTRY_POINT TRUE ) 35 | 36 | #------- 37 | #Boost 38 | #------- 39 | # In a well configured Yocto project this should be OK 40 | SET( BOOST_LIBS "-lboost_program_options-mt -lboost_thread-mt -lboost_system-mt" ) 41 | 42 | message ("using BOOST_LIBS [${BOOST_LIBS}]") 43 | 44 | #------ 45 | #OPCUA 46 | #------ 47 | 48 | # No OPC-UA Toolkit: using Open62541-compat instead. It is referenced in BACKEND_MODULES below 49 | add_definitions( -DBACKEND_OPEN62541 ) 50 | SET( OPCUA_TOOLKIT_PATH "" ) 51 | SET( OPCUA_TOOLKIT_LIBS_RELEASE "${PROJECT_BINARY_DIR}/open62541-compat/open62541/libopen62541.a" -lrt -lpthread) 52 | SET( OPCUA_TOOLKIT_LIBS_DEBUG "${PROJECT_BINARY_DIR}/open62541-compat/open62541/libopen62541.a" -lrt -lpthread) 53 | include_directories( ${PROJECT_BINARY_DIR}/open62541-compat/open62541 ) 54 | 55 | #----- 56 | #XML Libs 57 | #----- 58 | #As of 03-Sep-2015 I see no FindXerces or whatever in our Cmake 2.8 installation, so no find_package can be user... 59 | # TODO perhaps also take it from environment if requested 60 | SET( XML_LIBS "-lxerces-c -lssl" ) 61 | 62 | -------------------------------------------------------------------------------- /FrameworkInternals/BoostSetup.cmake: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2020, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Piotr Nikiel 18 | # Author: Paris Moschovakos 19 | # Author: Stefan Schlenker 20 | 21 | # 22 | # automatically set up boost with libs needed by quasar 23 | # and optionally added ones for the project via ADDITIONAL_BOOST_LIBS 24 | # 25 | set(Boost_NO_BOOST_CMAKE ON) # workaround for boost-1.7.0 cmake config modules: disabling search for boost-cmake to use FindBoost instead 26 | find_package(Boost REQUIRED regex chrono program_options thread system ${ADDITIONAL_BOOST_LIBS} ) 27 | if(NOT Boost_FOUND) 28 | message(FATAL_ERROR "Failed to find boost installation") 29 | else() 30 | message(STATUS "Found system boost, version [${Boost_VERSION}], include dir [${Boost_INCLUDE_DIRS}] library dir [${Boost_LIBRARY_DIRS}], libs [${Boost_LIBRARIES}]") 31 | include_directories( ${Boost_INCLUDE_DIRS} ) 32 | set( BOOST_LIBS ${Boost_LIBRARIES} ) 33 | endif() 34 | -------------------------------------------------------------------------------- /FrameworkInternals/EnabledModules/open62541-compat.minVersion: -------------------------------------------------------------------------------- 1 | 1.0.0 2 | -------------------------------------------------------------------------------- /FrameworkInternals/EnabledModules/open62541-compat.tag: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/FrameworkInternals/EnabledModules/open62541-compat.tag -------------------------------------------------------------------------------- /FrameworkInternals/EnabledModules/open62541-compat.url: -------------------------------------------------------------------------------- 1 | https://github.com/quasar-team/open62541-compat.git 2 | -------------------------------------------------------------------------------- /FrameworkInternals/OptionalModule.cmake: -------------------------------------------------------------------------------- 1 | cmake_minimum_required(VERSION 2.8) 2 | 3 | #message ("Configuring optional module ${OPT_MODULE_NAME}") 4 | project(${OPT_MODULE_NAME}_download NONE) 5 | include(ExternalProject) 6 | ExternalProject_Add( 7 | ${OPT_MODULE_NAME} 8 | GIT_REPOSITORY ${OPT_MODULE_URL} 9 | GIT_TAG ${OPT_MODULE_TAG} 10 | PREFIX "${CMAKE_BINARY_DIR}/FrameworkInternals/EnabledModules/${OPT_MODULE_NAME}_download" 11 | SOURCE_DIR "${CMAKE_BINARY_DIR}/${OPT_MODULE_NAME}" 12 | CONFIGURE_COMMAND "" 13 | BUILD_COMMAND "" 14 | UPDATE_COMMAND "" 15 | PATCH_COMMAND "" 16 | TEST_COMMAND "" 17 | INSTALL_COMMAND "" 18 | LOG_UPDATE 1 # Wrap update in script to log output 19 | LOG_CONFIGURE 1 # Wrap configure in script to log output 20 | LOG_BUILD 1 # Wrap build in script to log output 21 | LOG_TEST 1 # Wrap test in script to log output 22 | LOG_INSTALL 1 23 | ) 24 | #message ("Configure of optional module ${OPT_MODULE_NAME} finished") 25 | -------------------------------------------------------------------------------- /FrameworkInternals/OptionalModules.cmake: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2015, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Stefan Schlenker 18 | # Author: Piotr Nikiel 19 | 20 | file(GLOB OPTIONAL_SERVER_MODULE_URLS "FrameworkInternals/EnabledModules/*.url") 21 | 22 | include( FrameworkInternals/UrlHandling.cmake ) 23 | foreach(moduleFile ${OPTIONAL_SERVER_MODULE_URLS}) 24 | # 25 | file (STRINGS ${moduleFile} OPT_MODULE_URL) 26 | 27 | process_git_url(OPT_MODULE_URL) 28 | 29 | get_filename_component(module ${moduleFile} NAME_WE) 30 | file (STRINGS FrameworkInternals/EnabledModules/${module}.tag OPT_MODULE_TAG) 31 | message("Adding module ${module} URL=${OPT_MODULE_URL} TAG=${OPT_MODULE_TAG}") 32 | set(OPTIONAL_SERVER_MODULES ${OPTIONAL_SERVER_MODULES} ${module}) 33 | set(OPT_MODULE_NAME ${module}) 34 | configure_file(${PROJECT_SOURCE_DIR}/FrameworkInternals/OptionalModule.cmake 35 | FrameworkInternals/EnabledModules/${OPT_MODULE_NAME}_cmake/CMakeLists.txt) 36 | execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/FrameworkInternals/EnabledModules/${OPT_MODULE_NAME}_cmake) 37 | execute_process(COMMAND ${CMAKE_COMMAND} --build . --config ${CMAKE_BUILD_TYPE} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/FrameworkInternals/EnabledModules/${OPT_MODULE_NAME}_cmake OUTPUT_FILE ${CMAKE_BINARY_DIR}/FrameworkInternals/EnabledModules/${OPT_MODULE_NAME}_download.log) 38 | if (EXISTS ${CMAKE_BINARY_DIR}/${OPT_MODULE_NAME}) 39 | message("Module ${module} was added.") 40 | execute_process(COMMAND git remote set-url --push origin push-disabled WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/${OPT_MODULE_NAME}) 41 | else() 42 | message("Error, module ${module} was not properly fetched. Please check FrameworkInternals/EnabledModules/${module}_download.log for errors.") 43 | endif() 44 | # 45 | endforeach(moduleFile) 46 | -------------------------------------------------------------------------------- /FrameworkInternals/UrlHandling.cmake: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2020, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Stefan Schlenker 18 | 19 | function ( process_git_url URL ) 20 | 21 | # replace git server base URL if defined in project settings 22 | # example: setting GIT_SERVER_REPLACEMENT="ssh://gitlab.com:7999/" 23 | # and calling process_git_url(URL) with URL=https://github.com/quasar-team/MyQuasarModule.git 24 | # results in URL to be set to "ssh://gitlab.com:7999/quasar-team/MyQuasarModule.git" 25 | # 26 | if (DEFINED GIT_SERVER_REPLACEMENT) 27 | set( NEW_URL ${${URL}} ) 28 | set( MATCHED ) 29 | string(REGEX MATCH "(http|https|ssh):\\/\\/[-a-zA-Z0-9@:%._\\+~#=]+\\.[a-z]+(:[0-9]+)?\\/" MATCHED ${NEW_URL}) 30 | message("process_git_url(): Matched ${MATCHED} in ${${URL}}") 31 | if ( MATCHED ) 32 | string(REPLACE ${MATCHED} ${GIT_SERVER_REPLACEMENT} NEW_URL ${NEW_URL}) 33 | message("process_git_url(): Replaced to ${NEW_URL}") 34 | endif() 35 | 36 | set( ${URL} ${NEW_URL} PARENT_SCOPE ) 37 | endif() 38 | 39 | endfunction () 40 | -------------------------------------------------------------------------------- /FrameworkInternals/addressSpaceGenerators.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | addressSpaceGenerators.py 5 | 6 | @author: Damian Abalo Miron 7 | @author: Piotr Nikiel 8 | 9 | @copyright: 2015 CERN 10 | 11 | @license: 12 | Copyright (c) 2015, CERN, Universidad de Oviedo. 13 | All rights reserved. 14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | 19 | @contact: quasar-developers@cern.ch 20 | ''' 21 | 22 | 23 | -------------------------------------------------------------------------------- /FrameworkInternals/commandMap.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | commandMap.py 5 | 6 | @author: Damian Abalo Miron 7 | @author: Piotr Nikiel 8 | 9 | @copyright: 2015 CERN 10 | 11 | @license: 12 | Copyright (c) 2015, CERN, Universidad de Oviedo. 13 | All rights reserved. 14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | 19 | @contact: quasar-developers@cern.ch 20 | ''' 21 | 22 | 23 | commandMap = { 24 | "saxon":"saxon9he.jar", 25 | "java":"java", 26 | "astyle":"astyle", 27 | "diff":"kdiff3", 28 | "cmake":"cmake", 29 | "make":"make", 30 | "gcc":"gcc", 31 | "xmllint":"xmllint", 32 | "graphviz":"dot", 33 | "doxygen":"doxygen", 34 | "git":"git", 35 | "xsdcxx":"xsdcxx", 36 | "indent":"indent" 37 | } 38 | 39 | def getCommand(key): 40 | """ 41 | Checks the command map, and returns the command specified by the key 42 | """ 43 | return commandMap[key] 44 | -------------------------------------------------------------------------------- /FrameworkInternals/configurationGenerators.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | configurationGenerators.py 5 | 6 | @author: Damian Abalo Miron 7 | @author: Piotr Nikiel 8 | 9 | @copyright: 2015 CERN 10 | 11 | @license: 12 | Copyright (c) 2015, CERN, Universidad de Oviedo. 13 | All rights reserved. 14 | 15 | Redistribution and use in source and binary forms, with or without modification, are permitted 16 | provided that the following conditions are met: 17 | 1. Redistributions of source code must retain the above copyright notice, this 18 | list of conditions and the following disclaimer. 19 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions 20 | and the following disclaimer in the documentation and/or other materials provided with the 21 | distribution. 22 | 23 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR 24 | IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY 25 | AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 26 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF 28 | USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 29 | WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 30 | ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | 32 | @contact: quasar-developers@cern.ch 33 | ''' 34 | 35 | import os 36 | from transformDesign import TransformKeys, transformByKey, getTransformOutput 37 | from externalToolCheck import subprocessWithImprovedErrorsPipeOutputToFile 38 | from commandMap import getCommand 39 | 40 | def generateConfiguration(context): 41 | """Generates the file Configuration.xsd.""" 42 | config_xsd_path = os.path.join(context['projectBinaryDir'], 'Configuration', 'Configuration.xsd') 43 | try: 44 | transformByKey(TransformKeys.CONFIGURATION_XSD, {'context':context}) 45 | except: 46 | if os.path.isfile(config_xsd_path): 47 | os.remove(config_xsd_path) 48 | raise 49 | subprocessWithImprovedErrorsPipeOutputToFile( 50 | [getCommand("xmllint"), "--format", "--xinclude", 51 | getTransformOutput(TransformKeys.CONFIGURATION_XSD, {'context':context})], 52 | config_xsd_path, 53 | getCommand("xmllint")) 54 | -------------------------------------------------------------------------------- /FrameworkInternals/create_release.sh: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # First ---- check if everything is commited 4 | 5 | TAG=$1 6 | if [ "$TAG" == "" ]; then 7 | echo "Please provide intended TAG version , without project name e.g. 100.200.300 " 8 | exit 1 9 | fi 10 | 11 | 12 | 13 | if [ "`git status --porcelain ../ |wc -l`" != "0" ]; then 14 | echo "Some files are probably not commited, fix that first" 15 | echo "To see the list run git status" 16 | exit 1 17 | fi 18 | 19 | # after this put a version info into files 20 | echo $TAG > ../Design/quasarVersion.txt || exit 1 21 | echo "#define QUASAR_VERSION_STR \"$TAG\"" > ../Server/include/QuasarVersion.h || exit 1 22 | 23 | python ../quasar.py create_release || exit 1 24 | 25 | # after this files.txt and genericFrameworkVersion.txt has changed so should be recommited 26 | git commit -m "files.txt update in preparation for tag=$1" ../ || exit 1 27 | 28 | git push origin master || exit 1 29 | 30 | git tag -a "v$1" || exit 1 31 | 32 | git push origin "v$1" || exit 1 33 | -------------------------------------------------------------------------------- /FrameworkInternals/deviceGenerators.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | deviceGenerators.py 5 | 6 | @author: Damian Abalo Miron 7 | @author: Piotr Nikiel 8 | 9 | @copyright: 2015 CERN 10 | 11 | @license: 12 | Copyright (c) 2015, CERN, Universidad de Oviedo. 13 | All rights reserved. 14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | 19 | @contact: quasar-developers@cern.ch 20 | ''' 21 | 22 | import os 23 | from transformDesign import TransformKeys, transformByKey 24 | from quasarExceptions import WrongArguments 25 | from DesignInspector import DesignInspector 26 | 27 | def generateOneDeviceClass(context, className): 28 | transformByKey([TransformKeys.D_DEVICE_H, TransformKeys.D_DEVICE_CPP], {'context':context, 'className':className}) 29 | 30 | def generateDeviceClass(context, *classList): 31 | """Generates the files D.h and D.cpp. This method needs to be called by the user, as this is the class where the device logic is, so a manual merge will be needed. 32 | 33 | Keyword arguments: 34 | classname -- the name of the device, which this class will be associated to. You can specify several classes (up to 10), separated by spaces or just --all to regenerate all device classes. 35 | """ 36 | if len(classList) < 1: 37 | raise WrongArguments("need at least one arg for this") 38 | 39 | for aClass in classList: 40 | generateOneDeviceClass(context, aClass) 41 | 42 | def generateAllDevices(context): 43 | """Generates the files D.h and D.cpp for ALL the different devices. This method needs to be called by the user, as this is the class where the device logic is, so a manual merge will be needed. """ 44 | designInspector = DesignInspector(os.path.sep.join([context['projectSourceDir'], 'Design', 'Design.xml'])) 45 | classes = designInspector.get_names_of_all_classes(only_with_device_logic=True) 46 | for aClass in classes: 47 | generateOneDeviceClass(context, aClass) 48 | -------------------------------------------------------------------------------- /FrameworkInternals/distclean.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | distclean.py 5 | 6 | @author: Damian Abalo Miron 7 | @author: Piotr Nikiel 8 | 9 | @copyright: 2015 CERN 10 | 11 | @license: 12 | Copyright (c) 2015, CERN, Universidad de Oviedo. 13 | All rights reserved. 14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | 19 | @contact: quasar-developers@cern.ch 20 | ''' 21 | 22 | 23 | def distClean(context): 24 | """ 25 | Deprecated. Simply remove your build directory. 26 | """ 27 | print('This method has been deprecated since quasar 1.3.0. Please simply remove (e.g. rm -Rf) your build directory.') 28 | -------------------------------------------------------------------------------- /FrameworkInternals/generateHonkyTonk.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/quasar-team/quasar/5bb4327d71de97b9799e5d7d02a6aaf3d032fc8b/FrameworkInternals/generateHonkyTonk.py -------------------------------------------------------------------------------- /FrameworkInternals/quasarExceptions.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | quasarExceptions.py 5 | 6 | @author: Piotr Nikiel 7 | 8 | @copyright: 2018 CERN 9 | 10 | @license: 11 | Copyright (c) 2018, CERN 12 | All rights reserved. 13 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 14 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 15 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 17 | 18 | @contact: quasar-developers@cern.ch 19 | ''' 20 | 21 | class WrongArguments(Exception): 22 | def __init__(self, desc): 23 | Exception.__init__(self, desc) 24 | 25 | class WrongReturnValue(Exception): 26 | def __init__(self, tool, return_value): 27 | Exception.__init__(self, 'WrongReturnValue: tool {tool} returned {rv}'.format( 28 | tool=tool, 29 | rv=str(return_value) 30 | )) 31 | 32 | class Mistake(Exception): 33 | def __init__(self, desc): 34 | Exception.__init__(self, desc) 35 | 36 | class DesignFlaw(Exception): 37 | def __init__(self, desc): 38 | Exception.__init__(self, desc) 39 | -------------------------------------------------------------------------------- /FrameworkInternals/quasar_utils.py: -------------------------------------------------------------------------------- 1 | ''' 2 | quasar_utils.py 3 | 4 | @author: Piotr Nikiel 5 | 6 | @copyright: 2019 CERN 7 | 8 | @license: 9 | Copyright (c) 2019, CERN 10 | All rights reserved. 11 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 12 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 13 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 15 | 16 | @contact: quasar-developers@cern.ch 17 | ''' 18 | 19 | 20 | import sys 21 | import argparse 22 | import io 23 | 24 | def amalgamate (args): 25 | print('Amalgamating {0} files as {1}'.format(len(args.inputs), args.output)) 26 | line_counter = 0 27 | f_output = io.open(args.output, 'w', encoding='utf-8') 28 | for path in args.inputs: 29 | f_in = io.open(path, 'r', encoding='utf-8') 30 | for line in f_in: 31 | f_output.write(line) 32 | line_counter += 1 33 | f_output.close() 34 | print('Wrote {0} amalgamated lines'.format(line_counter)) 35 | 36 | parser = argparse.ArgumentParser(description="Quasar BusyBox") 37 | 38 | subparsers = parser.add_subparsers() 39 | 40 | parser_amalgamate = subparsers.add_parser('amalgamate') 41 | parser_amalgamate.add_argument('output', type=str, help='path to the amalgamated file to be created') 42 | parser_amalgamate.add_argument('inputs', type=str, nargs='+', help='paths of input files') 43 | parser_amalgamate.set_defaults(func = amalgamate) 44 | 45 | args = parser.parse_args() 46 | args.func(args) 47 | -------------------------------------------------------------------------------- /FrameworkInternals/runDoxygen.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python3 2 | # encoding: utf-8 3 | ''' 4 | runDoxygen.py 5 | 6 | @author: Piotr Nikiel 7 | @author: Damian Abalo Miron 8 | 9 | @copyright: 2015 CERN 10 | 11 | @license: 12 | Copyright (c) 2015, CERN, Universidad de Oviedo. 13 | All rights reserved. 14 | Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 15 | 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 16 | 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 17 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 18 | 19 | @contact: quasar-developers@cern.ch 20 | ''' 21 | 22 | import os 23 | from externalToolCheck import subprocessWithImprovedErrors 24 | from commandMap import getCommand 25 | 26 | def runDoxygen(): 27 | """Runs doxygen in the documentation folder, making the tool generate documentation for the server automatically.""" 28 | baseDirectory = os.getcwd() 29 | os.chdir(baseDirectory + os.path.sep + "Documentation") 30 | print("Changing directory to: " + baseDirectory + os.path.sep + "Documentation") 31 | print("Calling Doxygen") 32 | subprocessWithImprovedErrors(getCommand("doxygen") , getCommand("doxygen")) 33 | os.chdir(baseDirectory) 34 | print("Changing directory to: " + baseDirectory) 35 | -------------------------------------------------------------------------------- /Meta/include/DLogLevel.h: -------------------------------------------------------------------------------- 1 | 2 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 3 | 4 | The stub of this file was generated by quasar (https://github.com/quasar-team/quasar/) 5 | 6 | Quasar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public Licence as published by 8 | the Free Software Foundation, either version 3 of the Licence. 9 | Quasar is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public Licence for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with Quasar. If not, see . 16 | 17 | 18 | */ 19 | 20 | 21 | #ifndef __DLogLevel__H__ 22 | #define __DLogLevel__H__ 23 | 24 | #include 25 | #include 26 | 27 | 28 | namespace Device 29 | { 30 | 31 | class 32 | DLogLevel 33 | : public Base_DLogLevel 34 | { 35 | 36 | public: 37 | /* sample constructor */ 38 | explicit DLogLevel ( 39 | const Configuration::LogLevel& config, 40 | Parent_DLogLevel* parent 41 | ) ; 42 | /* sample dtr */ 43 | ~DLogLevel (); 44 | 45 | /* delegators for 46 | cachevariables and sourcevariables */ 47 | /* Note: never directly call this function. */ 48 | UaStatus writeLogLevel ( const UaString& v); 49 | 50 | 51 | /* delegators for methods */ 52 | 53 | private: 54 | /* Delete copy constructor and assignment operator */ 55 | DLogLevel( const DLogLevel& other ); 56 | DLogLevel& operator=(const DLogLevel& other); 57 | 58 | // ----------------------------------------------------------------------- * 59 | // - CUSTOM CODE STARTS BELOW THIS COMMENT. * 60 | // - Don't change this comment, otherwise merge tool may be troubled. * 61 | // ----------------------------------------------------------------------- * 62 | 63 | public: 64 | 65 | private: 66 | const std::string m_componentName; 67 | 68 | 69 | 70 | }; 71 | 72 | } 73 | 74 | #endif // __DLogLevel__H__ -------------------------------------------------------------------------------- /Meta/include/DSourceVariableThreadPool.h: -------------------------------------------------------------------------------- 1 | 2 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 3 | 4 | The stub of this file was generated by quasar (https://github.com/quasar-team/quasar/) 5 | 6 | Quasar is free software: you can redistribute it and/or modify 7 | it under the terms of the GNU Lesser General Public Licence as published by 8 | the Free Software Foundation, either version 3 of the Licence. 9 | Quasar is distributed in the hope that it will be useful, 10 | but WITHOUT ANY WARRANTY; without even the implied warranty of 11 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 | GNU Lesser General Public Licence for more details. 13 | 14 | You should have received a copy of the GNU Lesser General Public License 15 | along with Quasar. If not, see . 16 | 17 | 18 | */ 19 | 20 | 21 | #ifndef __DSourceVariableThreadPool__H__ 22 | #define __DSourceVariableThreadPool__H__ 23 | 24 | #include 25 | 26 | namespace Device 27 | { 28 | 29 | class 30 | DSourceVariableThreadPool 31 | : public Base_DSourceVariableThreadPool 32 | { 33 | 34 | public: 35 | /* sample constructor */ 36 | explicit DSourceVariableThreadPool ( 37 | const Configuration::SourceVariableThreadPool& config, 38 | Parent_DSourceVariableThreadPool* parent 39 | ) ; 40 | /* sample dtr */ 41 | ~DSourceVariableThreadPool (); 42 | 43 | /* delegators for 44 | cachevariables and sourcevariables */ 45 | 46 | 47 | /* delegators for methods */ 48 | 49 | private: 50 | /* Delete copy constructor and assignment operator */ 51 | DSourceVariableThreadPool( const DSourceVariableThreadPool& other ); 52 | DSourceVariableThreadPool& operator=(const DSourceVariableThreadPool& other); 53 | 54 | // ----------------------------------------------------------------------- * 55 | // - CUSTOM CODE STARTS BELOW THIS COMMENT. * 56 | // - Don't change this comment, otherwise merge tool may be troubled. * 57 | // ----------------------------------------------------------------------- * 58 | 59 | public: 60 | 61 | private: 62 | 63 | 64 | 65 | }; 66 | 67 | } 68 | 69 | #endif // __DSourceVariableThreadPool__H__ -------------------------------------------------------------------------------- /Meta/include/MetaBuildInfo.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * MetaBuildInfo.h 3 | * 4 | * Created on: Nov 11, 2018 5 | * Author: Benjamin Farnham 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #ifndef BUILD_META_INFO_INCLUDE_VERSION_H_ 23 | #define BUILD_META_INFO_INCLUDE_VERSION_H_ 24 | 25 | #include 26 | namespace BuildMetaInfo 27 | { 28 | 29 | std::string getBuildTime(); 30 | std::string getBuildHost(); 31 | std::string getCommitID(); 32 | std::string getToolkitLibs(); 33 | 34 | } // namespace BuildMetaInfo 35 | #endif /* BUILD_META_INFO_INCLUDE_VERSION_H_ */ 36 | -------------------------------------------------------------------------------- /Meta/include/meta.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2015. All rights not expressly granted are reserved. 2 | * meta.h 3 | * 4 | * Created on: Aug 18, 2015 5 | * Author: Benjamin Farnham 6 | * Author: Piotr Nikiel 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #pragma once 24 | 25 | #include 26 | #include 27 | #include 28 | #include 29 | #include 30 | #include 31 | 32 | namespace Meta 33 | { 34 | void initializeMeta(AddressSpace::ASNodeManager *nm); 35 | void configureMeta(Configuration::Configuration & config); 36 | 37 | template 38 | AddressSpaceType* findStandardMetaDataChildObject(AddressSpace::ASNodeManager *nm, const std::string& childName) 39 | { 40 | const std::string fullChildName = "StandardMetaData."+childName; 41 | std::vector children; 42 | AddressSpace::findAllObjectsByPatternInNodeManager(nm, fullChildName, children); 43 | 44 | if(children.size() != 1) 45 | { 46 | LOG(Log::ERR) << __FUNCTION__ << " searched AS for objects matching ["< 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | #pragma once 22 | 23 | #include 24 | 25 | // Forms part of the functionality block marked with _META_BACKWARDS_COMPATIBILITY_HACK_ 26 | // handles conversion from old-skool configurations to new-skool meta to maintain 27 | // backwards compatilbility for old-skool meta configuration XML in new-skool meta. 28 | // 29 | // Old-skool meta: had a dedicated XSD shema injected into Configuration.xsd) 30 | // Configurations looked like 31 | // 32 | // 33 | // 34 | // 35 | // 36 | // 37 | // 38 | // 39 | // 40 | // 41 | // 42 | // New-skool meta: meta XSD generated from quasar templates by injecting meta-design.xml into Design.xml 43 | // 44 | // 45 | // 46 | // 47 | // 48 | // 49 | // 50 | // 51 | // 52 | // 53 | // 54 | // 55 | namespace Meta 56 | { 57 | namespace BackwardsCompatibilityUtils 58 | { 59 | void convertOldGeneralLogLevel(Configuration::Log& parent); 60 | void convertOldComponentLogLevel(Configuration::ComponentLogLevels& parent); 61 | } // namespace BackwardsCompatibilityUtils 62 | } // namespace Meta -------------------------------------------------------------------------------- /Meta/src/MetaBuildInfo.cpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2018. All rights not expressly granted are reserved. 2 | * BuildMetaInfo.cpp 3 | * 4 | * Created on: Nov 11, 2018 5 | * Author: Benjamin Farnham 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | #include "MetaBuildInfo.h" 22 | #include "MetaBuildInfoGenerated.h" // contains constants; contents generated by meta_build_info.py at build time. 23 | 24 | using std::string; 25 | 26 | string BuildMetaInfo::getBuildTime() 27 | { 28 | return GEND_BUILD_TIME; 29 | } 30 | 31 | string BuildMetaInfo::getBuildHost() 32 | { 33 | return GEND_BUILD_HOST; 34 | } 35 | 36 | std::string BuildMetaInfo::getCommitID() 37 | { 38 | return GEND_COMMIT_ID; 39 | } 40 | 41 | string BuildMetaInfo::getToolkitLibs() 42 | { 43 | return GEND_TOOLKIT_LIBS; 44 | } 45 | -------------------------------------------------------------------------------- /ProjectSettings.cmake: -------------------------------------------------------------------------------- 1 | ## ------------------------------------------------------------- 2 | ## Please see http://quasar.docs.cern.ch/quasarBuildSystem.html 3 | ## for information how to use this file. 4 | ## ------------------------------------------------------------- 5 | 6 | set(CUSTOM_SERVER_MODULES ) 7 | set(EXECUTABLE OpcUaServer) 8 | set(SERVER_INCLUDE_DIRECTORIES ) 9 | set(SERVER_LINK_LIBRARIES ) 10 | set(SERVER_LINK_DIRECTORIES ) 11 | 12 | ## 13 | ## If ON, in addition to an executable, a shared object will be created. 14 | ## 15 | set(BUILD_SERVER_SHARED_LIB OFF) 16 | 17 | ## 18 | ## Add here any additional boost libraries needed with their canonical name 19 | ## examples: date_time atomic etc. 20 | ## Note: boost paths are resolved either from $BOOST_ROOT if defined or system paths as fallback 21 | ## 22 | set(ADDITIONAL_BOOST_LIBS ) 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # quasar 2 | Quick opcUA Server generAtion fRamework 3 | 4 | The project website is [quasar.docs.cern.ch](https://quasar.docs.cern.ch/), where you can obtain more information. 5 | 6 | NOTE: Clone quasar with the _--recursive_ flag. Required since quasar uses source code from other git repositories (specifically: [LogIt](https://github.com/quasar-team/LogIt) is a [git submodule](https://git-scm.com/docs/gitsubmodules)) 7 | ```bash 8 | git clone --recursive https://github.com/quasar-team/quasar 9 | ``` 10 | 11 | ## Continuous Integration builds status 12 | 13 | CI build info | UA backend | CI build status 14 | ------------ | ------------- | ------------- 15 | linux (travis-ci) | open62541 | [![travis-ci](https://travis-ci.org/quasar-team/quasar.svg?branch=master)](https://travis-ci.org/quasar-team/quasar?branch=master) 16 | windows (appveyor) | open62541 | [![Appveyor](https://ci.appveyor.com/api/projects/status/q8ruqgd2nj54b76p/branch/master?svg=true)](https://ci.appveyor.com/project/ben-farnham/quasar/branch/master) 17 | -------------------------------------------------------------------------------- /Server/CMakeLists.txt: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2015, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | 17 | # Author: Piotr Nikiel 18 | 19 | configure_file( include/OpcuaToolkitInfo.hpp.in ${CMAKE_BINARY_DIR}/generated/OpcuaToolkitInfo.hpp ) 20 | include_directories( ${CMAKE_BINARY_DIR}/generated/ ) 21 | 22 | add_library (Server OBJECT 23 | src/main.cpp 24 | src/opcserver.cpp 25 | src/opcserver_open62541.cpp 26 | src/shutdown.cpp 27 | src/serverconfigxml.cpp 28 | src/BaseQuasarServer.cpp 29 | src/QuasarServer.cpp 30 | src/QuasarUaTraceHook.cpp 31 | ) 32 | # Ensure that this module is built as the very last one. 33 | add_dependencies( Server ${SERVER_MODULES} ) 34 | -------------------------------------------------------------------------------- /Server/include/OpcuaToolkitInfo.hpp.in: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2022. All rights not expressly granted are reserved. 2 | * OpcuaToolkitInfo.hpp 3 | * 4 | * Created on: June 22, 2022 5 | * Author: Paris Moschovakos 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #pragma once 23 | 24 | namespace OpcuaToolkitInfo 25 | { 26 | 27 | std::string getOpcuaToolkitPath() 28 | { 29 | return "@OPCUA_TOOLKIT_PATH@"; 30 | } 31 | 32 | } -------------------------------------------------------------------------------- /Server/include/QuasarServer.h: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, Universidad de Oviedo, 2015. All rights not expressly granted are reserved. 2 | * QuasarServer.h 3 | * 4 | * Created on: Nov 6, 2015 5 | * Author: Damian Abalo Miron 6 | * Author: Piotr Nikiel 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #ifndef QUASARSERVER_H_ 24 | #define QUASARSERVER_H_ 25 | 26 | #include "BaseQuasarServer.h" 27 | 28 | /* 29 | * Example class. This class overrides functionality from BaseQuasarServer in order to make the logic fit an specific implementation. 30 | * THIS CLASS SHOULD BE MODIFIED BY THE FINAL USER to contain his custom logic, or taken as an example to create his own separate file. 31 | */ 32 | class QuasarServer : public BaseQuasarServer{ 33 | public: 34 | QuasarServer(); 35 | virtual ~QuasarServer(); 36 | //Main loop of the application logic. 37 | virtual void mainLoop(); 38 | //Method for initialising LogIt. Can be overided for a specific implementation, but a default initialization is already provided. 39 | virtual void initializeLogIt(); 40 | /* 41 | * Method for initialising Custom Modules, to be overwritten by the final user 42 | * return: When the return is 0, the execution will continue normally. When the return is different than 0 it will exit the server execution. 43 | */ 44 | virtual void initialize(); 45 | //Method for deinitialising Custom Modules, to be overwritten by the final user 46 | virtual void shutdown(); 47 | private: 48 | //Disable copy-constructor and assignment-operator 49 | QuasarServer( const QuasarServer& server ); 50 | void operator=( const QuasarServer& server ); 51 | 52 | }; 53 | 54 | #endif /* QUASARSERVER_H_ */ 55 | -------------------------------------------------------------------------------- /Server/include/QuasarUaTraceHook.hpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, 2021. All rights not expressly granted are reserved. 2 | * QuasarUaTraceHook.hpp 3 | * 4 | * Created on: Oct 22, 2021 5 | * Author: Paris Moschovakos 6 | * 7 | * This file is part of Quasar. 8 | * 9 | * Quasar is free software: you can redistribute it and/or modify 10 | * it under the terms of the GNU Lesser General Public Licence as published by 11 | * the Free Software Foundation, either version 3 of the Licence. 12 | * 13 | * Quasar is distributed in the hope that it will be useful, 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 | * GNU Lesser General Public Licence for more details. 17 | * 18 | * You should have received a copy of the GNU Lesser General Public License 19 | * along with Quasar. If not, see . 20 | */ 21 | 22 | #pragma once 23 | 24 | #ifdef BACKEND_UATOOLKIT 25 | 26 | #include 27 | #include 28 | 29 | class QuasarUaTraceHook : public UaTraceHook 30 | { 31 | public: 32 | void traceOutput(UaTrace::TraceLevel traceLevel, const char * sContent, int nModule) override; 33 | private: 34 | inline const std::string getCurrentDateAndTime(); 35 | inline const std::string baseName(const std::string & filepath); 36 | inline void logMessage(const std::string & traceLevel, int nModule, const char * sContent); 37 | enum ModuleNumber 38 | { 39 | Shredder = 0, 40 | UaStack = 5 41 | }; 42 | }; 43 | 44 | #endif // BACKEND_UATOOLKIT -------------------------------------------------------------------------------- /Server/include/QuasarVersion.h: -------------------------------------------------------------------------------- 1 | #define QUASAR_VERSION_STR "v1.7.1" 2 | -------------------------------------------------------------------------------- /Server/include/opcserver.h: -------------------------------------------------------------------------------- 1 | #ifdef BACKEND_UATOOLKIT 2 | 3 | /****************************************************************************** 4 | ** opcserver.h 5 | ** 6 | ** Copyright (C) 2008-2009 Unified Automation GmbH. All Rights Reserved. 7 | ** Web: http://www.unified-automation.com 8 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 9 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 10 | ** 11 | ** Project: C++ OPC Server SDK sample code 12 | ** 13 | ** Description: Main OPC Server object class. 14 | ** 15 | ******************************************************************************/ 16 | #ifndef MAIN_OPCSERVER_H 17 | #define MAIN_OPCSERVER_H 18 | 19 | #include "serverconfig.h" 20 | #include "nodemanager.h" 21 | #include 22 | #include 23 | #include 24 | 25 | class OpcServer: public UaServerApplication 26 | { 27 | UA_DISABLE_COPY(OpcServer); 28 | public: 29 | // construction / destruction 30 | OpcServer(); 31 | virtual ~OpcServer(); 32 | 33 | /* This is just to create a certificate and quit right away */ 34 | int createCertificate ( 35 | const UaString& backendConfigFile, 36 | const UaString& appPath); 37 | 38 | // Methods used to start and stop the server 39 | int start(); 40 | 41 | std::string getLogFilePath() { return m_logFilePath; } 42 | 43 | private: 44 | std::string m_logFilePath; 45 | QuasarUaTraceHook m_quasarUaTraceHook; 46 | }; 47 | 48 | 49 | 50 | #endif // MAIN_OPCSERVER_H 51 | 52 | #endif // BACKEND_UATOOLKIT 53 | -------------------------------------------------------------------------------- /Server/include/opcserver_open62541.h: -------------------------------------------------------------------------------- 1 | #ifdef BACKEND_OPEN62541 2 | 3 | #ifndef MAIN_OPCSERVER_H 4 | #define MAIN_OPCSERVER_H 5 | 6 | #include 7 | 8 | // forward-decls 9 | namespace AddressSpace { class ASNodeManager; } 10 | 11 | class OpcServer 12 | { 13 | OpcServer(const OpcServer& other) = delete; 14 | OpcServer& operator= (const OpcServer& other) = delete; 15 | 16 | public: 17 | // construction / destruction 18 | OpcServer(); 19 | ~OpcServer(); 20 | 21 | // Methods used to initialize the server 22 | int setServerConfig(const UaString& configurationFile, const UaString& applicationPath); 23 | 24 | int addNodeManager(AddressSpace::ASNodeManager* pNodeManager); 25 | 26 | /* This is just to create a certificate and quit right away */ 27 | int createCertificate ( 28 | const UaString& backendConfigFile, 29 | const UaString& appPath); 30 | 31 | // Methods used to start and stop the server 32 | int start(); 33 | int stop(OpcUa_Int32 secondsTillShutdown, const UaLocalizedText& shutdownReason); 34 | 35 | // Access to default node manager 36 | NodeManagerConfig* getDefaultNodeManager(); 37 | 38 | std::string getLogFilePath() { return m_logFilePath; } 39 | 40 | private: 41 | std::string m_logFilePath; 42 | 43 | UaServer m_server; 44 | }; 45 | 46 | 47 | 48 | #endif // MAIN_OPCSERVER_H 49 | 50 | #endif // BACKEND_OPEN62541 51 | -------------------------------------------------------------------------------- /Server/include/serverconfigxml_quasar.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** serverconfigxml.h 3 | ** 4 | ** Copyright (C) 2008-2009 Unified Automation GmbH. All Rights Reserved. 5 | ** Web: http://www.unified-automation.com 6 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 7 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 8 | ** 9 | ** Project: C++ OPC Server SDK sample code 10 | ** 11 | ** Description: Configuration management class for the OPC Server. 12 | ** 13 | ******************************************************************************/ 14 | #ifndef SERVERCONFIGXML_H 15 | #define SERVERCONFIGXML_H 16 | 17 | #include "serverconfigdata.h" 18 | #include "xmldocument.h" 19 | #include "uapkiprovider.h" 20 | 21 | // Default configuration if not present in the XML file 22 | #define CONFIGXML_APPLICATIONURI "UnifiedAutomation/UaDemoserver" 23 | #define CONFIGXML_MANUFACTURERNAME "Unified Automation GmbH" 24 | #define CONFIGXML_APPLICATIONNAME "OpcDemoServer" 25 | #define CONFIGXML_SOFTWAREVERSION "1.0.0" 26 | #define CONFIGXML_BUILDNUMBER "232" 27 | #define CONFIGXML_SERVERURI "[NodeName]/UnifiedAutomation/UaDemoserver" 28 | #define CONFIGXML_SERVERNAME "OpcDemoServer@[NodeName]" 29 | #define CONFIGXML_SERVERTRACEFILE "[ApplicationPath]/SrvTrace.log" 30 | // Default security settings if no entry in XML file 31 | // 1 -> Basic128Rsa15 / SignAndEncrypt 0 -> None / None 32 | #define CONFIG_DEFAULT_SECURE 1 33 | 34 | /** ServerConfigXml 35 | * Derived from ServerConfig. 36 | * It is not possible to make plane copies of this class. 37 | */ 38 | class ServerConfigXml: public ServerConfigData 39 | { 40 | UA_DISABLE_COPY(ServerConfigXml); 41 | public: 42 | /* construction. */ 43 | ServerConfigXml(const UaString& sXmlFileName, const UaString& sApplicationPath); 44 | /** destruction */ 45 | virtual ~ServerConfigXml(); 46 | 47 | /* Load the configuration from the config file. 48 | * First method called after creation of ServerConfig. Must create all NodeManagers 49 | * before method startUp is called. 50 | * @return Error code. 51 | */ 52 | UaStatus loadConfiguration(); 53 | 54 | /* Save the configuration to the config file. */ 55 | UaStatus saveConfiguration(); 56 | 57 | inline UaString sXmlFileName() const {return m_sXmlFileName;} 58 | 59 | private: 60 | UaString m_sXmlFileName; 61 | }; 62 | 63 | /** UaEndpointXml 64 | * Derived from UaEndpoint. 65 | */ 66 | class UaEndpointXml: public UaEndpoint 67 | { 68 | public: 69 | /** construction. */ 70 | UaEndpointXml(){}; 71 | /** destruction */ 72 | virtual ~UaEndpointXml(){}; 73 | 74 | /* Init Endpoint with XML configuration. 75 | * @param xmlElement a reference to the xml Element. 76 | * @param sApplicationPath the path to the application. 77 | * @param pServerConfig a pointer to the server config struct. 78 | * @return the OPC UA Status code. 79 | */ 80 | UaStatus setXmlConfig(UaXmlElement &xmlElement, const UaString& sApplicationPath, ServerConfig* pServerConfig, bool& updatedConfiguration); 81 | }; 82 | 83 | #endif // SERVERCONFIGXML_H 84 | -------------------------------------------------------------------------------- /Server/include/shutdown.h: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | ** Copyright (C) 2006-2011 Unified Automation GmbH. All Rights Reserved. 3 | ** Web: http://www.unifiedautomation.com 4 | ** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE 5 | ** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. 6 | ** 7 | ** Project: Utility functions. 8 | ** Description: Portable shutdown flag using CTRL-C (SIGINT) 9 | ** Notes: Visual Studio catches CTRL-C when it's thrown by default, 10 | ** which is not wanted normally. You can disable this by opening the 11 | exceptions dialog via the menu Debug->Exceptions. Then deactivate 12 | the "CTRL-C" exception in the "Win32 Exceptions" category. 13 | @author Unified Automation 14 | @author Piotr Nikiel 15 | ******************************************************************************/ 16 | #ifndef __SHUTDOWN_H__ 17 | #define __SHUTDOWN_H__ 18 | 19 | #include 20 | 21 | #ifdef _WIN32 22 | # ifdef _WIN32_WCE 23 | /* Windows CE */ 24 | # define SHUTDOWN_SEQUENCE "Escape" 25 | # else /* _WIN32_WCE */ 26 | /* Windows 2000/XP/Vista */ 27 | /* Uncomment the following line to use CTRL-C on Windows to shutdown. */ 28 | //#define USE_CTRLC_ON_WINDOWS 29 | # ifdef USE_CTRLC_ON_WINDOWS 30 | /* Use CTRL-C signal */ 31 | # define SHUTDOWN_SEQUENCE "CTRL-C" 32 | # else /* USE_CTRLC_ON_WINDOWS */ 33 | /* Use 'x' to shutdown using DOS conio.h */ 34 | # define SHUTDOWN_SEQUENCE "x" 35 | # endif /* USE_CTRLC_ON_WINDOWS */ 36 | # endif /* _WIN32_WCE */ 37 | #else /* _WIN32 */ 38 | /* Linux */ 39 | # define SHUTDOWN_SEQUENCE "CTRL-C" 40 | #endif /* _WIN32 */ 41 | 42 | /* activate some logging */ 43 | #define SHUTDOWN_TRACE_ACTIVE 44 | #ifdef SHUTDOWN_TRACE_ACTIVE 45 | # include /* for printf */ 46 | # define SHUTDOWN_TRACE printf 47 | #else 48 | # define SHUTDOWN_TRACE 49 | #endif 50 | 51 | /* Call this on startup. */ 52 | void RegisterSignalHandler(); 53 | 54 | /* Use this to check if the shutdown flag is set (i.e. the server should exit its 'main' loop and quit). */ 55 | unsigned int ShutDownFlag(); 56 | 57 | /* Call to make server shut down. Not relevant for 'ordinary' servers but required when a server is embedded 58 | * into a Python process or so. 59 | */ 60 | void ShutDown(); 61 | 62 | //! Need to keep it extern for usgae in opcserver_open62541.cpp, for instance. 63 | extern volatile OpcUa_Boolean g_RunningFlag; 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Server/include/version.h: -------------------------------------------------------------------------------- 1 | #define VERSION_STR "Unofficial developer version. This software wasn't build using official release build script." 2 | -------------------------------------------------------------------------------- /Server/src/QuasarServer.cpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, Universidad de Oviedo, 2015. All rights not expressly granted are reserved. 2 | * QuasarServer.cpp 3 | * 4 | * Created on: Nov 6, 2015 5 | * Author: Damian Abalo Miron 6 | * Author: Piotr Nikiel 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | 24 | #include 25 | 26 | #include "QuasarServer.h" 27 | #include 28 | #include 29 | 30 | QuasarServer::QuasarServer() : BaseQuasarServer() 31 | { 32 | 33 | } 34 | 35 | QuasarServer::~QuasarServer() 36 | { 37 | 38 | } 39 | 40 | void QuasarServer::mainLoop() 41 | { 42 | printServerMsg("Press "+std::string(SHUTDOWN_SEQUENCE)+" to shutdown server"); 43 | 44 | // Wait for user command to terminate the server thread. 45 | 46 | while(ShutDownFlag() == 0) 47 | { 48 | std::this_thread::sleep_for(std::chrono::milliseconds(100)); 49 | } 50 | printServerMsg(" Shutting down server"); 51 | } 52 | 53 | void QuasarServer::initialize() 54 | { 55 | LOG(Log::INF) << "Initializing Quasar server."; 56 | 57 | } 58 | 59 | void QuasarServer::shutdown() 60 | { 61 | LOG(Log::INF) << "Shutting down Quasar server."; 62 | } 63 | 64 | void QuasarServer::initializeLogIt() 65 | { 66 | BaseQuasarServer::initializeLogIt(); 67 | LOG(Log::INF) << "Logging initialized."; 68 | } 69 | -------------------------------------------------------------------------------- /Server/src/main.cpp: -------------------------------------------------------------------------------- 1 | /* © Copyright CERN, Universidad de Oviedo, 2015. All rights not expressly granted are reserved. 2 | * main.cpp 3 | * 4 | * Created on: Nov 6, 2015 5 | * Author: Piotr Nikiel 6 | * Author: Damian Abalo Miron 7 | * 8 | * This file is part of Quasar. 9 | * 10 | * Quasar is free software: you can redistribute it and/or modify 11 | * it under the terms of the GNU Lesser General Public Licence as published by 12 | * the Free Software Foundation, either version 3 of the Licence. 13 | * 14 | * Quasar is distributed in the hope that it will be useful, 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 17 | * GNU Lesser General Public Licence for more details. 18 | * 19 | * You should have received a copy of the GNU Lesser General Public License 20 | * along with Quasar. If not, see . 21 | */ 22 | 23 | #include "QuasarServer.h" 24 | 25 | int main (int argc, char *argv[]) 26 | { 27 | try 28 | { 29 | QuasarServer quasarServer ; 30 | return quasarServer.startApplication(argc, argv); 31 | } 32 | catch(const std::exception& e) 33 | { 34 | std::cerr << e.what() << '\n'; 35 | return -1; 36 | } 37 | 38 | } 39 | -------------------------------------------------------------------------------- /Server/src/opcserver_open62541.cpp: -------------------------------------------------------------------------------- 1 | #ifdef BACKEND_OPEN62541 2 | 3 | #include 4 | #include 5 | 6 | #include 7 | #include 8 | 9 | OpcServer::OpcServer() 10 | { 11 | } 12 | 13 | /** Destruction. */ 14 | OpcServer::~OpcServer() 15 | { 16 | } 17 | 18 | int OpcServer::setServerConfig(const UaString& configurationFile, const UaString& applicationPath) 19 | { 20 | m_server.setServerConfig( configurationFile, applicationPath ); 21 | return 0; 22 | } 23 | 24 | int OpcServer::addNodeManager(AddressSpace::ASNodeManager* pNodeManager) 25 | { 26 | m_server.addNodeManager(pNodeManager); 27 | return 0; 28 | } 29 | 30 | int OpcServer::createCertificate ( 31 | const UaString& backendConfigFile, 32 | const UaString& appPath) 33 | { 34 | LOG(Log::ERR) << "Sorry, certificate creation is not supported(yet) with open62541 backend."; 35 | return -1; 36 | } 37 | 38 | int OpcServer::start() 39 | { 40 | m_server.linkRunningFlag(&g_RunningFlag); 41 | m_server.start(); 42 | return 0; 43 | } 44 | 45 | int OpcServer::stop(OpcUa_Int32 secondsTillShutdown, const UaLocalizedText& shutdownReason) 46 | { 47 | m_server.stop(); 48 | return 0; 49 | } 50 | 51 | 52 | #endif // BACKEND_OPEN62541 53 | -------------------------------------------------------------------------------- /bin/config.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | -------------------------------------------------------------------------------- /open62541_config.cmake: -------------------------------------------------------------------------------- 1 | # LICENSE: 2 | # Copyright (c) 2015, CERN 3 | # All rights reserved. 4 | # 5 | # Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 6 | # 7 | # 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 8 | # 9 | # 2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. 10 | # 11 | # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 12 | # THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS 13 | # BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 14 | # GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 15 | # LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 16 | # 17 | # Author: Piotr Nikiel 18 | # Author: Ben Farnham 19 | # @author pnikiel 20 | # @date May-2018 21 | # This file is a build config for quasar-based projects to use open62541 OPC-UA backend. 22 | # You can use it directly, or make a copy and adjust accordingly. 23 | 24 | #----- 25 | #General settings 26 | #----- 27 | 28 | add_definitions(-Wall -Wno-deprecated) 29 | 30 | # open62541-compat has no uatrace 31 | set (LOGIT_HAS_UATRACE FALSE) 32 | 33 | # open62541-compat with server config loader - load ServerConfig.xml by default 34 | set (SERVERCONFIG_LOADER ON CACHE BOOL "Since quasar 1.5.1 the open62541-compat will also load ServerConfig.xml same way UA-SDK does") 35 | 36 | # need C++11 37 | set( CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x" ) 38 | 39 | #------- 40 | #Boost 41 | #------- 42 | # should get resolved via FrameworkInternals/BoostSetup.cmake since quasar 1.3.13 43 | 44 | #------ 45 | #OPCUA 46 | #------ 47 | 48 | # No OPC-UA Toolkit: using Open62541-compat instead. It is referenced in BACKEND_MODULES below 49 | add_definitions( -DBACKEND_OPEN62541 ) 50 | SET( OPCUA_TOOLKIT_PATH "" ) 51 | SET( OPCUA_TOOLKIT_LIBS_RELEASE -lrt -lpthread ) 52 | SET( OPCUA_TOOLKIT_LIBS_DEBUG -lrt -lpthread ) 53 | include_directories( ${PROJECT_BINARY_DIR}/open62541-compat/extern/open62541/include ) 54 | 55 | #----- 56 | #XML Libs 57 | #----- 58 | #As of 03-Sep-2015 I see no FindXerces or whatever in our Cmake 2.8 installation, so no find_package can be user... 59 | # TODO perhaps also take it from environment if requested 60 | SET( XML_LIBS "-lxerces-c" ) 61 | 62 | #----- 63 | #Quasar server libs 64 | #----- 65 | SET( QUASAR_SERVER_LIBS "-lssl -lcrypto -lpthread" ) 66 | -------------------------------------------------------------------------------- /python_requirements.txt: -------------------------------------------------------------------------------- 1 | # this file can be passed to python package manager to collect the requirements 2 | # e.g.: 3 | # pip3 install -r python_requirements.txt 4 | lxml>3.2.1 5 | pygit2==0.26.0 6 | Jinja2 7 | colorama 8 | --------------------------------------------------------------------------------