From 241164b0176a86ae9d998909dcad8ecee3d13a31 Mon Sep 17 00:00:00 2001 From: Alexander Mueller <alexander.mueller@hs.uni-hamburg.de> Date: Fri, 4 Jun 2004 15:19:57 +0000 Subject: [PATCH] %[ER: 120]% End of week --- .gitattributes | 7 + MAC/Config/Apc/b1.apc | 7 + MAC/Config/Apc/b2.apc | 7 + MAC/Config/Apc/d1.apc | 104 ++ MAC/Config/Apc/e1.apc | 10 + MAC/Config/log4cplus.properties | 23 +- MAC/GCF/GCFCommon/include/GCF/GCF_Defines.h | 25 +- MAC/GCF/GCFCommon/include/GCF/GCF_PValue.h | 8 +- MAC/GCF/GCFCommon/src/CmdLine.cc | 2 +- MAC/GCF/GCFCommon/src/CmdLine.h | 214 --- MAC/GCF/GCFCommon/src/Makefile.am | 5 +- MAC/GCF/GCFCommon/src/Utils.cc | 4 +- MAC/GCF/GCFCommon/src/Utils.h | 22 - MAC/GCF/TM/include/GCF/TM/GCF_Event.h | 4 + MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h | 2 +- MAC/GCF/TM/src/GCF_Task.cc | 4 +- MAC/GCF/TM/src/Makefile.am | 6 +- MAC/GCF/TM/src/Socket/GCF_TCPPort.cc | 2 +- MAC/GCF/TM/test/Makefile.am | 8 +- MAC/GCF/TM/test/tutorial.ns.in | 38 + MAC/GCF/TM/test/tutorial.top.in | 27 + MAC/GCF/_PAL/PA/src/GPA_Controller.cc | 325 +++- MAC/GCF/_PAL/PA/src/GPA_Controller.h | 11 +- MAC/GCF/_PAL/PA/src/GPA_Defines.h | 17 +- MAC/GCF/_PAL/PA/src/GPA_PropertySet.cc | 233 ++- MAC/GCF/_PAL/PA/src/GPA_PropertySet.h | 7 +- MAC/GCF/_PAL/PA/src/Makefile.am | 12 +- MAC/GCF/_PAL/PA/src/loadAPC | 10 + MAC/GCF/_PAL/PML/src/GCF_Answer.cc | 1 + MAC/GCF/_PAL/PML/src/GCF_ExtPropertySet.cc | 99 +- MAC/GCF/_PAL/PML/src/GCF_MyProperty.cc | 34 +- MAC/GCF/_PAL/PML/src/GCF_MyPropertySet.cc | 158 +- MAC/GCF/_PAL/PML/src/GCF_Property.cc | 27 +- MAC/GCF/_PAL/PML/src/GCF_PropertySet.cc | 55 +- MAC/GCF/_PAL/PML/src/GPM_Controller.cc | 198 ++- MAC/GCF/_PAL/PML/src/GPM_Controller.h | 20 +- ...M_ProperyProxy.cc => GPM_PropertyProxy.cc} | 0 MAC/GCF/_PAL/PML/src/Makefile.am | 16 +- MAC/GCF/_PAL/SAL/src/GSA_PvssApi.cc | 9 +- MAC/GCF/_PAL/SAL/src/GSA_Service.cc | 261 ++-- MAC/GCF/_PAL/SAL/src/GSA_Service.h | 2 +- MAC/GCF/_PAL/SAL/test/Echo.cc | 50 +- MAC/GCF/_PAL/SAL/test/Echo.h | 2 +- MAC/GCF/_PAL/SAL/test/Makefile.am | 2 +- MAC/GCF/_PAL/SAL/test/Ping.h | 2 +- MAC/GCF/_PAL/SAL/test/Service.cc | 42 +- MAC/GCF/_PAL/SAL/test/Service.h | 28 +- MAC/GCF/_PAL/include/GCF/PAL/GCF_Answer.h | 59 +- .../_PAL/include/GCF/PAL/GCF_ExtPropertySet.h | 17 +- MAC/GCF/_PAL/include/GCF/PAL/GCF_MyProperty.h | 4 +- .../_PAL/include/GCF/PAL/GCF_MyPropertySet.h | 33 +- MAC/GCF/_PAL/include/GCF/PAL/GCF_Property.h | 8 +- .../_PAL/include/GCF/PAL/GCF_PropertySet.h | 11 +- MAC/MACCommon/autogen/protocol.tpl | 16 +- MAC/Test/GCF/configure.in | 7 +- MAC/Test/GCF/src/Answer.h | 8 +- MAC/Test/GCF/src/Application1.cc | 1349 +++++++---------- MAC/Test/GCF/src/Application1.h | 75 +- MAC/Test/GCF/src/Application2.cc | 1345 ++++++---------- MAC/Test/GCF/src/Application2.h | 76 +- MAC/Test/GCF/src/Defines.h | 304 ++-- MAC/Test/GCF/src/Makefile.am | 7 +- MAC/Test/GCF/src/PropertyProxy.h | 8 +- MAC/Test/GCF/src/RTAnswer.cc | 2 +- MAC/Test/GCF/src/SupervisedTask.cc | 18 +- MAC/Test/GCF/src/SupervisedTask.h | 16 +- 66 files changed, 2660 insertions(+), 2853 deletions(-) create mode 100644 MAC/Config/Apc/b1.apc create mode 100644 MAC/Config/Apc/b2.apc create mode 100644 MAC/Config/Apc/d1.apc create mode 100644 MAC/Config/Apc/e1.apc delete mode 100644 MAC/GCF/GCFCommon/src/CmdLine.h delete mode 100644 MAC/GCF/GCFCommon/src/Utils.h create mode 100644 MAC/GCF/TM/test/tutorial.ns.in create mode 100644 MAC/GCF/TM/test/tutorial.top.in create mode 100644 MAC/GCF/_PAL/PA/src/loadAPC rename MAC/GCF/_PAL/PML/src/{GPM_ProperyProxy.cc => GPM_PropertyProxy.cc} (100%) diff --git a/.gitattributes b/.gitattributes index d549c672a39..92fd137cac7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -171,6 +171,10 @@ MAC/Config/Apc/ApcRCUType -text svneol=native#application/octet-stream MAC/Config/Apc/ApcRackType -text svneol=native#application/octet-stream MAC/Config/Apc/ApcStationType -text svneol=native#application/octet-stream MAC/Config/Apc/ApcSubRackType -text svneol=native#application/octet-stream +MAC/Config/Apc/b1.apc -text svneol=native#application/octet-stream +MAC/Config/Apc/b2.apc -text svneol=native#application/octet-stream +MAC/Config/Apc/d1.apc -text svneol=native#application/octet-stream +MAC/Config/Apc/e1.apc -text svneol=native#application/octet-stream MAC/Config/LofarPropertyTypes.pvss -text svneol=native#application/octet-stream MAC/Config/mac.ns -text svneol=native#application/octet-stream MAC/Config/mac.top -text svneol=native#application/octet-stream @@ -195,6 +199,8 @@ MAC/GCF/TM/configure.in -text svneol=native#application/octet-stream MAC/GCF/TM/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/TM/test/Echo_Protocol.prot -text svneol=native#application/octet-stream MAC/GCF/TM/test/Makefile.am -text svneol=native#application/octet-stream +MAC/GCF/TM/test/tutorial.ns.in -text svneol=native#application/octet-stream +MAC/GCF/TM/test/tutorial.top.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/src/Makefile.am -text svneol=native#application/octet-stream @@ -219,6 +225,7 @@ MAC/GCF/_PAL/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_PAL/PA/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_PAL/PA/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_PAL/PA/src/PA_Protocol.prot -text svneol=native#application/octet-stream +MAC/GCF/_PAL/PA/src/loadAPC -text svneol=native#application/octet-stream MAC/GCF/_PAL/PML/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_PAL/PML/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_PAL/SAL/Makefile.am -text svneol=native#application/octet-stream diff --git a/MAC/Config/Apc/b1.apc b/MAC/Config/Apc/b1.apc new file mode 100644 index 00000000000..339ca1367d7 --- /dev/null +++ b/MAC/Config/Apc/b1.apc @@ -0,0 +1,7 @@ +# ascii dump of database + +# DpValue +ElementName TypeName _original.._value _original.._status _original.._stime +__default_b_1.P1 TTypeB 100 0x101 25.05.2004 14:50:53.560 +__default_b_1.P2 TTypeB \79 0x101 25.05.2004 14:53:26.847 +__default_b_1.P3 TTypeB 100.5 0x101 25.05.2004 14:53:56.908 diff --git a/MAC/Config/Apc/b2.apc b/MAC/Config/Apc/b2.apc new file mode 100644 index 00000000000..89353ef95ae --- /dev/null +++ b/MAC/Config/Apc/b2.apc @@ -0,0 +1,7 @@ +# ascii dump of database + +# DpValue +ElementName TypeName _original.._value _original.._status _original.._stime +__default_b_2.P1 TTypeB 200 0x101 25.05.2004 14:54:23.107 +__default_b_2.P2 TTypeB \80 0x101 25.05.2004 14:54:31.898 +__default_b_2.P3 TTypeB 200.5 0x101 25.05.2004 14:54:41.504 diff --git a/MAC/Config/Apc/d1.apc b/MAC/Config/Apc/d1.apc new file mode 100644 index 00000000000..1a6f79cba3e --- /dev/null +++ b/MAC/Config/Apc/d1.apc @@ -0,0 +1,104 @@ +# ascii dump of database + +# DpValue +ElementName TypeName _original.._value _original.._status _original.._stime +__default_d_1.J.P00 TTypeD 100 0x101 25.05.2004 14:59:19.443 +__default_d_1.J.P01 TTypeD 100.01 0x101 25.05.2004 14:59:19.443 +__default_d_1.J.P02 TTypeD 100.02 0x101 25.05.2004 14:59:19.443 +__default_d_1.J.P03 TTypeD 100.03 0x101 25.05.2004 14:59:19.443 +__default_d_1.J.P04 TTypeD 100.04 0x101 25.05.2004 14:59:19.443 +__default_d_1.J.P05 TTypeD 100.05 0x101 25.05.2004 14:59:19.444 +__default_d_1.J.P06 TTypeD 100.06 0x101 25.05.2004 14:59:19.444 +__default_d_1.J.P07 TTypeD 100.07 0x101 25.05.2004 14:59:19.444 +__default_d_1.J.P08 TTypeD 100.08 0x101 25.05.2004 14:59:19.444 +__default_d_1.J.P09 TTypeD 100.09 0x101 25.05.2004 14:59:19.444 +__default_d_1.J.P10 TTypeD 100.1 0x101 25.05.2004 14:59:19.444 +__default_d_1.J.P11 TTypeD 100.11 0x101 25.05.2004 14:59:19.445 +__default_d_1.J.P12 TTypeD 100.12 0x101 25.05.2004 14:59:19.445 +__default_d_1.J.P13 TTypeD 100.13 0x101 25.05.2004 14:59:19.445 +__default_d_1.J.P14 TTypeD 100.14 0x101 25.05.2004 14:59:19.445 +__default_d_1.J.P15 TTypeD 100.15 0x101 25.05.2004 14:59:19.445 +__default_d_1.J.P16 TTypeD 100.16 0x101 25.05.2004 14:59:19.445 +__default_d_1.J.P17 TTypeD 100.17 0x101 25.05.2004 14:59:19.446 +__default_d_1.J.P18 TTypeD 100.18 0x101 25.05.2004 14:59:19.446 +__default_d_1.J.P19 TTypeD 100.19 0x101 25.05.2004 14:59:19.446 +__default_d_1.J.P20 TTypeD 100.2 0x101 25.05.2004 14:59:19.446 +__default_d_1.J.P21 TTypeD 100.21 0x101 25.05.2004 14:59:19.446 +__default_d_1.J.P22 TTypeD 100.22 0x101 25.05.2004 14:59:19.447 +__default_d_1.J.P23 TTypeD 100.23 0x101 25.05.2004 14:59:19.447 +__default_d_1.J.P24 TTypeD 100.24 0x101 25.05.2004 14:59:19.447 +__default_d_1.J.P25 TTypeD 100.25 0x101 25.05.2004 14:59:19.447 +__default_d_1.J.P26 TTypeD 100.26 0x101 25.05.2004 14:59:19.447 +__default_d_1.J.P27 TTypeD 100.27 0x101 25.05.2004 14:59:19.448 +__default_d_1.J.P28 TTypeD 100.28 0x101 25.05.2004 14:59:19.448 +__default_d_1.J.P29 TTypeD 100.29 0x101 25.05.2004 14:59:19.448 +__default_d_1.J.P30 TTypeD 100.3 0x101 25.05.2004 14:59:19.448 +__default_d_1.J.P31 TTypeD 100.31 0x101 25.05.2004 14:59:19.449 +__default_d_1.J.P32 TTypeD 100.32 0x101 25.05.2004 14:59:19.449 +__default_d_1.J.P33 TTypeD 100.33 0x101 25.05.2004 14:59:19.449 +__default_d_1.J.P34 TTypeD 100.34 0x101 25.05.2004 14:59:19.449 +__default_d_1.J.P35 TTypeD 100.35 0x101 25.05.2004 14:59:19.450 +__default_d_1.J.P36 TTypeD 100.36 0x101 25.05.2004 14:59:19.450 +__default_d_1.J.P37 TTypeD 100.37 0x101 25.05.2004 14:59:19.450 +__default_d_1.J.P38 TTypeD 100.38 0x101 25.05.2004 14:59:19.450 +__default_d_1.J.P39 TTypeD 100.39 0x101 25.05.2004 14:59:19.451 +__default_d_1.J.P40 TTypeD 100.4 0x101 25.05.2004 14:59:19.451 +__default_d_1.J.P41 TTypeD 100.41 0x101 25.05.2004 14:59:19.451 +__default_d_1.J.P42 TTypeD 100.42 0x101 25.05.2004 14:59:19.451 +__default_d_1.J.P43 TTypeD 100.43 0x101 25.05.2004 14:59:19.452 +__default_d_1.J.P44 TTypeD 100.44 0x101 25.05.2004 14:59:19.452 +__default_d_1.J.P45 TTypeD 100.45 0x101 25.05.2004 14:59:19.452 +__default_d_1.J.P46 TTypeD 100.46 0x101 25.05.2004 14:59:19.452 +__default_d_1.J.P47 TTypeD 100.47 0x101 25.05.2004 14:59:19.453 +__default_d_1.J.P48 TTypeD 100.48 0x101 25.05.2004 14:59:19.453 +__default_d_1.J.P49 TTypeD 100.49 0x101 25.05.2004 14:59:19.453 +__default_d_1.J.P50 TTypeD 100.5 0x101 25.05.2004 14:59:19.453 +__default_d_1.J.P51 TTypeD 100.51 0x101 25.05.2004 14:59:19.454 +__default_d_1.J.P52 TTypeD 100.52 0x101 25.05.2004 14:59:19.454 +__default_d_1.J.P53 TTypeD 100.53 0x101 25.05.2004 14:59:19.454 +__default_d_1.J.P54 TTypeD 100.54 0x101 25.05.2004 14:59:19.455 +__default_d_1.J.P55 TTypeD 100.55 0x101 25.05.2004 14:59:19.455 +__default_d_1.J.P56 TTypeD 100.56 0x101 25.05.2004 14:59:19.455 +__default_d_1.J.P57 TTypeD 100.57 0x101 25.05.2004 14:59:19.455 +__default_d_1.J.P58 TTypeD 100.58 0x101 25.05.2004 14:59:19.456 +__default_d_1.J.P59 TTypeD 100.59 0x101 25.05.2004 14:59:19.456 +__default_d_1.J.P60 TTypeD 100.6 0x101 25.05.2004 14:59:19.456 +__default_d_1.J.P61 TTypeD 100.61 0x101 25.05.2004 14:59:19.457 +__default_d_1.J.P62 TTypeD 100.62 0x101 25.05.2004 14:59:19.457 +__default_d_1.J.P63 TTypeD 100.63 0x101 25.05.2004 14:59:19.457 +__default_d_1.J.P64 TTypeD 100.64 0x101 25.05.2004 14:59:19.458 +__default_d_1.J.P65 TTypeD 100.65 0x101 25.05.2004 14:59:19.458 +__default_d_1.J.P66 TTypeD 100.66 0x101 25.05.2004 14:59:19.458 +__default_d_1.J.P67 TTypeD 100.67 0x101 25.05.2004 14:59:19.459 +__default_d_1.J.P68 TTypeD 100.68 0x101 25.05.2004 14:59:19.459 +__default_d_1.J.P69 TTypeD 100.69 0x101 25.05.2004 14:59:19.459 +__default_d_1.J.P70 TTypeD 100.7 0x101 25.05.2004 14:59:19.460 +__default_d_1.J.P71 TTypeD 100.71 0x101 25.05.2004 14:59:19.460 +__default_d_1.J.P72 TTypeD 100.72 0x101 25.05.2004 14:59:19.460 +__default_d_1.J.P73 TTypeD 100.73 0x101 25.05.2004 14:59:19.461 +__default_d_1.J.P74 TTypeD 100.74 0x101 25.05.2004 14:59:19.461 +__default_d_1.J.P75 TTypeD 100.75 0x101 25.05.2004 14:59:19.461 +__default_d_1.J.P76 TTypeD 100.76 0x101 25.05.2004 14:59:19.462 +__default_d_1.J.P77 TTypeD 100.77 0x101 25.05.2004 14:59:19.462 +__default_d_1.J.P78 TTypeD 100.78 0x101 25.05.2004 14:59:19.462 +__default_d_1.J.P79 TTypeD 100.79 0x101 25.05.2004 14:59:19.463 +__default_d_1.J.P80 TTypeD 100.8 0x101 25.05.2004 14:59:19.463 +__default_d_1.J.P81 TTypeD 100.81 0x101 25.05.2004 14:59:19.463 +__default_d_1.J.P82 TTypeD 100.82 0x101 25.05.2004 14:59:19.464 +__default_d_1.J.P83 TTypeD 100.83 0x101 25.05.2004 14:59:19.464 +__default_d_1.J.P84 TTypeD 100.84 0x101 25.05.2004 14:59:19.464 +__default_d_1.J.P85 TTypeD 100.85 0x101 25.05.2004 14:59:19.465 +__default_d_1.J.P86 TTypeD 100.86 0x101 25.05.2004 14:59:19.465 +__default_d_1.J.P87 TTypeD 100.87 0x101 25.05.2004 14:59:19.466 +__default_d_1.J.P88 TTypeD 100.88 0x101 25.05.2004 14:59:19.466 +__default_d_1.J.P89 TTypeD 100.89 0x101 25.05.2004 14:59:19.466 +__default_d_1.J.P90 TTypeD 100.9 0x101 25.05.2004 14:59:19.467 +__default_d_1.J.P91 TTypeD 100.91 0x101 25.05.2004 14:59:19.467 +__default_d_1.J.P92 TTypeD 100.92 0x101 25.05.2004 14:59:19.467 +__default_d_1.J.P93 TTypeD 100.93 0x101 25.05.2004 14:59:19.468 +__default_d_1.J.P94 TTypeD 100.94 0x101 25.05.2004 14:59:19.468 +__default_d_1.J.P95 TTypeD 100.95 0x101 25.05.2004 14:59:19.469 +__default_d_1.J.P96 TTypeD 100.96 0x101 25.05.2004 14:59:19.469 +__default_d_1.J.P97 TTypeD 100.97 0x101 25.05.2004 14:59:19.469 +__default_d_1.J.P98 TTypeD 100.98 0x101 25.05.2004 14:59:19.470 +__default_d_1.J.P99 TTypeD 100.99 0x101 25.05.2004 14:59:19.470 diff --git a/MAC/Config/Apc/e1.apc b/MAC/Config/Apc/e1.apc new file mode 100644 index 00000000000..985436d8c6e --- /dev/null +++ b/MAC/Config/Apc/e1.apc @@ -0,0 +1,10 @@ +# ascii dump of database + +# DpValue +ElementName TypeName _original.._value _original.._status _original.._stime +__default_e_1.P1 TTypeE \100 0x101 04.06.2004 07:31:03.308 +__default_e_1.P2 TTypeE 200.12 0x101 04.06.2004 07:31:17.375 +__default_e_1.P3 TTypeE "koe" 0x101 04.06.2004 07:31:25.722 +__default_e_1.P4 TTypeE 100.05 0x101 04.06.2004 07:31:36.324 +__default_e_1.P5 TTypeE -200 0x101 04.06.2004 07:31:47.037 +__default_e_1.P6 TTypeE 100 0x101 04.06.2004 07:31:57.148 diff --git a/MAC/Config/log4cplus.properties b/MAC/Config/log4cplus.properties index 56b97e2a21e..47ddfe7a075 100644 --- a/MAC/Config/log4cplus.properties +++ b/MAC/Config/log4cplus.properties @@ -1,35 +1,18 @@ log4cplus.rootLogger=INFO, STDOUT log4cplus.additivity.ASTRON=FALSE -log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.TM.Logger=TRACE, STDOUT +#log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.TM.Logger=TRACE, STDOUT log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.SAL.Logger=TRACE, STDOUT log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.PML.Logger=TRACE, STDOUT log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.PA.Logger=TRACE, STDOUT log4cplus.logger.ASTRON.LOFAR.MAC.GCF.Services.PI.Logger=TRACE, STDOUT log4cplus.logger.ASTRON.LOFAR.MAC.GCF.Services.SS.Logger=TRACE, STDOUT log4cplus.logger.ASTRON.LOFAR.MAC.GCF.Services.PMLlite.Logger=TRACE, STDOUT -log4cplus.logger.ASTRON.LOFAR.MAC.ExampleLogger=TRACE, EXAMPLEROLFILE log4cplus.logger.ASTRON.LOFAR.MAC.ExampleLogger2=WARN, STDOUT -log4cplus.logger.ASTRON.LOFAR.MAC.PVSS_Test=INFO, PVSS_TEST_ROLFILE log4cplus.appender.STDOUT=log4cplus::ConsoleAppender log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout -log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%d-%m-%y %H:%M:%S} %-5p %c{2} - %m [%l]%n +log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%d-%m-%y %H:%M:%S} %-5p %c{3} - %m [%l]%n log4cplus.additivity.MAC=FALSE -log4cplus.logger.MAC=TRACE, STDOUT - -log4cplus.appender.EXAMPLEROLFILE=log4cplus::RollingFileAppender -log4cplus.appender.EXAMPLEROLFILE.File=output_${ENV_VAR}.log -log4cplus.appender.EXAMPLEROLFILE.MaxFileSize=5MB -#log4cplus.appender.EXAMPLEROLFILE.MaxFileSize=500KB -log4cplus.appender.EXAMPLEROLFILE.MaxBackupIndex=5 -log4cplus.appender.EXAMPLEROLFILE.layout=log4cplus::TTCCLayout - -log4cplus.appender.PVSS_TEST_ROLFILE=log4cplus::RollingFileAppender -log4cplus.appender.PVSS_TEST_ROLFILE.File=pvss_test_output_${ENV_VAR}.log -log4cplus.appender.PVSS_TEST_ROLFILE.MaxFileSize=5MB -#log4cplus.appender.PVSS_TEST_ROLFILE.MaxFileSize=500KB -log4cplus.appender.PVSS_TEST_ROLFILE.MaxBackupIndex=5 -log4cplus.appender.PVSS_TEST_ROLFILE.layout=log4cplus::PatternLayout -log4cplus.appender.PVSS_TEST_ROLFILE.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S},%m%n +log4cplus.logger.MAC=TRACE, STDOUT \ No newline at end of file diff --git a/MAC/GCF/GCFCommon/include/GCF/GCF_Defines.h b/MAC/GCF/GCFCommon/include/GCF/GCF_Defines.h index bee1c47c547..ed651158fa4 100644 --- a/MAC/GCF/GCFCommon/include/GCF/GCF_Defines.h +++ b/MAC/GCF/GCFCommon/include/GCF/GCF_Defines.h @@ -27,17 +27,17 @@ #include <assert.h> -#define GCF_PROP_NAME_SEP '_' +#define GCF_PROP_NAME_SEP '.' enum TGCFResult { GCF_NO_ERROR, GCF_UNKNOWN_ERROR, GCF_PML_ERROR, - GCF_APCLOAD_ERROR, - GCF_APCRELOAD_ERROR, - GCF_APCUNLOAD_ERROR, - GCF_MYPROPSLOAD_ERROR, - GCF_MYPROPSUNLOAD_ERROR, + GCF_EXTPS_LOAD_ERROR, + GCF_PS_CONFIGURE_ERROR, + GCF_EXTPS_UNLOAD_ERROR, + GCF_MYPS_ENABLE_ERROR, + GCF_MYPS_DISABLE_ERROR, GCF_VALUESTRING_NOT_VALID, GCF_DIFFERENT_TYPES, GCF_BUSY, @@ -50,18 +50,25 @@ enum TGCFResult { GCF_NO_PROPER_DATA, GCF_SCOPE_ALREADY_REG, GCF_ALREADY_SUBSCRIBED, - GCF_NOT_SUBSCRIBED + GCF_NOT_SUBSCRIBED, + GCF_WRONG_STATE }; typedef unsigned char TAccessMode; #define GCF_READABLE_PROP 1 #define GCF_WRITABLE_PROP 2 - +typedef enum TMACValueType {NO_LPT, LPT_BOOL, LPT_CHAR, LPT_UNSIGNED, LPT_INTEGER, + LPT_BIT32, LPT_BLOB, LPT_REF, LPT_DOUBLE, LPT_DATETIME, + LPT_STRING, LPT_DYNARR = 0x80, + LPT_DYNBOOL, LPT_DYNCHAR, LPT_DYNUNSIGNED, LPT_DYNINTEGER, + LPT_DYNBIT32, LPT_DYNBLOB, LPT_DYNREF, LPT_DYNDOUBLE, LPT_DYNDATETIME, + LPT_DYNSTRING }; + typedef struct { char* propName; - unsigned int type; + TMACValueType type; TAccessMode accessMode; char* defaultValue; } diff --git a/MAC/GCF/GCFCommon/include/GCF/GCF_PValue.h b/MAC/GCF/GCFCommon/include/GCF/GCF_PValue.h index f44074970de..9860c13e257 100644 --- a/MAC/GCF/GCFCommon/include/GCF/GCF_PValue.h +++ b/MAC/GCF/GCFCommon/include/GCF/GCF_PValue.h @@ -41,13 +41,7 @@ class GCFPValue * In case a dynamic array will be used the type ID enumeration starts on * 0x80. */ - enum TMACValueType {NO_LPT, LPT_BOOL, LPT_CHAR, LPT_UNSIGNED, LPT_INTEGER, - LPT_BIT32, LPT_BLOB, LPT_REF, LPT_DOUBLE, LPT_DATETIME, - LPT_STRING, LPT_DYNARR = 0x80, - LPT_DYNBOOL, LPT_DYNCHAR, LPT_DYNUNSIGNED, LPT_DYNINTEGER, - LPT_DYNBIT32, LPT_DYNBLOB, LPT_DYNREF, LPT_DYNDOUBLE, LPT_DYNDATETIME, - LPT_DYNSTRING }; - /** + /** * The constructor * Sets the type ID for each subclassed property value type class * @param type MAC property type ID diff --git a/MAC/GCF/GCFCommon/src/CmdLine.cc b/MAC/GCF/GCFCommon/src/CmdLine.cc index 87a77e8173e..d992e50656e 100644 --- a/MAC/GCF/GCFCommon/src/CmdLine.cc +++ b/MAC/GCF/GCFCommon/src/CmdLine.cc @@ -32,7 +32,7 @@ // if you're using MFC, you'll need to un-comment this line // #include "stdafx.h" -#include "CmdLine.h" +#include <GCF/CmdLine.h> #include <ctype.h> /*------------------------------------------------------ diff --git a/MAC/GCF/GCFCommon/src/CmdLine.h b/MAC/GCF/GCFCommon/src/CmdLine.h deleted file mode 100644 index f3f3aedf506..00000000000 --- a/MAC/GCF/GCFCommon/src/CmdLine.h +++ /dev/null @@ -1,214 +0,0 @@ -/*------------------------------------------------------ - CCmdLine - - A utility for parsing command lines. - - Copyright (C) 1999 Chris Losinger, Smaller Animals Software. - http://www.smalleranimals.com - - This software is provided 'as-is', without any express - or implied warranty. In no event will the authors be - held liable for any damages arising from the use of this software. - - Permission is granted to anyone to use this software - for any purpose, including commercial applications, and - to alter it and redistribute it freely, subject to the - following restrictions: - - 1. The origin of this software must not be misrepresented; - you must not claim that you wrote the original software. - If you use this software in a product, an acknowledgment - in the product documentation would be appreciated but is not required. - - 2. Altered source versions must be plainly marked as such, - and must not be misrepresented as being the original software. - - 3. This notice may not be removed or altered from any source - distribution. - - ------------------------- - - Example : - - Our example application uses a command line that has two - required switches and two optional switches. The app should abort - if the required switches are not present and continue with default - values if the optional switches are not present. - - Sample command line : - MyApp.exe -p1 text1 text2 -p2 "this is a big argument" -opt1 -55 -opt2 - - Switches -p1 and -p2 are required. - p1 has two arguments and p2 has one. - - Switches -opt1 and -opt2 are optional. - opt1 requires a numeric argument. - opt2 has no arguments. - - Also, assume that the app displays a 'help' screen if the '-h' switch - is present on the command line. - - #include "CmdLine.h" - - void main(int argc, char **argv) - { - // our cmd line parser object - CCmdLine cmdLine; - - // parse argc,argv - if (cmdLine.SplitLine(argc, argv) < 1) - { - // no switches were given on the command line, abort - ASSERT(0); - exit(-1); - } - - // test for the 'help' case - if (cmdLine.HasSwitch("-h")) - { - show_help(); - exit(0); - } - - // get the required arguments - string p1_1, p1_2, p2_1; - // if any of these fail, we'll end up in the catch() block - p1_1 = cmdLine.GetArgument("-p1", 0); - p1_2 = cmdLine.GetArgument("-p1", 1); - p2_1 = cmdLine.GetArgument("-p2", 0); - - - // get the optional parameters - - // convert to an int, default to '100' - int iOpt1Val = atoi(cmdLine.GetSafeArgument("-opt1", 0, 100)); - - // since opt2 has no arguments, just test for the presence of - // the '-opt2' switch - bool bOptVal2 = cmdLine.HasSwitch("-opt2"); - - .... and so on.... - - } - - If this class is used in an MFC application, string is CString, else - it uses the STL 'string' type. - - If this is an MFC app, you can use the __argc and __argv macros from - you CYourWinApp::InitInstance function in place of the standard argc - and argv variables. - -------------------------------------------------------*/ -#ifndef GCF_CMDLINE_H -#define GCF_CMDLINE_H - -// tell the compiler to shut up -#pragma warning(disable:4786) - -#include <Common/lofar_map.h> -#include <Common/lofar_string.h> -#include <Common/lofar_vector.h> - -// handy little container for our argument vector -struct CCmdParam -{ - vector<string> m_strings; -}; - -// this class is actually a map of strings to vectors -typedef map<string, CCmdParam> _CCmdLine; - -// the command line parser class -class CCmdLine : public _CCmdLine -{ - -public: - /*------------------------------------------------------ - int CCmdLine::SplitLine(int argc, char **argv) - - parse the command line into switches and arguments. - - returns number of switches found - ------------------------------------------------------*/ - int SplitLine(int argc, char **argv); - - /*------------------------------------------------------ - bool CCmdLine::HasSwitch(const char *pSwitch) - - was the switch found on the command line ? - - ex. if the command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5 - - call return - ---- ------ - cmdLine.HasSwitch("-a") true - cmdLine.HasSwitch("-z") false - ------------------------------------------------------*/ - bool HasSwitch(const char *pSwitch); - - /*------------------------------------------------------ - - string CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault) - - fetch an argument associated with a switch . if the parameter at - index iIdx is not found, this will return the default that you - provide. - - example : - - command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5 - - call return - ---- ------ - cmdLine.GetSafeArgument("-a", 0, "zz") p1 - cmdLine.GetSafeArgument("-a", 1, "zz") p2 - cmdLine.GetSafeArgument("-b", 0, "zz") p4 - cmdLine.GetSafeArgument("-b", 1, "zz") zz - - ------------------------------------------------------*/ - - string GetSafeArgument(const char *pSwitch, unsigned int iIdx, const char *pDefault = 0); - - /*------------------------------------------------------ - - string CCmdLine::GetArgument(const char *pSwitch, int iIdx) - - fetch a argument associated with a switch. - - example : - - command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5 - - call return - ---- ------ - cmdLine.GetArgument("-a", 0) p1 - cmdLine.GetArgument("-b", 1) returns an empty string - - ------------------------------------------------------*/ - string GetArgument(const char *pSwitch, unsigned int iIdx); - - /*------------------------------------------------------ - int CCmdLine::GetArgumentCount(const char *pSwitch) - - returns the number of arguments found for a given switch. - - returns -1 if the switch was not found - - ------------------------------------------------------*/ - int GetArgumentCount(const char *pSwitch); - -protected: - /*------------------------------------------------------ - - protected member function - test a parameter to see if it's a switch : - - switches are of the form : -x - where 'x' is one or more characters. - the first character of a switch must be non-numeric! - - ------------------------------------------------------*/ - bool IsSwitch(const char *pParam); -}; - -#endif diff --git a/MAC/GCF/GCFCommon/src/Makefile.am b/MAC/GCF/GCFCommon/src/Makefile.am index d80a95f7bee..31b6a902aed 100644 --- a/MAC/GCF/GCFCommon/src/Makefile.am +++ b/MAC/GCF/GCFCommon/src/Makefile.am @@ -9,7 +9,8 @@ pkginclude_HEADERS = \ ../include/GCF/GCF_PVUnsigned.h \ ../include/GCF/GCF_PVDynArr.h \ ../include/GCF/CmdLine.h \ - ../include/GCF/Utils.h + ../include/GCF/Utils.h \ + ../include/GCF/GCF_Defines.h DOCHDRS = $(pkginclude_HEADERS) @@ -27,5 +28,7 @@ libgcfcommon_la_SOURCES= $(DOCHDRS) \ GCF_PVUnsigned.cc \ GCF_PVDynArr.cc +libgcfcommon_la_CPPFLAGS=-I$(top_srcdir)/include + include $(lofar_sharedir)/Makefile.common diff --git a/MAC/GCF/GCFCommon/src/Utils.cc b/MAC/GCF/GCFCommon/src/Utils.cc index 5e516a610be..7e717dcbc20 100644 --- a/MAC/GCF/GCFCommon/src/Utils.cc +++ b/MAC/GCF/GCFCommon/src/Utils.cc @@ -1,4 +1,4 @@ -#include "Utils.h" +#include <GCF/Utils.h> #include <stdio.h> #include <assert.h> #include <GCF/GCF_Defines.h> @@ -66,5 +66,5 @@ bool Utils::isValidPropName(const char* propName) } } } - return result; + return true;// TODO: use regular expression to find out the name meets the convention } diff --git a/MAC/GCF/GCFCommon/src/Utils.h b/MAC/GCF/GCFCommon/src/Utils.h deleted file mode 100644 index 64754a5f4ae..00000000000 --- a/MAC/GCF/GCFCommon/src/Utils.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef UTILS_H -#define UTILS_H - -#include <Common/lofar_string.h> -#include <Common/lofar_list.h> - -class Utils -{ - public: - - Utils(); - ~Utils(); - - static void getPropertyListString(string& propListString, - const list<string>& propertyList); - static void getPropertyListFromString(list<string>& propertyList, - const string& propListString); - - static bool isValidPropName(const char* propName); -}; - -#endif // UTILS_H diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Event.h b/MAC/GCF/TM/include/GCF/TM/GCF_Event.h index 54892a0a10e..6483eba92d9 100644 --- a/MAC/GCF/TM/include/GCF/TM/GCF_Event.h +++ b/MAC/GCF/TM/include/GCF/TM/GCF_Event.h @@ -34,6 +34,7 @@ %} #endif + /** * This struct is the base event data container to exchange messages between two * tasks. @@ -53,6 +54,9 @@ * file and the nested key-value pairs from the specification file. This header * file contains definitions of GCFEvent sub classes, one for each event. */ + +#define SIZEOF_EVENT(e) ((ssize_t) (sizeof((e).signal) + sizeof((e).length) + (e).length)) + class GCFEvent { public: diff --git a/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h b/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h index ba4e49ce9af..1d8f7c5ffaa 100644 --- a/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h +++ b/MAC/GCF/TM/include/GCF/TM/GCF_Protocols.h @@ -114,7 +114,7 @@ struct GCFTimerEvent : public GCFEvent long sec; long usec; unsigned long id; - const void* arg; + void* arg; }; #endif diff --git a/MAC/GCF/TM/src/GCF_Task.cc b/MAC/GCF/TM/src/GCF_Task.cc index fa881aafc2c..a10810b6593 100644 --- a/MAC/GCF/TM/src/GCF_Task.cc +++ b/MAC/GCF/TM/src/GCF_Task.cc @@ -86,7 +86,9 @@ void GCFTask::init(int argc, char** argv) serviceFilesPath += '/'; serviceFilesPrefix = serviceFilesPath + serviceFilesPrefix; - + + INIT_LOGGER(serviceFilesPath + "log4cplus.properties"); + if (GTMNameService::instance()->init(serviceFilesPrefix.c_str()) < 0) { LOG_ERROR(LOFAR::formatString ( diff --git a/MAC/GCF/TM/src/Makefile.am b/MAC/GCF/TM/src/Makefile.am index 879ae854e30..7938209eb0b 100644 --- a/MAC/GCF/TM/src/Makefile.am +++ b/MAC/GCF/TM/src/Makefile.am @@ -26,9 +26,9 @@ DOCHDRS = $(pkginclude_HEADERS) \ Socket/GTM_SocketHandler.h \ Socket/GTM_ETHSocket.h -lib_LTLIBRARIES = libtm.la +lib_LTLIBRARIES = libgcftm.la -libtm_la_SOURCES= $(DOCHDRS) \ +libgcftm_la_SOURCES= $(DOCHDRS) \ GCF_Fsm.cc \ GCF_Protocols.cc \ GCF_Task.cc \ @@ -49,7 +49,7 @@ libtm_la_SOURCES= $(DOCHDRS) \ Socket/GTM_ETHSocket.cc \ Socket/GCF_ETHRawPort.cc -libtm_la_CPPFLAGS=-I$(top_srcdir)/include +libgcftm_la_CPPFLAGS=-I$(top_srcdir)/include include $(lofar_sharedir)/Makefile.common diff --git a/MAC/GCF/TM/src/Socket/GCF_TCPPort.cc b/MAC/GCF/TM/src/Socket/GCF_TCPPort.cc index 33ca9d885f5..6d3ef9a6954 100644 --- a/MAC/GCF/TM/src/Socket/GCF_TCPPort.cc +++ b/MAC/GCF/TM/src/Socket/GCF_TCPPort.cc @@ -161,7 +161,7 @@ ssize_t GCFTCPPort::send(GCFEvent& e) if ((written = _pSocket->send(buf, packsize)) != packsize) { LOG_DEBUG(LOFAR::formatString ( - "truncated send: %s", + "truncated send, error: %s", strerror(errno))); schedule_disconnected(); diff --git a/MAC/GCF/TM/test/Makefile.am b/MAC/GCF/TM/test/Makefile.am index a0798de07c0..baac65262f6 100644 --- a/MAC/GCF/TM/test/Makefile.am +++ b/MAC/GCF/TM/test/Makefile.am @@ -3,12 +3,12 @@ check_PROGRAMS = echoapp ping TESTS = #echoapp ping echoapp_SOURCES = Echo.cc Echo_Protocol.cc -echoapp_LDADD = ../src/libtm.la -echoapp_DEPENDENCIES = ../src/libtm.la $(LOFAR_DEPEND) +echoapp_LDADD = ../src/libgcftm.la +echoapp_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND) ping_SOURCES = Ping.cc Echo_Protocol.cc -ping_LDADD = ../src/libtm.la -ping_DEPENDENCIES = ../src/libtm.la $(LOFAR_DEPEND) +ping_LDADD = ../src/libgcftm.la +ping_DEPENDENCIES = ../src/libgcftm.la $(LOFAR_DEPEND) AUTOGEN = autogen SUFFIXES = .ph diff --git a/MAC/GCF/TM/test/tutorial.ns.in b/MAC/GCF/TM/test/tutorial.ns.in new file mode 100644 index 00000000000..71eb819712f --- /dev/null +++ b/MAC/GCF/TM/test/tutorial.ns.in @@ -0,0 +1,38 @@ +# +# Name service configuration file. +# +# This file contains name and configuration information +# for tasks and their ports. +# +# For each task the host on which the task runs is specified +# with the 'host' attribute e.g.: +# +# [TASK_A] +# host=localhost +# +# For each SAP port the port type (TCP or UDP) can be +# specified with the .type' attribute e.g.: +# +# [TASK_B] +# host=localhost +# mysap.type=TCP +# +# For each SPP port the port type (.type), portnumber (.port) +# and host on which to find the SPP port (.host) can +# be specified e.g. +# +# [TASK_C] +# host=localhost +# myspp.type=UDP +# myspp.host=remotehost.remote.org +# myspp.port=20033 +# + +[PING] +host=localhost +client.type=TCP # SAP + +[ECHO] +host=localhost +server.port=20031 # SPP +server.type=TCP diff --git a/MAC/GCF/TM/test/tutorial.top.in b/MAC/GCF/TM/test/tutorial.top.in new file mode 100644 index 00000000000..755aad4549c --- /dev/null +++ b/MAC/GCF/TM/test/tutorial.top.in @@ -0,0 +1,27 @@ +# +# Each task is a block like this: +# +# [TaskName] +# +# For each task a specification is given of how to +# connect a task's SAP's to the remote tasks SPP like this: +# +# [TaskName] +# local_SAP_port_name = remote_task_name:remote_SPP_port_name +# +# Connections are initiated by the SAP and accepted +# by the SPP. Although establishing the connection +# is directional from SAP to SPP, the data transport +# via the ports is bidirectional. +# + +# +# Connect SAP port 'client' of task 'PING' to +# SPP port 'server' of task 'ECHO' +# + +[PING] +client=ECHO:server + +[ECHO] +# has no SAP's diff --git a/MAC/GCF/_PAL/PA/src/GPA_Controller.cc b/MAC/GCF/_PAL/PA/src/GPA_Controller.cc index dea3113cefb..32e99266eaa 100644 --- a/MAC/GCF/_PAL/PA/src/GPA_Controller.cc +++ b/MAC/GCF/_PAL/PA/src/GPA_Controller.cc @@ -25,7 +25,7 @@ #include <stdio.h> #include <PA_Protocol.ph> -#define CHECK_REQUEST(p, e) \ +#define QUEUE_REQUEST(p, e) \ if (!mayContinue(e, p)) break; static string sPATaskName("PA"); @@ -34,13 +34,21 @@ GPAController::GPAController() : GCFTask((State)&GPAController::initial, sPATaskName), _isBusy(false), _isRegistered(false), - _counter(0) + _counter(0), + _pCurPropSet(0) { // register the protocol for debugging purposes registerProtocol(PA_PROTOCOL, PA_PROTOCOL_signalnames); // initialize the port _pmlPortProvider.init(*this, "server", GCFPortInterface::MSPP, PA_PROTOCOL); + + // To force a connection with the PVSS system at start-up of the PA + // a dummy property set will be created temporary. + // The GPAPropertySet class inherits from the GSAService class which initiates + // the connection with the PVSS system on construction. Because it will managed + // by a singleton the property set only needs to be temporary. + GPAPropertySet dummy(*this, _pmlPortProvider); } GPAController::~GPAController() @@ -62,7 +70,7 @@ GCFEvent::TResult GPAController::initial(GCFEvent& e, GCFPortInterface& p) break; case F_CONNECTED: - TRAN(GPAController::connected); + TRAN(GPAController::operational); break; case F_DISCONNECTED: @@ -78,51 +86,35 @@ GCFEvent::TResult GPAController::initial(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult GPAController::operational(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { + case F_CONNECTED: + _pmlPorts.push_back(&p); + break; + + case F_ACCEPT_REQ: + acceptConnectRequest(); + break; + case F_DISCONNECTED: - if (&p == &_pmlPortProvider) - { - //TODO: find out this can realy happend - } - else - { - p.close(); - } + if (&p != &_pmlPortProvider) p.close(); + // else //TODO: find out this can realy happend break; - + case F_CLOSED: { - CHECK_REQUEST(p, e) - GPAPropertySet* pPropSet(0); - _counter = 0; - for (TPropertySets::iterator iter = _propertySets.begin(); - iter != _propertySets.end(); ++iter) - { - pPropSet = iter->second; - assert(pPropSet); - if (pPropSet->isOwner(p) || pPropSet->knowsClient(p)) - { - // these property sets will be deleted after they will be unregistered - // correctly - _counter++; - } - pPropSet->deleteClient(p); - } - _pmlPortProvider.setTimer(0, 0, 0, 0, (void*) &p); + QUEUE_REQUEST(p, e); + closeConnection(p); break; } - case F_CONNECTED: - _pmlPorts.push_back(&p); - break; case PA_LOAD_PROP_SET: { - CHECK_REQUEST(p, e) + QUEUE_REQUEST(p, e); PALoadPropSetEvent request(e); GPAPropertySet* pPropSet = findPropSet(request.scope); if (pPropSet) @@ -140,7 +132,7 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) } case PA_UNLOAD_PROP_SET: { - CHECK_REQUEST(p, e) + QUEUE_REQUEST(p, e); PAUnloadPropSetEvent request(e); GPAPropertySet* pPropSet = findPropSet(request.scope); if (pPropSet) @@ -158,7 +150,7 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) } case PA_CONF_PROP_SET: { - CHECK_REQUEST(p, e) + QUEUE_REQUEST(p, e) PAConfPropSetEvent request(e); GPAPropertySet* pPropSet = findPropSet(request.scope); if (pPropSet) @@ -177,7 +169,7 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) } case PA_REGISTER_SCOPE: { - CHECK_REQUEST(p, e) + QUEUE_REQUEST(p, e) PARegisterScopeEvent request(e); GPAPropertySet* pPropSet = findPropSet(request.scope); if (pPropSet) @@ -191,13 +183,17 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) { pPropSet = new GPAPropertySet(*this, p); _propertySets[request.scope] = pPropSet; - pPropSet->enable(request); + if (!pPropSet->enable(request)) + { + delete pPropSet; + _propertySets.erase(request.scope); + } } break; } case PA_UNREGISTER_SCOPE: { - CHECK_REQUEST(p, e) + QUEUE_REQUEST(p, e) PAUnregisterScopeEvent request(e); GPAPropertySet* pPropSet = findPropSet(request.scope); if (pPropSet) @@ -213,7 +209,7 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) } break; } - case PA_PROP_SET_LINKED: + /*case PA_PROP_SET_LINKED: { PAPropSetLinkedEvent response(e); GPAPropertySet* pPropSet = findPropSet(response.scope); @@ -228,19 +224,32 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) assert(pPropSet); pPropSet->unlinked(response); break; + }*/ + case PA_LINK_PROP_SET: + { + PALinkPropSetEvent* pRequest = (PALinkPropSetEvent*) (&e); + _pCurPropSet = findPropSet(pRequest->scope); + assert(_pCurPropSet); + _pmlPortProvider.setTimer(0, 0, 0, 0, &p); // pass the server port + p.send(e); + TRAN(GPAController::linking); + break; } - case F_ACCEPT_REQ: + case PA_UNLINK_PROP_SET: { - GCFTCPPort* pNewPMLPort = new GCFTCPPort(); - pNewPMLPort->init(*this, "pa", GCFPortInterface::SPP, PA_PROTOCOL); - _pmlPortProvider.accept(*pNewPMLPort); + PALinkPropSetEvent* pRequest = (PALinkPropSetEvent*) (&e); + _pCurPropSet = findPropSet(pRequest->scope); + assert(_pCurPropSet); + _pmlPortProvider.setTimer(0, 0, 0, 0, &p); // pass the server port + p.send(e); + TRAN(GPAController::unlinking); break; - } + } case F_TIMER: { + GCFTimerEvent* pTimer = (GCFTimerEvent*)(&e); if (&p == &_pmlPortProvider) { - GCFTimerEvent* pTimer = (GCFTimerEvent*)(&e); if (_deletePortTimId == pTimer->id) { GCFPortInterface* pPort = (GCFPortInterface*)(pTimer->arg); @@ -272,7 +281,181 @@ GCFEvent::TResult GPAController::connected(GCFEvent& e, GCFPortInterface& p) } } - } + } + else + { + GCFEvent* pEvent = _requestManager.getOldestRequest(); + PAUnregisterScopeEvent request(*pEvent); + GPAPropertySet* pPropSet = findPropSet(request.scope); + if (pPropSet) + { + delete pPropSet; + } + _propertySets.erase(request.scope); + PAScopeUnregisteredEvent response; + response.seqnr = request.seqnr; + response.result = (TPAResult) (unsigned int) (pTimer->arg); + if (p.isConnected()) + { + p.send(response); + } + doNextRequest(); + } + + break; + } + + default: + status = GCFEvent::NOT_HANDLED; + break; + } + + return status; +} + +GCFEvent::TResult GPAController::linking(GCFEvent& e, GCFPortInterface& p) +{ + GCFEvent::TResult status = GCFEvent::HANDLED; + static GCFPortInterface* pPort = 0; + + switch (e.signal) + { + case F_ENTRY: + pPort = 0; + break; + + case F_CONNECTED: + _pmlPorts.push_back(&p); + break; + + case F_ACCEPT_REQ: + acceptConnectRequest(); + break; + + case F_DISCONNECTED: + if (&p != &_pmlPortProvider) p.close(); + // else //TODO: find out this can realy happend + break; + + case F_CLOSED: + if (&p == pPort) + { + // this closed event came from the port wherefrom a link response were expected + // the response will not come anymore, so we can continue with an error + // it also registers this event for further handling (closeConnection) + TRAN(GPAController::operational); + PAPropSetLinkedEvent response; + response.result = PA_SERVER_GONE; + _requestManager.registerRequest(p, e); + assert(_pCurPropSet); + _pCurPropSet->linked(response); + break; + } + // intentional fall through + case PA_LOAD_PROP_SET: + case PA_UNLOAD_PROP_SET: + case PA_CONF_PROP_SET: + case PA_REGISTER_SCOPE: + case PA_UNREGISTER_SCOPE: + { + QUEUE_REQUEST(p, e); + // should not passes the check because in this state it is always busy + assert(0); + break; + } + case PA_PROP_SET_LINKED: + { + PAPropSetLinkedEvent response(e); + _pmlPortProvider.cancelAllTimers(); + TRAN(GPAController::operational); + assert(_pCurPropSet); + _pCurPropSet->linked(response); + break; + } + case F_TIMER: + { + assert(&p == &_pmlPortProvider); + + GCFTimerEvent* pTimer = (GCFTimerEvent*)(&e); + + pPort = (GCFPortInterface*)(pTimer->arg); + break; + } + + default: + status = GCFEvent::NOT_HANDLED; + break; + } + + return status; +} + +GCFEvent::TResult GPAController::unlinking(GCFEvent& e, GCFPortInterface& p) +{ + GCFEvent::TResult status = GCFEvent::HANDLED; + static GCFPortInterface* pPort = 0; + + switch (e.signal) + { + case F_ENTRY: + pPort = 0; + break; + + case F_CONNECTED: + _pmlPorts.push_back(&p); + break; + + case F_ACCEPT_REQ: + acceptConnectRequest(); + break; + + case F_DISCONNECTED: + if (&p != &_pmlPortProvider) p.close(); + // else //TODO: find out this can realy happend + break; + + case F_CLOSED: + if (&p == pPort) + { + // this closed event came from the port wherefrom a link response is expected + // the response will not come anymore, so we can continue with an error + // it also registers this event for further handling (closeConnection) + TRAN(GPAController::operational); + PAPropSetUnlinkedEvent response; + response.result = PA_SERVER_GONE; + _requestManager.registerRequest(p, e); + assert(_pCurPropSet); + _pCurPropSet->unlinked(response); + break; + } + // intentional fall through + case PA_LOAD_PROP_SET: + case PA_UNLOAD_PROP_SET: + case PA_CONF_PROP_SET: + case PA_REGISTER_SCOPE: + case PA_UNREGISTER_SCOPE: + { + QUEUE_REQUEST(p, e); + // should always be queued because in this state PA is always busy + assert(0); + break; + } + case PA_PROP_SET_UNLINKED: + { + PAPropSetUnlinkedEvent response(e); + _pmlPortProvider.cancelAllTimers(); + TRAN(GPAController::operational); + assert(_pCurPropSet); + _pCurPropSet->unlinked(response); + break; + } + case F_TIMER: + { + assert(&p == &_pmlPortProvider); + + GCFTimerEvent* pTimer = (GCFTimerEvent*)(&e); + + pPort = (GCFPortInterface*)(pTimer->arg); break; } @@ -309,7 +492,7 @@ void GPAController::sendAndNext(GCFEvent& e) { // all responses, which are the result of a closed port will handled here assert (e.signal == PA_PROP_SET_UNLOADED || e.signal == PA_SCOPE_UNREGISTERED); - _counter--; // counter was set in connected method (signal F_CLOSED) + _counter--; // counter was set in operational method (signal F_CLOSED) if (_counter == 0) { // all responses are received now @@ -329,7 +512,7 @@ void GPAController::sendAndNext(GCFEvent& e) _counter++; // add the scope of the prop. set to be deleted propSetsToDelete.push_back(iter->first); - _pmlPortProvider.setTimer(0, 0, 0, 0, (void*) pPropSet); + _pmlPortProvider.setTimer(0, 0, 0, 0, (void*) (unsigned int) pPropSet); } } for (list<string>::iterator iter = propSetsToDelete.begin(); @@ -346,6 +529,14 @@ void GPAController::sendAndNext(GCFEvent& e) _counter++; } } + else if (e.signal == PA_SCOPE_UNREGISTERED) + { + // prop. set may be deleted now + // this is only possible after a context switch + // this can be forced by means of the 0 timer + PAScopeUnregisteredEvent* pE = (PAScopeUnregisteredEvent*) &e; + pPort->setTimer(0,0,0,0, (void*) pE->result); + } else { // normal use @@ -375,3 +566,39 @@ GPAPropertySet* GPAController::findPropSet(const string& scope) const TPropertySets::const_iterator iter = _propertySets.find(scope); return (iter != _propertySets.end() ? iter->second : 0); } + +void GPAController::acceptConnectRequest() +{ + GCFTCPPort* pNewPMLPort = new GCFTCPPort(); + pNewPMLPort->init(*this, "pa", GCFPortInterface::SPP, PA_PROTOCOL); + _pmlPortProvider.accept(*pNewPMLPort); +} + +void GPAController::closeConnection(GCFPortInterface& p) +{ + GPAPropertySet* pPropSet(0); + _counter = 0; + for (TPropertySets::iterator iter = _propertySets.begin(); + iter != _propertySets.end(); ++iter) + { + pPropSet = iter->second; + assert(pPropSet); + if (pPropSet->isOwner(p) || pPropSet->knowsClient(p)) + { + // these property sets will be deleted after they will be unregistered + // correctly + _counter++; + } + pPropSet->deleteClient(p); + } + if (_counter == 0) + { + // nothing needed to be done for any prop. set + // so the port can be deleted + // this is only possible after a context switch + // this can be forced by means of the 0 timer + _counter = 1; + _requestManager.deleteRequestsOfPort(p); + _deletePortTimId = _pmlPortProvider.setTimer(0, 0, 0, 0, (void*) &p); + } +} diff --git a/MAC/GCF/_PAL/PA/src/GPA_Controller.h b/MAC/GCF/_PAL/PA/src/GPA_Controller.h index 8623cd59ca2..1e6dc7557ba 100644 --- a/MAC/GCF/_PAL/PA/src/GPA_Controller.h +++ b/MAC/GCF/_PAL/PA/src/GPA_Controller.h @@ -47,14 +47,18 @@ class GPAController : public GCFTask private: // state methods GCFEvent::TResult initial(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult connected(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult operational(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult linking(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult unlinking(GCFEvent& e, GCFPortInterface& p); private: // helper methods friend class GPAPropertySet; bool mayContinue(GCFEvent& e, GCFPortInterface& p); void sendAndNext(GCFEvent& e); - void doNextRequest(); + void doNextRequest(); GPAPropertySet* findPropSet(const string& scope) const; + void acceptConnectRequest(); + void closeConnection(GCFPortInterface& p); private: // data members typedef map<string /*scope*/, GPAPropertySet*> TPropertySets; @@ -68,8 +72,9 @@ class GPAController : public GCFTask private: // admin. data members bool _isBusy; bool _isRegistered; - long _deletePortTimId; + unsigned long _deletePortTimId; unsigned int _counter; + GPAPropertySet* _pCurPropSet; }; diff --git a/MAC/GCF/_PAL/PA/src/GPA_Defines.h b/MAC/GCF/_PAL/PA/src/GPA_Defines.h index c51d43a7110..baed3f0958f 100644 --- a/MAC/GCF/_PAL/PA/src/GPA_Defines.h +++ b/MAC/GCF/_PAL/PA/src/GPA_Defines.h @@ -32,23 +32,16 @@ class GCFPValue; enum TPAResult { PA_NO_ERROR, PA_UNKNOWN_ERROR, - PA_SCOPE_ALREADY_REGISTERED, - PA_PROP_SET_GONE, + PA_WRONG_STATE, + PA_PS_GONE, PA_MISSING_PROPS, - PA_PROP_NOT_VALID, - PA_UNABLE_TO_LOAD_APC, - PA_NO_TYPE_SPECIFIED_IN_APC, - PA_EMPTY_SCOPE, - PA_SCADA_ERROR, - PA_SAL_ERROR, - PA_MACTYPE_UNKNOWN, PA_PROP_SET_NOT_EXISTS, PA_PROP_SET_ALLREADY_EXISTS, PA_DPTYPE_UNKNOWN, - PA_PS_ALLREADY_EXISTS, PA_INTERNAL_ERROR, - PA_WRONG_STATE, - PA_PS_NOT_EXISTS + PA_APC_NOT_EXISTS, + PA_LINK_TIME_OUT, + PA_SERVER_GONE, }; typedef struct diff --git a/MAC/GCF/_PAL/PA/src/GPA_PropertySet.cc b/MAC/GCF/_PAL/PA/src/GPA_PropertySet.cc index 7ace302df43..6f1b4c3153c 100644 --- a/MAC/GCF/_PAL/PA/src/GPA_PropertySet.cc +++ b/MAC/GCF/_PAL/PA/src/GPA_PropertySet.cc @@ -50,11 +50,17 @@ GPAPropertySet::~GPAPropertySet() { } -void GPAPropertySet::enable(PARegisterScopeEvent& request) +bool GPAPropertySet::enable(PARegisterScopeEvent& request) { PAScopeRegisteredEvent response; response.seqnr = request.seqnr; response.result = PA_NO_ERROR; + _savedSeqnr = request.seqnr; + LOG_INFO(LOFAR::formatString( + "Request to enable prop. set '%s' of type '%s'", + request.scope.c_str(), + request.type.c_str())); + bool enabled(false); switch (_state) { case S_DISABLED: @@ -74,17 +80,13 @@ void GPAPropertySet::enable(PARegisterScopeEvent& request) } else if (dpeExists(_name) && _isTemporary) { - LOG_INFO(LOFAR::formatString ( - "Temporary DP '%s' already exists!", - _type.c_str())); - response.result = PA_PS_ALLREADY_EXISTS; + LOG_ERROR("DP's for temporary prop. sets may not already exists!"); + response.result = PA_PROP_SET_ALLREADY_EXISTS; } else if (!dpeExists(_name) && !_isTemporary) { - LOG_INFO(LOFAR::formatString ( - "Permanent DP '%s' does not exists!", - _type.c_str())); - response.result = PA_PS_NOT_EXISTS; + LOG_ERROR("DP's for permanent prop. sets must already exists"); + response.result = PA_PROP_SET_NOT_EXISTS; } else if (_isTemporary) { @@ -103,6 +105,15 @@ void GPAPropertySet::enable(PARegisterScopeEvent& request) _state = S_DISABLED; _controller.sendAndNext(response); } + else + { + enabled = true; + if (!_isTemporary) + { + _state = S_ENABLED; + _controller.sendAndNext(response); + } + } break; } default: @@ -111,6 +122,7 @@ void GPAPropertySet::enable(PARegisterScopeEvent& request) _controller.sendAndNext(response); break; } + return enabled; } void GPAPropertySet::disable(PAUnregisterScopeEvent& request) @@ -119,10 +131,15 @@ void GPAPropertySet::disable(PAUnregisterScopeEvent& request) response.seqnr = request.seqnr; response.result = PA_NO_ERROR; _savedSeqnr = request.seqnr; + LOG_INFO(LOFAR::formatString( + "Request to disable prop. set '%s' of type '%s'", + _name.c_str(), + _type.c_str())); switch (_state) { case S_LINKED: { + LOG_INFO("Inform all client MCA's, which has load this prop. set, about disabling it"); PAPropSetGoneEvent indication; indication.scope = _name; GCFPortInterface* pPSClientPort; @@ -140,6 +157,8 @@ void GPAPropertySet::disable(PAUnregisterScopeEvent& request) // list will be automatically cleaned up on destruction of this class } // intentional fall through + case S_UNLINKING: + case S_LINKING: case S_ENABLED: { _state = S_DISABLING; @@ -149,7 +168,7 @@ void GPAPropertySet::disable(PAUnregisterScopeEvent& request) if (dpeExists(_name + string("_temp"))) { LOG_INFO(LOFAR::formatString ( - "%s_temp still exists! Will be removed too!", + "DP %s_temp must be removed!", _name.c_str())); if (dpDelete(_name + string("_temp")) != SA_NO_ERROR) { @@ -163,7 +182,7 @@ void GPAPropertySet::disable(PAUnregisterScopeEvent& request) if (dpeExists(_name)) { LOG_INFO(LOFAR::formatString ( - "%s still exists! Will be removed too!", + "DP %s still exists! Will be removed too!", _name.c_str())); if (dpDelete(_name) != SA_NO_ERROR) { @@ -202,14 +221,19 @@ void GPAPropertySet::load(PALoadPropSetEvent& request, GCFPortInterface& p) response.seqnr = request.seqnr; response.result = PA_NO_ERROR; _savedSeqnr = request.seqnr; + LOG_INFO(LOFAR::formatString( + "Request to load prop. set '%s' of type '%s'", + _name.c_str(), + _type.c_str())); switch (_state) { case S_ENABLED: - { + { _state = S_LINKING; assert(_usecount == 0); if (_isTemporary) { + LOG_INFO("Prop. set must be created"); if (dpCreate(_name, _type) != SA_NO_ERROR) { response.result = PA_INTERNAL_ERROR; @@ -217,7 +241,7 @@ void GPAPropertySet::load(PALoadPropSetEvent& request, GCFPortInterface& p) } else { - linkPropSet(); + link(); } if (response.result != PA_NO_ERROR) { @@ -255,15 +279,32 @@ void GPAPropertySet::load(PALoadPropSetEvent& request, GCFPortInterface& p) psClient.count = 1; _psClients.push_back(psClient); } + _usecount++; } break; } case S_LINKED: + { assert(dpeExists(_name)); + TPSClient* pPSClient = findClient(p); + if (pPSClient) + { + pPSClient->count++; + } + else // client not known yet + { + TPSClient psClient; + psClient.pPSClientPort = &p; + psClient.count = 1; + _psClients.push_back(psClient); + } _usecount++; + LOG_INFO(LOFAR::formatString( + "Prop. set already loaded! So only increase the usecount to %d", + _usecount)); _controller.sendAndNext(response); break; - + } default: wrongState("load"); response.result = PA_WRONG_STATE; @@ -272,6 +313,46 @@ void GPAPropertySet::load(PALoadPropSetEvent& request, GCFPortInterface& p) } } +void GPAPropertySet::link() +{ + assert(dpeExists(_name)); + if (_serverPort.isConnected()) + { + LOG_INFO(LOFAR::formatString( + "Prop. set '%s' will be linked", + _name.c_str())); + PALinkPropSetEvent request; + request.scope = _name; + _controller.dispatch(request, _serverPort); + } + else + { + _state = S_ENABLED; + PAPropSetLoadedEvent response; + response.seqnr = _savedSeqnr; + response.result = PA_PS_GONE; + _controller.sendAndNext(response); + } +} + +void GPAPropertySet::linked(PAPropSetLinkedEvent& response) +{ + PAPropSetLoadedEvent loadedResponse; + loadedResponse.seqnr = _savedSeqnr; + if (_state == S_LINKING) + { + _state = S_LINKED; + loadedResponse.result = response.result; + } + else + { + _state = S_ENABLED; + wrongState("linked"); + loadedResponse.result = PA_WRONG_STATE; + } + _controller.sendAndNext(loadedResponse); +} + void GPAPropertySet::unload(PAUnloadPropSetEvent& request, const GCFPortInterface& p) { PAPropSetUnloadedEvent response; @@ -279,16 +360,24 @@ void GPAPropertySet::unload(PAUnloadPropSetEvent& request, const GCFPortInterfac response.result = PA_NO_ERROR; _savedSeqnr = request.seqnr; _savedResult = PA_NO_ERROR; + LOG_INFO(LOFAR::formatString( + "Request to unload prop. set '%s' of type '%s'", + _name.c_str(), + _type.c_str())); switch (_state) { case S_LINKED: { _usecount--; + LOG_INFO(LOFAR::formatString( + "Decrease the usecount to %d", + _usecount)); if (_usecount == 0) { _state = S_UNLINKING; if (_isTemporary) { + LOG_INFO("Must delete related DP's due to usecount is null"); _counter = 0; if (dpDelete(_name) != SA_NO_ERROR) { @@ -298,18 +387,10 @@ void GPAPropertySet::unload(PAUnloadPropSetEvent& request, const GCFPortInterfac { _counter += 1; } - if (dpDelete(_name + string("_temp")) != SA_NO_ERROR) - { - response.result = PA_INTERNAL_ERROR; - } - else - { - _counter += 1; - } } else { - unlinkPropSet(); + unlink(); } } else @@ -351,27 +432,25 @@ void GPAPropertySet::unload(PAUnloadPropSetEvent& request, const GCFPortInterfac } } -void GPAPropertySet::configure(PAConfPropSetEvent& request) +void GPAPropertySet::unlink() { - //TODO: implement configure -} - -void GPAPropertySet::linked(PAPropSetLinkedEvent& response) -{ - PAPropSetLoadedEvent loadedResponse; - loadedResponse.seqnr = _savedSeqnr; - if (_state == S_LINKING) + if (_serverPort.isConnected()) { - _state = S_LINKED; - loadedResponse.result = response.result; + LOG_INFO(LOFAR::formatString( + "Prop. set '%s' will be unlinked", + _name.c_str())); + PAUnlinkPropSetEvent request; + request.scope = _name; + _controller.dispatch(request, _serverPort); } else { _state = S_ENABLED; - wrongState("linked"); - loadedResponse.result = PA_WRONG_STATE; + PAPropSetUnloadedEvent response; + response.seqnr = _savedSeqnr; + response.result = PA_PS_GONE; + _controller.sendAndNext(response); } - _controller.sendAndNext(loadedResponse); } void GPAPropertySet::unlinked(PAPropSetUnlinkedEvent& response) @@ -391,6 +470,55 @@ void GPAPropertySet::unlinked(PAPropSetUnlinkedEvent& response) _controller.sendAndNext(unloadedResponse); } +void GPAPropertySet::configure(PAConfPropSetEvent& request) +{ + TPAResult paResult(PA_NO_ERROR); + LOG_INFO(LOFAR::formatString( + "Request to configure prop. set '%s' with '%s.apc'", + _name.c_str(), + request.apcName.c_str())); + if (dpeExists(_name)) + { + string loadAPCcmd = "loadAPC " + _name + " " + request.apcName; + int result = system("chmod 777 loadAPC"); // execute rights are gone after check-out with eclipse + if (result == -1) + { + LOG_ERROR("System call cannot execute: chmod 777 loadAPC"); + paResult = PA_INTERNAL_ERROR; + } + else + { + result = system(loadAPCcmd.c_str()); + switch (result) + { + case -1: + LOG_ERROR(LOFAR::formatString( + "System call cannot execute: %s", + loadAPCcmd.c_str())); + paResult = PA_INTERNAL_ERROR; + break; + case 1: + LOG_ERROR("Apc file does exists in $MAC_CONFIG/Apc"); + paResult = PA_APC_NOT_EXISTS; + break; + } + } + } + else + { + paResult = PA_PROP_SET_NOT_EXISTS; + } + LOG_INFO(LOFAR::formatString( + "Ready with configuring prop. set '%s' (Error code: %d - see GPA_Defines.h)", + _name.c_str(), + paResult)); + PAPropSetConfEvent response; + response.seqnr = request.seqnr; + response.apcName = request.apcName; + response.result = paResult; + _controller.sendAndNext(response); +} + void GPAPropertySet::deleteClient(const GCFPortInterface& p) { if (&p == &_serverPort) @@ -429,12 +557,18 @@ void GPAPropertySet::dpCreated(const string& dpName) switch (_state) { case S_ENABLING: + { assert(dpName == (_name + string("_temp"))); _state = S_ENABLED; + PAScopeRegisteredEvent response; + response.seqnr = _savedSeqnr; + response.result = PA_NO_ERROR; + _controller.sendAndNext(response); break; + } case S_LINKING: assert(dpName == _name); - linkPropSet(); + link(); break; default: wrongState("dpCreated"); @@ -461,7 +595,7 @@ void GPAPropertySet::dpDeleted(const string& /*dpName*/) _counter--; if (_counter == 0) { - unlinkPropSet(); + unlink(); } break; default: @@ -470,26 +604,6 @@ void GPAPropertySet::dpDeleted(const string& /*dpName*/) } } -void GPAPropertySet::linkPropSet() -{ - assert(dpeExists(_name)); - //TODO: what if connection is realy disabled - assert(_serverPort.isConnected()); - PALinkPropSetEvent linkRequest; - linkRequest.scope = _name; - _serverPort.send(linkRequest); -} - -void GPAPropertySet::unlinkPropSet() -{ - assert(dpeExists(_name)); - //TODO: what if connection is realy disabled - assert(_serverPort.isConnected()); - PAUnlinkPropSetEvent unlinkRequest; - unlinkRequest.scope = _name; - _serverPort.send(unlinkRequest); -} - GPAPropertySet::TPSClient* GPAPropertySet::findClient(const GCFPortInterface& p) { TPSClient* pPSClient(0); @@ -535,5 +649,6 @@ void GPAPropertySet::wrongState(const char* request) LOG_WARN(LOFAR::formatString ( "Could not perform '%s' on property set '%s'. Wrong state: %s", request, + _name.c_str(), stateString)); } diff --git a/MAC/GCF/_PAL/PA/src/GPA_PropertySet.h b/MAC/GCF/_PAL/PA/src/GPA_PropertySet.h index bd67161c38e..3170568102e 100644 --- a/MAC/GCF/_PAL/PA/src/GPA_PropertySet.h +++ b/MAC/GCF/_PAL/PA/src/GPA_PropertySet.h @@ -48,7 +48,7 @@ class GPAPropertySet : public GSAService unsigned short count; } TPSClient; - void enable(PARegisterScopeEvent& request); + bool enable(PARegisterScopeEvent& request); void disable(PAUnregisterScopeEvent& request); void load(PALoadPropSetEvent& request, GCFPortInterface& p); void unload(PAUnloadPropSetEvent& request, const GCFPortInterface& p); @@ -72,9 +72,8 @@ class GPAPropertySet : public GSAService inline void dpeUnsubscribed(const string& /*propName*/) {}; private: // helper methods - - void linkPropSet(); - void unlinkPropSet(); + void link(); + void unlink(); void wrongState(const char* request); TPSClient* findClient(const GCFPortInterface& p); diff --git a/MAC/GCF/_PAL/PA/src/Makefile.am b/MAC/GCF/_PAL/PA/src/Makefile.am index f62e627b848..7b0bc3df4d5 100644 --- a/MAC/GCF/_PAL/PA/src/Makefile.am +++ b/MAC/GCF/_PAL/PA/src/Makefile.am @@ -37,14 +37,18 @@ PropertyAgent_CPPFLAGS= -I$(top_srcdir)/include/GCF/PAL \ BUILT_SOURCES = \ PA_Protocol.ph \ mac.ns \ - mac.top \ - log4cplus.properties + mac.top EXTRA_DIST = \ PA_Protocol.ph \ mac.ns \ - mac.top \ - log4cplus.properties + mac.top + +#in case of make install these files will be copied to the bindir beside the test apps +configfilesdir=$(bindir) +configfiles_DATA= \ + loadAPC + %.properties: $(MAC_CONFIG)/%.properties cp $< $@ diff --git a/MAC/GCF/_PAL/PA/src/loadAPC b/MAC/GCF/_PAL/PA/src/loadAPC new file mode 100644 index 00000000000..7b25bebbb0b --- /dev/null +++ b/MAC/GCF/_PAL/PA/src/loadAPC @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ -r $MAC_CONFIG/Apc/$2.apc ]; then + echo "`sed -e "s/__default_[A-Za-z0-9_]*/$1/g" $MAC_CONFIG/Apc/$2.apc`" > $2.apc.tmp + PVSS00ascii -in $2.apc.tmp -proj LCU + rm $2.apc.tmp + exit 0 +else + exit 1 +fi \ No newline at end of file diff --git a/MAC/GCF/_PAL/PML/src/GCF_Answer.cc b/MAC/GCF/_PAL/PML/src/GCF_Answer.cc index 8f1515ac5c2..a5ab0106aee 100644 --- a/MAC/GCF/_PAL/PML/src/GCF_Answer.cc +++ b/MAC/GCF/_PAL/PML/src/GCF_Answer.cc @@ -37,4 +37,5 @@ const char* F_PML_PROTOCOL_signalnames[] = "F_PS_CONFIGURED (IN)", "F_MYPS_ENABLED (IN)", "F_MYPS_DISABLED (IN)", + "F_SERVER_GONE (IN)", }; diff --git a/MAC/GCF/_PAL/PML/src/GCF_ExtPropertySet.cc b/MAC/GCF/_PAL/PML/src/GCF_ExtPropertySet.cc index cad4ec8ffe2..63906c42d1c 100644 --- a/MAC/GCF/_PAL/PML/src/GCF_ExtPropertySet.cc +++ b/MAC/GCF/_PAL/PML/src/GCF_ExtPropertySet.cc @@ -21,8 +21,8 @@ //# $Id$ #include <GCF/PAL/GCF_ExtPropertySet.h> -#include <GCF/PAL/GCF_Property.h> #include <GCF/PAL/GCF_ExtProperty.h> +#include <GCF/PAL/GCF_Answer.h> #include "GPM_Controller.h" #include <GCF/Utils.h> @@ -35,7 +35,18 @@ GCFExtPropertySet::GCFExtPropertySet(const char* name, loadPropSetIntoRam(); } -GCFProperty* GCFExtPropertySet::createPropObject(TProperty& propInfo) +GCFExtPropertySet::~GCFExtPropertySet() +{ + if (_isLoaded) + { + GPMController* pController = GPMController::instance(); + assert(pController); + + pController->unloadPropSet(*this); + } +} + +GCFProperty* GCFExtPropertySet::createPropObject(const TProperty& propInfo) { return new GCFExtProperty(propInfo, *this); } @@ -83,6 +94,74 @@ TGCFResult GCFExtPropertySet::load() return result; } +void GCFExtPropertySet::loaded(TGCFResult result) +{ + assert(_isBusy); + assert(!_isLoaded); + _isBusy = false; + if (result == GCF_NO_ERROR) + { + LOG_INFO(LOFAR::formatString ( + "PA-RESP: Prop. set '%s' is loaded", + getScope().c_str())); + _isLoaded = true; + } + + dispatchAnswer(F_EXTPS_LOADED, result); +} + +void GCFExtPropertySet::unloaded(TGCFResult result) +{ + assert(_isBusy); + assert(_isLoaded); + _isBusy = false; + if (result == GCF_NO_ERROR) + { + LOG_INFO(LOFAR::formatString ( + "PA-RESP: Prop. set '%s' is unloaded", + getScope().c_str())); + } + _isLoaded = false; + + GCFExtProperty* pProperty(0); + for (TPropertyList::iterator iter = _properties.begin(); + iter != _properties.end(); ++iter) + { + pProperty = (GCFExtProperty*) iter->second; + assert(pProperty); + if (pProperty->isSubscribed()) + { + pProperty->unsubscribe(); + } + } + + dispatchAnswer(F_EXTPS_UNLOADED, result); +} + +void GCFExtPropertySet::serverIsGone() +{ + assert(_isLoaded); + + LOG_INFO(LOFAR::formatString ( + "PA-IND: Server for prop. set '%s' is gone", + getScope().c_str())); + _isLoaded = false; + + GCFExtProperty* pProperty(0); + for (TPropertyList::iterator iter = _properties.begin(); + iter != _properties.end(); ++iter) + { + pProperty = (GCFExtProperty*) iter->second; + assert(pProperty); + if (pProperty->isSubscribed()) + { + pProperty->unsubscribe(); + } + } + + dispatchAnswer(F_SERVER_GONE, GCF_NO_ERROR); +} + TGCFResult GCFExtPropertySet::unload() { TGCFResult result(GCF_NO_ERROR); @@ -101,20 +180,18 @@ TGCFResult GCFExtPropertySet::unload() getScope().c_str())); result = GCF_NOT_LOADED; } - else if (_name.length() == 0 || - _scope.length() == 0 || - !Utils::isValidPropName(_scope.c_str())) + else if (getScope().length() == 0 || + !Utils::isValidPropName(getScope().c_str())) { LOG_INFO(LOFAR::formatString ( - "APC name or scope not set or scope (%s) meets not the naming convention. Ignored!", - _scope.c_str())); + "Instance name not set or meets not the naming convention (%s). Ignored!", + getScope().c_str())); result = GCF_NO_PROPER_DATA; } else { GPMController* pController = GPMController::instance(); assert(pController); - _loadDefaults = false; LOG_INFO(LOFAR::formatString ( "REQ: Unload ext. property set %s", getScope().c_str())); @@ -143,7 +220,7 @@ TGCFResult GCFExtPropertySet::requestValue(const string propName) const } } -TGCFResult GCFExtPropertySet::subscribe(const string propName) const +TGCFResult GCFExtPropertySet::subscribeProp(const string propName) const { GCFExtProperty* pProperty = (GCFExtProperty*) getProperty(propName); if (pProperty) @@ -159,7 +236,7 @@ TGCFResult GCFExtPropertySet::subscribe(const string propName) const } } -TGCFResult GCFExtPropertySet::unsubscribe(const string propName) const +TGCFResult GCFExtPropertySet::unsubscribeProp(const string propName) const { GCFExtProperty* pProperty = (GCFExtProperty*) getProperty(propName); if (pProperty) @@ -173,4 +250,4 @@ TGCFResult GCFExtPropertySet::unsubscribe(const string propName) const propName.c_str())); return GCF_PROP_NOT_IN_SET; } -} \ No newline at end of file +} diff --git a/MAC/GCF/_PAL/PML/src/GCF_MyProperty.cc b/MAC/GCF/_PAL/PML/src/GCF_MyProperty.cc index 29b844078fb..523924f7d36 100644 --- a/MAC/GCF/_PAL/PML/src/GCF_MyProperty.cc +++ b/MAC/GCF/_PAL/PML/src/GCF_MyProperty.cc @@ -34,8 +34,8 @@ GCFMyProperty::GCFMyProperty(const TProperty& propInfo, _isLinked(false), _propertySet(propertySet) { - assert(!exists()); - _pCurValue = GCFPValue::createMACTypeObject((GCFPValue::TMACValueType) propInfo.type); + if (propertySet.isTemporary()) assert(!exists()); + _pCurValue = GCFPValue::createMACTypeObject(propInfo.type); assert(_pCurValue); _pOldValue = _pCurValue->clone(); if (propInfo.defaultValue) @@ -111,29 +111,34 @@ GCFPValue* GCFMyProperty::getOldValue() const return 0; } -bool GCFMyProperty::link() +bool GCFMyProperty::link(bool setDefault, TGCFResult& result) { bool isAsync(false); assert(!_isLinked); - TGCFResult result(GCF_NO_ERROR); + result = GCF_NO_ERROR; assert(exists()); assert(!_isBusy); - if (_accessMode & GCF_READABLE_PROP) + if (_accessMode & GCF_READABLE_PROP && setDefault) { assert(_pCurValue); result = GCFProperty::setValue(*_pCurValue); - assert(result == GCF_NO_ERROR); } - if (_accessMode & GCF_WRITABLE_PROP ) + if (_accessMode & GCF_WRITABLE_PROP && result == GCF_NO_ERROR) { _changingAccessMode = false; + if (!setDefault) // getDefault from DB + { + requestValue(); + } result = subscribe(); - assert(result == GCF_NO_ERROR); - isAsync = true; - _isBusy = true; + if (result == GCF_NO_ERROR) + { + isAsync = true; + _isBusy = true; + } } - if (!isAsync) + if (!isAsync && result == GCF_NO_ERROR) _isLinked = true; return isAsync; } @@ -209,7 +214,12 @@ void GCFMyProperty::subscribed () void GCFMyProperty::valueGet (const GCFPValue& value) { - valueChanged(value); + TGCFResult result; + assert(_pOldValue && _pCurValue); + result = _pOldValue->copy(*_pCurValue); + assert(result == GCF_NO_ERROR); + result = _pCurValue->copy(value); + assert(result == GCF_NO_ERROR); } void GCFMyProperty::valueChanged (const GCFPValue& value) diff --git a/MAC/GCF/_PAL/PML/src/GCF_MyPropertySet.cc b/MAC/GCF/_PAL/PML/src/GCF_MyPropertySet.cc index 0e9adba07cd..70acefd21d5 100644 --- a/MAC/GCF/_PAL/PML/src/GCF_MyPropertySet.cc +++ b/MAC/GCF/_PAL/PML/src/GCF_MyPropertySet.cc @@ -25,30 +25,47 @@ #include <GPM_Controller.h> #include <GCF/PAL/GCF_Answer.h> #include <GCF/Utils.h> +#include <GCF/GCF_Defines.h> GCFMyPropertySet::GCFMyPropertySet(const char* name, const TPropertySet& typeInfo, - GCFAnswer* pAnswerObj) : + GCFAnswer* pAnswerObj, + TDefaultUse defaultUse) : GCFPropertySet(name, typeInfo, pAnswerObj), + _state(S_DISABLED), + _defaultUse(defaultUse), _counter(0), - _missing(0), - _state(S_DISABLED) + _missing(0) { loadPropSetIntoRam(); } +GCFMyPropertySet::GCFMyPropertySet(const char* name, + const TPropertySet& typeInfo, + TDefaultUse defaultUse) : + GCFPropertySet(name, typeInfo, 0), + _state(S_DISABLED), + _defaultUse(defaultUse), + _counter(0), + _missing(0) +{ + loadPropSetIntoRam(); +} GCFMyPropertySet::~GCFMyPropertySet () { - GPMController* pController = GPMController::instance(); - assert(pController); - // delete this set from the controller permanent - // this means no response will be send to this object - // on response of the PA - pController->unregisterScope(*this, true); + if (_state != S_DISABLED) + { + GPMController* pController = GPMController::instance(); + assert(pController); + // delete this set from the controller permanent + // this means no response will be send to this object + // on response of the PA + pController->unregisterScope(*this); + } } -GCFProperty* GCFMyPropertySet::createPropObject(TProperty& propInfo) +GCFProperty* GCFMyPropertySet::createPropObject(const TProperty& propInfo) { return new GCFMyProperty(propInfo, *this); } @@ -67,15 +84,6 @@ TGCFResult GCFMyPropertySet::enable () LOG_INFO(LOFAR::formatString ( "REQ: Register scope %s", getScope().c_str())); - const TProperty* pPropertyFields; - for (unsigned int i = 0; i < _propSetInfo.nrOfProperties; i++) - { - pPropertyFields = &_propSetInfo.properties[i]; - if (pPropertyFields->defaultValue) - { - setValue(pPropertyFields->propName, pPropertyFields->defaultValue); - } - } GPMController* pController = GPMController::instance(); assert(pController); TPMResult pmResult = pController->registerScope(*this); @@ -126,25 +134,11 @@ TGCFResult GCFMyPropertySet::disable () TPMResult pmResult = pController->unregisterScope(*this); assert(pmResult == PM_NO_ERROR); - _state = + _state = S_DISABLING; } return result; } -TGCFResult GCFMyPropertySet::setValue (const string propName, - const string value) -{ - GCFMyProperty* pProperty = (GCFMyProperty*)getProperty(propName); - if (pProperty) - { - return pProperty->setValue(value); - } - else - { - return GCF_PROP_NOT_IN_SET; - } -} - GCFPValue* GCFMyPropertySet::getValue (const string propName) { GCFMyProperty* pProperty = (GCFMyProperty*)getProperty(propName); @@ -183,10 +177,10 @@ void GCFMyPropertySet::scopeRegistered (TGCFResult result) } else { - _state == S_DISABLED; + _state = S_DISABLED; } - dispatchAnswer(F_MYPS_ENDABLED, result); + dispatchAnswer(F_MYPS_ENABLED, result); } void GCFMyPropertySet::scopeUnregistered (TGCFResult result) @@ -201,10 +195,11 @@ void GCFMyPropertySet::scopeUnregistered (TGCFResult result) dispatchAnswer(F_MYPS_DISABLED, result); } -void GCFMyPropertySet::linkProperties() +bool GCFMyPropertySet::linkProperties() { GPMController* pController = GPMController::instance(); assert(pController); + bool successful(true); switch (_state) { case S_ENABLING: @@ -215,75 +210,88 @@ void GCFMyPropertySet::linkProperties() break; case S_DISABLED: case S_DISABLING: - pController->propertiesLinked(getScope(), PA_PROP_SET_GONE); + pController->propertiesLinked(getScope(), PA_PS_GONE); break; case S_ENABLED: assert(_counter == 0); _missing = 0; _state = S_LINKING; - retryLinking(); + successful = tryLinking(); break; } + return successful; } -void GCFMyPropertySet::retryLinking() +bool GCFMyPropertySet::tryLinking() { GPMController* pController = GPMController::instance(); assert(pController); + bool successful(true); switch (_state) { case S_ENABLING: case S_LINKED: case S_ENABLED: - wrongState("retryLinking"); + wrongState("tryLinking"); pController->propertiesLinked(getScope(), PA_WRONG_STATE); break; case S_DISABLED: case S_DISABLING: - pController->propertiesLinked(getScope(), PA_PROP_SET_GONE); + pController->propertiesLinked(getScope(), PA_PS_GONE); break; case S_LINKING: { - TPropertyList::iterator iter = _properties.begin(); - pProperty = (GCFMyProperty*) iter->second; - assert(pProperty); - if (pProperty->exists()) + GCFMyProperty* pProperty(0); + TGCFResult result; + for(TPropertyList::iterator iter = _properties.begin(); + iter != _properties.end(); ++iter) { - for(;iter != _properties.end(); ++iter) + pProperty = (GCFMyProperty*) iter->second; + assert(pProperty); + if (pProperty->exists()) { - pProperty = (GCFMyProperty*) iter->second; - assert(pProperty); - if (pProperty->exists()) + + if (pProperty->link((_defaultUse == USE_MY_DEFAULTS), result)) { - if (pProperty->link()) - { - _counter++; - } + _counter++; } - else + if (result != GCF_NO_ERROR) { _missing++; } } - if (_counter == 0) + else { - // no more asyncronous link responses will be expected and - // no more properties needed to be linked - // so we can return a response to the controller - _state = S_LINKED; - if (_missing > 0) - { - pController->propertiesLinked(getScope(), PA_MISSING_PROPS); - } - else - { - pController->propertiesLinked(getScope(), PA_NO_ERROR); - } + _missing++; + } + } + if (_counter == 0) + { + if (_missing == _properties.size()) + { + // propset is not yet known in this application, retry it with a + // 0 timer + _missing = 0; + successful = false; + break; + } + // no more asyncronous link responses will be expected and + // no more properties needed to be linked + // so we can return a response to the controller + _state = S_LINKED; + if (_missing > 0) + { + pController->propertiesLinked(getScope(), PA_MISSING_PROPS); + } + else + { + pController->propertiesLinked(getScope(), PA_NO_ERROR); } } break; } } + return successful; } void GCFMyPropertySet::linked (GCFMyProperty& prop) @@ -305,7 +313,7 @@ void GCFMyPropertySet::linked (GCFMyProperty& prop) case S_DISABLED: case S_DISABLING: prop.unlink(); - pController->propertiesLinked(getScope(), PA_PROP_SET_GONE); + pController->propertiesLinked(getScope(), PA_PS_GONE); break; case S_LINKING: { @@ -335,20 +343,19 @@ void GCFMyPropertySet::unlinkProperties() switch (_state) { case S_ENABLING: - case S_LINKED: + case S_LINKING: case S_ENABLED: wrongState("unlinkProperties"); - prop.unlink(); pController->propertiesUnlinked(getScope(), PA_WRONG_STATE); break; case S_DISABLED: case S_DISABLING: - prop.unlink(); - pController->propertiesUnlinked(getScope(), PA_PROP_SET_GONE); + pController->propertiesUnlinked(getScope(), PA_PS_GONE); break; case S_LINKED: { _state = S_ENABLED; + GCFMyProperty* pProperty(0); for (TPropertyList::iterator iter = _properties.begin(); iter != _properties.end(); ++iter) { @@ -385,8 +392,9 @@ void GCFMyPropertySet::wrongState(const char* request) stateString = "LINKED"; break; } - LOFAR_LOG_WARN(PML_STDOUT_LOGGER, ( + LOG_WARN(LOFAR::formatString ( "Could not perform '%s' on property set '%s'. Wrong state: %s", request, + getScope().c_str(), stateString)); -} \ No newline at end of file +} diff --git a/MAC/GCF/_PAL/PML/src/GCF_Property.cc b/MAC/GCF/_PAL/PML/src/GCF_Property.cc index f78d2c13030..9cfe74e566c 100644 --- a/MAC/GCF/_PAL/PML/src/GCF_Property.cc +++ b/MAC/GCF/_PAL/PML/src/GCF_Property.cc @@ -47,18 +47,18 @@ const string GCFProperty::getFullName () const { if (_pPropertySet == 0) { - return _name; + return _propInfo.propName; } else { string scope = _pPropertySet->getScope(); if (scope.length() == 0) { - return _name; + return _propInfo.propName; } else { - string fullName = scope + GCF_PROP_NAME_SEP + _name; + string fullName = scope + GCF_PROP_NAME_SEP + _propInfo.propName; return fullName; } } @@ -75,6 +75,21 @@ TGCFResult GCFProperty::setValue(const GCFPValue& value) return _pPropService->setPropValue(getFullName(), value); } +TGCFResult GCFProperty::setValue(const string& value) +{ + assert(_pPropService); + GCFPValue* pValue = GCFPValue::createMACTypeObject(_propInfo.type); + if (pValue) + { + pValue->setValue(value); + return _pPropService->setPropValue(getFullName(), *pValue); + } + else + { + return GCF_PROP_WRONG_TYPE; + } +} + bool GCFProperty::exists () { assert(_pPropService); @@ -104,7 +119,7 @@ void GCFProperty::dispatchAnswer(GCFEvent& answer) void GCFProperty::subscribed () { GCFPropAnswerEvent e(F_SUBSCRIBED); - e.pPropName = _name.c_str(); + e.pPropName = _propInfo.propName; dispatchAnswer(e); } @@ -112,7 +127,7 @@ void GCFProperty::valueChanged (const GCFPValue& value) { GCFPropValueEvent e(F_VCHANGEMSG); e.pValue = &value; - e.pPropName = _name.c_str(); + e.pPropName = _propInfo.propName; e.internal = false; dispatchAnswer(e); } @@ -121,6 +136,6 @@ void GCFProperty::valueGet (const GCFPValue& value) { GCFPropValueEvent e(F_VGETRESP); e.pValue = &value; - e.pPropName = _name.c_str(); + e.pPropName = _propInfo.propName; dispatchAnswer(e); } diff --git a/MAC/GCF/_PAL/PML/src/GCF_PropertySet.cc b/MAC/GCF/_PAL/PML/src/GCF_PropertySet.cc index d2654b64f3e..730e96a8168 100644 --- a/MAC/GCF/_PAL/PML/src/GCF_PropertySet.cc +++ b/MAC/GCF/_PAL/PML/src/GCF_PropertySet.cc @@ -23,23 +23,29 @@ #include <GCF/PAL/GCF_PropertySet.h> #include <GCF/PAL/GCF_ExtPropertySet.h> #include <GCF/PAL/GCF_Property.h> +#include <GCF/PAL/GCF_Answer.h> +#include <GCF/GCF_PValue.h> #include <GCF/Utils.h> #include <GPM_Defines.h> +#include <GPM_Controller.h> + +const TProperty dummyPropInfo = + {"DUMMY", LPT_BOOL, 0, "FALSE"}; GCFPropertySet::GCFPropertySet (const char* name, const TPropertySet& typeInfo, GCFAnswer* pAnswerObj) : + _isBusy(false), _pAnswerObj(pAnswerObj), - _scope(name), - _propSetInfo(typeInfo), - _dummyProperty("", this) - _isBusy(false), + _scope((name ? name : "")), + _dummyProperty(dummyPropInfo, this), + _propSetInfo(typeInfo) { - if (!Utils::isValidPropName(scope.c_str())) + if (!Utils::isValidPropName(_scope.c_str())) { - LOFAR_LOG_WARN(PML_STDOUT_LOGGER, ( + LOG_WARN(LOFAR::formatString ( "Scope %s meets not the name convention! Set to \"\"", - scope.c_str())); + _scope.c_str())); _scope = ""; } } @@ -48,9 +54,13 @@ GCFPropertySet::~GCFPropertySet() { clearAllProperties(); _dummyProperty.resetPropSetRef(); + + GPMController* pController = GPMController::instance(); + assert(pController); + pController->deletePropSet(*this); } -void GCFMyPropertySet::loadPropSetIntoRam() +void GCFPropertySet::loadPropSetIntoRam() { GCFProperty* pProperty; const char* propName; @@ -115,6 +125,20 @@ TGCFResult GCFPropertySet::setValue (const string propName, return GCF_PROP_NOT_IN_SET; } } + +TGCFResult GCFPropertySet::setValue (const string propName, + const string value) +{ + GCFProperty* pProperty = getProperty(propName); + if (pProperty) + { + return pProperty->setValue(value); + } + else + { + return GCF_PROP_NOT_IN_SET; + } +} void GCFPropertySet::setAnswer (GCFAnswer* pAnswerObj) { @@ -158,7 +182,7 @@ void GCFPropertySet::configured(TGCFResult result, const string& apcName) { if (_pAnswerObj != 0) { - GCFConfAnswerEvent e(sig); + GCFConfAnswerEvent e; e.pScope = getScope().c_str(); e.pApcName = apcName.c_str(); e.result = result; @@ -218,3 +242,16 @@ void GCFPropertySet::dispatchAnswer(unsigned short sig, TGCFResult result) } } +void GCFPropertySet::setDefaults() +{ + const TProperty* pPropertyFields; + for (unsigned int i = 0; i < _propSetInfo.nrOfProperties; i++) + { + pPropertyFields = &_propSetInfo.properties[i]; + if (pPropertyFields->defaultValue) + { + setValue(pPropertyFields->propName, pPropertyFields->defaultValue); + } + } +} + diff --git a/MAC/GCF/_PAL/PML/src/GPM_Controller.cc b/MAC/GCF/_PAL/PML/src/GPM_Controller.cc index e5049f956d1..212cfc44765 100644 --- a/MAC/GCF/_PAL/PML/src/GPM_Controller.cc +++ b/MAC/GCF/_PAL/PML/src/GPM_Controller.cc @@ -31,11 +31,10 @@ static string sPMLTaskName("PML"); GPMController* GPMController::_pInstance = 0; -extern void logResult(TPAResult result, GCFApc& apc); +extern void logResult(TPAResult result, GCFPropertySet& propSet); GPMController::GPMController() : - GCFTask((State)&GPMController::initial, sPMLTaskName), - _counter(0) + GCFTask((State)&GPMController::initial, sPMLTaskName) { // register the protocol for debugging purposes registerProtocol(PA_PROTOCOL, PA_PROTOCOL_signalnames); @@ -59,14 +58,14 @@ GPMController* GPMController::instance() return _pInstance; } -TPMResult GPMController::loadPropSet(GCFPropertySet& propSet) +TPMResult GPMController::loadPropSet(GCFExtPropertySet& propSet) { TPMResult result(PM_NO_ERROR); if (_propertyAgent.isConnected()) { PALoadPropSetEvent request; - request.seqnr = getFreeSeqnrForPSRequest(propSet); + request.seqnr = registerAction(propSet); request.scope = propSet.getScope(); _propertyAgent.send(request); @@ -78,16 +77,17 @@ TPMResult GPMController::loadPropSet(GCFPropertySet& propSet) return result; } -TPMResult GPMController::unloadPropSet(GCFPropertySet& propSet) +TPMResult GPMController::unloadPropSet(GCFExtPropertySet& propSet) { TPMResult result(PM_NO_ERROR); if (_propertyAgent.isConnected()) { PAUnloadPropSetEvent request; - request.seqnr = getFreeSeqnrForPSRequest(propSet); + request.seqnr = registerAction(propSet); request.scope = propSet.getScope(); + _extPropertySets.remove(&propSet); _propertyAgent.send(request); } else @@ -104,7 +104,7 @@ TPMResult GPMController::configurePropSet(GCFPropertySet& propSet, const string& if (_propertyAgent.isConnected()) { PAConfPropSetEvent request; - request.seqnr = getFreeSeqnrForPSRequest(propSet); + request.seqnr = registerAction(propSet); request.scope = propSet.getScope(); request.apcName = apcName; @@ -117,9 +117,9 @@ TPMResult GPMController::configurePropSet(GCFPropertySet& propSet, const string& return result; } -void GPMController::deletePropSet(GCFPropertySet& propSet) +void GPMController::deletePropSet(const GCFPropertySet& propSet) { - for (TPropertySets::iterator iter = _actionSeqList.begin(); + for (TActionSeqList::iterator iter = _actionSeqList.begin(); iter != _actionSeqList.end(); ++iter) { if (iter->second == &propSet) @@ -130,21 +130,21 @@ void GPMController::deletePropSet(GCFPropertySet& propSet) } } -TPMResult GPMController::registerScope(GCFPropertySet& propSet) +TPMResult GPMController::registerScope(GCFMyPropertySet& propSet) { TPMResult result(PM_NO_ERROR); - TPropertySets::iterator iter = _propertySets.find(propSet.getScope()); - if (iter != _propertySets.end()) + TMyPropertySets::iterator iter = _myPropertySets.find(propSet.getScope()); + if (iter != _myPropertySets.end()) { result = PM_SCOPE_ALREADY_EXISTS; } else { - _propertySets[propSet.getScope()] = pPropertySet; + _myPropertySets[propSet.getScope()] = &propSet; if (_propertyAgent.isConnected()) { PARegisterScopeEvent request; - request.seqnr = getFreeSeqnrForPSRequest(propSet); + request.seqnr = registerAction(propSet); request.scope = propSet.getScope(); request.type = propSet.getType(); request.isTemporary = propSet.isTemporary(); @@ -154,23 +154,23 @@ TPMResult GPMController::registerScope(GCFPropertySet& propSet) return result; } -TPMResult GPMController::unregisterScope(GCFPropertySet& propSet) +TPMResult GPMController::unregisterScope(GCFMyPropertySet& propSet) { TPMResult result(PM_NO_ERROR); if (_propertyAgent.isConnected()) { PAUnregisterScopeEvent request; - request.seqnr = getFreeSeqnrForPSRequest(propSet); + request.seqnr = registerAction(propSet); request.scope = propSet.getScope(); _propertyAgent.send(request); } - _propertySets.erase(propSet.getScope()); + _myPropertySets.erase(propSet.getScope()); return result; } -unsigned short GPMController::getFreeSeqnrForPSRequest(GCFPropertySet& propSet) const +unsigned short GPMController::registerAction(GCFPropertySet& propSet) { unsigned short seqnr(0); TActionSeqList::const_iterator iter; @@ -185,25 +185,25 @@ unsigned short GPMController::getFreeSeqnrForPSRequest(GCFPropertySet& propSet) return seqnr; } -void GPMController::propertiesLinked(TPAResult result) +void GPMController::propertiesLinked(const string& scope, TPAResult result) { - _counter--; - LOG_DEBUG(LOFAR::formatString ( - "Link request %d counter", _counter)); + _propertyAgent.cancelAllTimers(); if (_propertyAgent.isConnected()) { PAPropSetLinkedEvent response; response.result = result; + response.scope = scope; _propertyAgent.send(response); } } -void GPMController::propertiesUnlinked(TPAResult result) +void GPMController::propertiesUnlinked(const string& scope, TPAResult result) { if (_propertyAgent.isConnected()) { PAPropSetUnlinkedEvent response; response.result = result; + response.scope = scope; _propertyAgent.send(response); } } @@ -211,7 +211,6 @@ void GPMController::propertiesUnlinked(TPAResult result) GCFEvent::TResult GPMController::initial(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; - switch (e.signal) { case F_INIT: @@ -242,6 +241,7 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; TGCFResult result; + static unsigned long linkTimer = 0; switch (e.signal) { @@ -255,12 +255,12 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) { PARegisterScopeEvent regRequest; GCFPropertySet* pPropertySet(0); - for (TPropertySets::iterator iter = _propertySets.begin(); - iter != _propertySets.end(); ++iter) + for (TMyPropertySets::iterator iter = _myPropertySets.begin(); + iter != _myPropertySets.end(); ++iter) { pPropertySet = iter->second; assert(pPropertySet); - regRequest.seqnr = getFreeSeqnrForPSRequest(*pPropertySet); + regRequest.seqnr = registerAction(*pPropertySet); regRequest.scope = iter->first; regRequest.type = pPropertySet->getType(); regRequest.isTemporary = pPropertySet->isTemporary(); @@ -271,20 +271,15 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) case PA_SCOPE_REGISTERED: { PAScopeRegisteredEvent response(e); - if (response.result == PA_SCOPE_ALREADY_REGISTERED) - { - LOG_INFO(LOFAR::formatString ( - "A property set with scope %s already exists in the system", - response.scope.c_str())); - } result = (response.result == PA_NO_ERROR ? GCF_NO_ERROR : GCF_MYPS_ENABLE_ERROR); - GCFMyPropertySet* pPropertySet = (GCMyPropertySet*) _actionSeqList[response.seqnr]; + GCFMyPropertySet* pPropertySet = (GCFMyPropertySet*) _actionSeqList[response.seqnr]; _actionSeqList.erase(response.seqnr); if (pPropertySet) { + logResult(response.result, *pPropertySet); if (result != GCF_NO_ERROR) { - _propertySets.erase(pPropertySet->getScope()); + _myPropertySets.erase(pPropertySet->getScope()); } pPropertySet->scopeRegistered(result); } @@ -294,7 +289,7 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) case PA_SCOPE_UNREGISTERED: { PAScopeUnregisteredEvent response(e); - GCFMyPropertySet* pPropertySet = (GCMyPropertySet*) _actionSeqList[response.seqnr]; + GCFMyPropertySet* pPropertySet = (GCFMyPropertySet*) _actionSeqList[response.seqnr]; result = (response.result == PA_NO_ERROR ? GCF_NO_ERROR : GCF_MYPS_DISABLE_ERROR); _actionSeqList.erase(response.seqnr); if (pPropertySet) @@ -311,23 +306,22 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) "PA-REQ: Link properties of prop. set '%s'", request.scope.c_str())); - GCFMyPropertySet* pPropertySet = (GCMyPropertySet*) _propertySets[request.scope]; + GCFMyPropertySet* pPropertySet = _myPropertySets[request.scope]; if (pPropertySet) { - if (_counter == 0) + if (!pPropertySet->linkProperties()) { - _propertyAgent.setTimer(0, 0, 0, 0); + _propertyAgent.setTimer(0, 0, 0, 0, pPropertySet); + linkTimer = _propertyAgent.setTimer(2, 0, 0, 0, pPropertySet); } - _counter++; - pPropertySet->linkProperties(); } else { LOG_DEBUG(LOFAR::formatString ( "Property set with scope %d was deleted in the meanwhile", request.scope.c_str())); - PAPropertiesLinkedEvent response; - response.result = PA_PROP_SET_GONE; + PAPropSetLinkedEvent response; + response.result = PA_PS_GONE; _propertyAgent.send(response); } break; @@ -338,7 +332,7 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) LOG_INFO(LOFAR::formatString ( "PA-REQ: Unlink properties of prop. set '%s'", request.scope.c_str())); - GCFMyPropertySet* pPropertySet = (GCMyPropertySet*) _propertySets[request.scope]; + GCFMyPropertySet* pPropertySet = _myPropertySets[request.scope]; if (pPropertySet) { pPropertySet->unlinkProperties(); @@ -348,8 +342,8 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) LOG_DEBUG(LOFAR::formatString ( "Property set with scope %d was deleted in the meanwhile", request.scope.c_str())); - PAPropertiesUnlinkedEvent response; - response.result = PA_PROP_SET_GONE; + PAPropSetUnlinkedEvent response; + response.result = PA_PS_GONE; _propertyAgent.send(response); } break; @@ -358,10 +352,14 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) { PAPropSetLoadedEvent response(e); result = (response.result == PA_NO_ERROR ? GCF_NO_ERROR : GCF_EXTPS_LOAD_ERROR); - GCFExtPropertySet* pPropertySet = (GCExtPropertySet*) _actionSeqList[response.seqnr]; + GCFExtPropertySet* pPropertySet = (GCFExtPropertySet*) _actionSeqList[response.seqnr]; _actionSeqList.erase(response.seqnr); if (pPropertySet) { + if (result == GCF_NO_ERROR) + { + _extPropertySets.push_back(pPropertySet); + } logResult(response.result, *pPropertySet); pPropertySet->loaded(result); } @@ -371,7 +369,7 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) { PAPropSetUnloadedEvent response(e); result = (response.result == PA_NO_ERROR ? GCF_NO_ERROR : GCF_EXTPS_UNLOAD_ERROR); - GCFExtPropertySet* pPropertySet = (GCExtPropertySet*) _actionSeqList[response.seqnr]; + GCFExtPropertySet* pPropertySet = (GCFExtPropertySet*) _actionSeqList[response.seqnr]; _actionSeqList.erase(response.seqnr); if (pPropertySet) { @@ -393,17 +391,46 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) } break; } + case PA_PROP_SET_GONE: + { + PAPropSetGoneEvent indication(e); + GCFExtPropertySet* pPropertySet; + for (TExtPropertySets::iterator iter = _extPropertySets.begin(); + iter != _extPropertySets.end(); ++iter) + { + pPropertySet = *iter; + assert(pPropertySet); + if (pPropertySet->getScope() == indication.scope && pPropertySet->isLoaded()) + { + pPropertySet->serverIsGone(); + } + } + break; + } case F_TIMER: - for (TPropertySets::iterator iter = _propertySets.begin(); - iter != _propertySets.end(); ++iter) + { + GCFTimerEvent* pTimer = (GCFTimerEvent*)(&e); + GCFMyPropertySet* pPropertySet = (GCFMyPropertySet*)(pTimer->arg); + if (linkTimer == pTimer->id) { - iter->second->retryLinking(); + LOG_ERROR(LOFAR::formatString( + "link request could not be handled in time by the property set server (%s)", + pPropertySet->getScope().c_str())); + propertiesLinked(pPropertySet->getScope(), PA_LINK_TIME_OUT); } - if (_counter > 0) + else { - _propertyAgent.setTimer(0.0); + if (!pPropertySet->tryLinking()) + { + _propertyAgent.setTimer(0, 0, 0, 0, pPropertySet); + } + else + { + _propertyAgent.cancelTimer(linkTimer); + } } - break; + break; + } default: status = GCFEvent::NOT_HANDLED; break; @@ -412,7 +439,7 @@ GCFEvent::TResult GPMController::connected(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -void logResult(TPAResult result, GCFApc& apc) +void logResult(TPAResult result, GCFPropertySet& propSet) { switch (result) { @@ -422,41 +449,56 @@ void logResult(TPAResult result, GCFApc& apc) LOG_FATAL(LOFAR::formatString ( "Unknown error")); break; - case PA_PROP_SET_GONE: + case PA_PS_GONE: LOG_ERROR(LOFAR::formatString ( - "One of the property sets are gone while perfom an apc action. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + "The property set is gone while perfoming an action on it. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); break; case PA_MISSING_PROPS: LOG_ERROR(LOFAR::formatString ( "One or more loaded properties are not owned by any application. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + propSet.getType(), propSet.getScope().c_str())); break; - case PA_PROP_NOT_VALID: - LOG_ERROR(LOFAR::formatString ( - "One or more loaded properties could not be mapped on a registered scope. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + case PA_WRONG_STATE: + LOG_FATAL(LOFAR::formatString ( + "The my property set is in a wrong state. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); break; - case PA_UNABLE_TO_LOAD_APC: - LOG_ERROR(LOFAR::formatString ( - "Troubles during loading the APC file. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + case PA_PROP_SET_NOT_EXISTS: + LOG_INFO(LOFAR::formatString ( + "Prop. set does not exists. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); break; - case PA_NO_TYPE_SPECIFIED_IN_APC: - LOG_ERROR(LOFAR::formatString ( - "APC file: On one or more of the found properties no type is specified. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + case PA_PROP_SET_ALLREADY_EXISTS: + LOG_INFO(LOFAR::formatString ( + "Prop. set allready exists. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); + break; + case PA_DPTYPE_UNKNOWN: + LOG_INFO(LOFAR::formatString ( + "Specified type not known. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); break; - case PA_SAL_ERROR: + case PA_INTERNAL_ERROR: + LOG_FATAL(LOFAR::formatString ( + "Internal error in PA. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); + break; + case PA_APC_NOT_EXISTS: LOG_ERROR(LOFAR::formatString ( - "APC file: Error while reading the property value. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + "APC not exists. (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); break; - case PA_MACTYPE_UNKNOWN: + case PA_LINK_TIME_OUT: LOG_ERROR(LOFAR::formatString ( - "APC file: Unknown property type specified. (%s:%s)", - apc.getName().c_str(), apc.getScope().c_str())); + "Linking of the prop. set could not be completed in time (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); break; + case PA_SERVER_GONE: + LOG_INFO(LOFAR::formatString ( + "Server of prop. set is gone (%s:%s)", + propSet.getType(), propSet.getScope().c_str())); + break; default: break; } diff --git a/MAC/GCF/_PAL/PML/src/GPM_Controller.h b/MAC/GCF/_PAL/PML/src/GPM_Controller.h index 6a714c9aa1f..a6e244f7235 100644 --- a/MAC/GCF/_PAL/PML/src/GPM_Controller.h +++ b/MAC/GCF/_PAL/PML/src/GPM_Controller.h @@ -42,7 +42,9 @@ class GCFPValue; class GCFEvent; class GCFPortInterface; +class GCFPropertySet; class GCFMyPropertySet; +class GCFExtPropertySet; class GPMController : public GCFTask { @@ -51,14 +53,13 @@ class GPMController : public GCFTask static GPMController* instance(); public: // member functions - TPMResult loadPropSet (GCFPropertySet& propSet); - TPMResult unloadPropSet (GCFPropertySet& propSet); + TPMResult loadPropSet (GCFExtPropertySet& propSet); + TPMResult unloadPropSet (GCFExtPropertySet& propSet); TPMResult configurePropSet (GCFPropertySet& propSet, const string& apcName); void deletePropSet (const GCFPropertySet& propSet); - TPMResult registerScope (GCFMyPropertySet& propSet, bool loadDefaults); - TPMResult unregisterScope (GCFMyPropertySet& propSet, - bool permanent = false); + TPMResult registerScope (GCFMyPropertySet& propSet); + TPMResult unregisterScope (GCFMyPropertySet& propSet); void propertiesLinked (const string& scope, TPAResult result); void propertiesUnlinked (const string& scope, TPAResult result); @@ -72,16 +73,17 @@ class GPMController : public GCFTask GCFEvent::TResult connected (GCFEvent& e, GCFPortInterface& p); private: // helper methods - unsigned short getFreeSeqnrForPSRequest () const; + unsigned short registerAction (GCFPropertySet& propSet); private: // data members GCFPort _propertyAgent; - typedef map<string /* scope */, GCFPropertySet*> TPropertySets; - TPropertySets _propertySets; + typedef map<string /* scope */, GCFMyPropertySet*> TMyPropertySets; + TMyPropertySets _myPropertySets; + typedef list<GCFExtPropertySet*> TExtPropertySets; + TExtPropertySets _extPropertySets; typedef map<unsigned short /*seqnr*/, GCFPropertySet*> TActionSeqList; TActionSeqList _actionSeqList; private: // admin members - unsigned int _counter; }; #endif diff --git a/MAC/GCF/_PAL/PML/src/GPM_ProperyProxy.cc b/MAC/GCF/_PAL/PML/src/GPM_PropertyProxy.cc similarity index 100% rename from MAC/GCF/_PAL/PML/src/GPM_ProperyProxy.cc rename to MAC/GCF/_PAL/PML/src/GPM_PropertyProxy.cc diff --git a/MAC/GCF/_PAL/PML/src/Makefile.am b/MAC/GCF/_PAL/PML/src/Makefile.am index 25f5b2cf4b3..8bfda846a78 100644 --- a/MAC/GCF/_PAL/PML/src/Makefile.am +++ b/MAC/GCF/_PAL/PML/src/Makefile.am @@ -6,14 +6,14 @@ SUFFIXES = .ph pkgincludedir = $(includedir)/GCF/PAL pkginclude_HEADERS = \ - ../include/GCF/PAL/GCF_ExtProperty.h \ - ../include/GCF/PAL/GCF_Property.h \ - ../include/GCF/PAL/GCF_MyProperty.h \ - ../include/GCF/PAL/GCF_ExtPropertySet.h \ - ../include/GCF/PAL/GCF_PropertySet.h \ - ../include/GCF/PAL/GCF_MyPropertySet.h \ - ../include/GCF/PAL/GCF_Answer.h \ - ../include/GCF/PAL/GCF_PropertyProxy.h + ../../include/GCF/PAL/GCF_ExtProperty.h \ + ../../include/GCF/PAL/GCF_Property.h \ + ../../include/GCF/PAL/GCF_MyProperty.h \ + ../../include/GCF/PAL/GCF_ExtPropertySet.h \ + ../../include/GCF/PAL/GCF_PropertySet.h \ + ../../include/GCF/PAL/GCF_MyPropertySet.h \ + ../../include/GCF/PAL/GCF_Answer.h \ + ../../include/GCF/PAL/GCF_PropertyProxy.h DOCHDRS = $(pkginclude_HEADERS) \ GPM_Controller.h \ diff --git a/MAC/GCF/_PAL/SAL/src/GSA_PvssApi.cc b/MAC/GCF/_PAL/SAL/src/GSA_PvssApi.cc index fa5e95866cf..a901546014c 100644 --- a/MAC/GCF/_PAL/SAL/src/GSA_PvssApi.cc +++ b/MAC/GCF/_PAL/SAL/src/GSA_PvssApi.cc @@ -22,6 +22,7 @@ //# $Id$ // GCF/SAL includes +#include "GSA_Defines.h" #include "GSA_PvssApi.h" // GCF/TM includes @@ -65,8 +66,12 @@ void GSAPvssApi::init() // This call will succeed or the manager will exit connectToEvent(); - // We are now in STATE_RUNNING. This is a good time to connect - // to our Datapoints + if (getManagerState() == STATE_RUNNING) + { + LOG_INFO("Application connected to PVSS system"); + } + + // We are now hopefully in STATE_RUNNING. } void GSAPvssApi::workProc() diff --git a/MAC/GCF/_PAL/SAL/src/GSA_Service.cc b/MAC/GCF/_PAL/SAL/src/GSA_Service.cc index f19735ae41d..5ac0c0aa2e1 100644 --- a/MAC/GCF/_PAL/SAL/src/GSA_Service.cc +++ b/MAC/GCF/_PAL/SAL/src/GSA_Service.cc @@ -86,6 +86,9 @@ void GSAService::handleHotLink(const DpMsgAnswer& answer, const GSAWaitForAnswer { if (answer.isAnswerOn() == DP_MSG_DP_REQ) { + LOG_INFO(LOFAR::formatString ( + "DP %s was deleted successfully", + wait.getDpName().c_str())); dpDeleted(wait.getDpName()); handled = true; } @@ -104,16 +107,17 @@ void GSAService::handleHotLink(const DpMsgAnswer& answer, const GSAWaitForAnswer switch (answer.isAnswerOn()) { case DP_MSG_CONNECT: + LOG_INFO(LOFAR::formatString ( + "DPE %s was subscribed successfully", + dpName.c_str())); dpeSubscribed(dpName); break; case DP_MSG_REQ_NEW_DP: LOG_INFO(LOFAR::formatString ( - "Propery %s was created successfully", + "DP %s was created successfully", dpName.c_str())); dpCreated(dpName); break; -// case DP_MSG_CMD_NEWDEL_DP: -// dpDeleted(dpName); break; case DP_MSG_SIMPLE_REQUEST: { @@ -619,74 +623,43 @@ TSAResult GSAService::convertPVSSToMAC(const Variable& variable, GCFPValue** pMacValue) const { TSAResult result(SA_NO_ERROR); - CharString typeName; *pMacValue = 0; - if (Manager::getTypeName(dpId.getDpType(), typeName) == PVSS_FALSE) - { - LOG_FATAL(LOFAR::formatString ( - "PVSS: Could not get dpTypeName for '%d'", - dpId.getDpType())); - return SA_DPTYPE_UNKNOWN; - } - if (typeName == "LPT_BOOL") - { - if (variable.isA() == BIT_VAR) *pMacValue = new GCFPVBool(((BitVar *)&variable)->getValue()); - } - else if (typeName == "LPT_CHAR") - { - if (variable.isA() == CHAR_VAR) *pMacValue = new GCFPVChar(((CharVar *)&variable)->getValue()); - } - else if (typeName == "LPT_UNSIGNED") - { - if (variable.isA() == UINTEGER_VAR) *pMacValue = new GCFPVUnsigned(((UIntegerVar *)&variable)->getValue()); - } - else if (typeName == "LPT_INTEGER") - { - if (variable.isA() == INTEGER_VAR) *pMacValue = new GCFPVInteger(((IntegerVar *)&variable)->getValue()); - } - else if (typeName == "LPT_DOUBLE") - { - if (variable.isA() == FLOAT_VAR) *pMacValue = new GCFPVDouble(((FloatVar *)&variable)->getValue()); - } - else if (typeName == "LPT_STRING") - { - if (variable.isA() == TEXT_VAR) *pMacValue = new GCFPVString(((TextVar *)&variable)->getValue()); - } - else if (typeName.ncmp("LPT_DYN", 7) == 0) - { - const DynVar* pDynVar = static_cast<const DynVar*>(&variable); - if (pDynVar) + switch (variable.isA()) + { + case BIT_VAR: *pMacValue = new GCFPVBool(((BitVar *)&variable)->getValue()); break; + case CHAR_VAR: *pMacValue = new GCFPVChar(((CharVar *)&variable)->getValue()); break; + case UINTEGER_VAR: *pMacValue = new GCFPVUnsigned(((UIntegerVar *)&variable)->getValue()); break; + case INTEGER_VAR: *pMacValue = new GCFPVInteger(((IntegerVar *)&variable)->getValue()); break; + case FLOAT_VAR: *pMacValue = new GCFPVDouble(((FloatVar *)&variable)->getValue()); break; + case TEXT_VAR: *pMacValue = new GCFPVString(((TextVar *)&variable)->getValue()); break; + //REF!!! case TEXT_VAR: *pMacValue = new GCFPVRef(((TextVar *)&variable)->getValue()); + //case BIT32_VAR: *pMacValue = new GCFPVBit32(((Bit32Var *)&variable)->getValue()); break; + //case BLOB_VAR: *pMacValue = new GCFPVBlob(((BlobVar *)&variable)->getValue()); break; + //case TIME_VAR: *pMacValue = new GCFPVDateTime(((TimeVar *)&variable)->getValue()); break; + case DYNBIT_VAR: + case DYNCHAR_VAR: + case DYNUINTEGER_VAR: + case DYNINTEGER_VAR: + case DYNFLOAT_VAR: + case DYNTEXT_VAR: { - GCFPValueArray arrayTo; - GCFPValue* pItemValue(0); - GCFPValue::TMACValueType type(GCFPValue::NO_LPT); - // the type for the new FPValue must be determined - // separate, because the array could be empty - switch (DynVar::getItemType(pDynVar->isA())) + TMACValueType type(NO_LPT); + switch (variable.isA()) { - case BIT_VAR: - if (typeName == "LPT_DYNBOOL") type = GCFPValue::LPT_DYNBOOL; - break; - case CHAR_VAR: - if (typeName == "LPT_DYNCHAR") type = GCFPValue::LPT_DYNCHAR; - break; - case INTEGER_VAR: - if (typeName == "LPT_DYNINTEGER") type = GCFPValue::LPT_DYNINTEGER; - break; - case UINTEGER_VAR: - if (typeName == "LPT_DYNUNSIGNED") type = GCFPValue::LPT_DYNUNSIGNED; - break; - case FLOAT_VAR: - if (typeName == "LPT_DYNDOUBLE") type = GCFPValue::LPT_DYNDOUBLE; - break; - case TEXT_VAR: - if (typeName == "LPT_DYNSTRING") type = GCFPValue::LPT_DYNSTRING; - break; - default: - break; + case DYNBIT_VAR: type = LPT_DYNBOOL; break; + case DYNCHAR_VAR: type = LPT_DYNBOOL; break; + case DYNUINTEGER_VAR: type = LPT_DYNBOOL; break; + case DYNINTEGER_VAR: type = LPT_DYNBOOL; break; + case DYNFLOAT_VAR: type = LPT_DYNBOOL; break; + case DYNTEXT_VAR: type = LPT_DYNBOOL; break; + default: break; } - if (type == GCFPValue::NO_LPT) + + const DynVar* pDynVar = static_cast<const DynVar*>(&variable); + if (pDynVar) { + GCFPValueArray arrayTo; + GCFPValue* pItemValue(0); for (Variable* pVar = pDynVar->getFirst(); pVar; pVar = pDynVar->getNext()) { @@ -717,36 +690,14 @@ TSAResult GSAService::convertPVSSToMAC(const Variable& variable, } *pMacValue = new GCFPVDynArr(type, arrayTo); } + break; } - } -/* else if (typeName == "LPT_BIT32") - { - if (variable.isA() == BIT32_VAR) *pMacValue = new GCFPVBit32(((Bit32Var *)&variable)->getValue()); - } - else if (typeName == "LPT_REF") - { - if (variable.isA() == TEXT_VAR) *pMacValue = new GCFPVRef(((TextVar *)&variable)->getValue()); - } - else if (typeName == "LPT_BLOB") - { - if (variable.isA() == BLOB_VAR) *pMacValue = new GCFPVBlob(((BlobVar *)&variable)->getValue()); - } - else if (typeName == "LPT_DATETIME") - { - if (variable.isA() == TIME_VAR) *pMacValue = new GCFPVDateTime(((TimeVar *)&variable)->getValue()); - }*/ - else - { - result = SA_DPTYPE_UNKNOWN; - } - if (result == SA_NO_ERROR && *pMacValue == 0) - { - LOG_ERROR(LOFAR::formatString ( - "Type mismatch! Property type: %s != Variable type: %s", - (const char*) typeName, - Variable::getTypeName(variable.isA()))); - - result = SA_MACTYPE_MISMATCH; + default: + result = SA_DPTYPE_UNKNOWN; + LOG_ERROR(LOFAR::formatString ( + "DPE type not supported (yet)! (%d) see in Variable.hxx", + variable.isA())); + break; } return result; } @@ -756,50 +707,48 @@ TSAResult GSAService::convertMACToPVSS(const GCFPValue& macValue, const DpIdentifier& dpId) const { TSAResult result(SA_NO_ERROR); - CharString pvssTypeName; + DpElementType elTypeId; *pVar = 0; - if (Manager::getTypeName(dpId.getDpType(), pvssTypeName) == PVSS_FALSE) + if (Manager::getTypeContainerPtr()->getElementType(dpId, elTypeId) != DpTypeContOK) { - LOG_FATAL(LOFAR::formatString ( - "PVSS: Could not get dpTypeName for '%d'", - dpId.getDpType())); + LOG_FATAL("PVSS: Could not get dpeType" ); return SA_DPTYPE_UNKNOWN; } switch (macValue.getType()) { - case GCFPValue::LPT_BOOL: - if (pvssTypeName == "LPT_BOOL") *pVar = new BitVar(((GCFPVBool*)&macValue)->getValue()); + case LPT_BOOL: + if (elTypeId == DPELEMENT_BIT) *pVar = new BitVar(((GCFPVBool*)&macValue)->getValue()); break; - case GCFPValue::LPT_CHAR: - if (pvssTypeName == "LPT_CHAR") *pVar = new CharVar(((GCFPVChar*)&macValue)->getValue()); + case LPT_CHAR: + if (elTypeId == DPELEMENT_CHAR) *pVar = new CharVar(((GCFPVChar*)&macValue)->getValue()); break; - case GCFPValue::LPT_UNSIGNED: - if (pvssTypeName == "LPT_UNSIGNED") *pVar = new UIntegerVar(((GCFPVUnsigned*)&macValue)->getValue()); + case LPT_UNSIGNED: + if (elTypeId == DPELEMENT_UINT) *pVar = new UIntegerVar(((GCFPVUnsigned*)&macValue)->getValue()); break; - case GCFPValue::LPT_INTEGER: - if (pvssTypeName == "LPT_INTEGER") *pVar = new IntegerVar(((GCFPVInteger*)&macValue)->getValue()); + case LPT_INTEGER: + if (elTypeId == DPELEMENT_INT) *pVar = new IntegerVar(((GCFPVInteger*)&macValue)->getValue()); break; - case GCFPValue::LPT_DOUBLE: - if (pvssTypeName == "LPT_DOUBLE") *pVar = new FloatVar(((GCFPVDouble*)&macValue)->getValue()); + case LPT_DOUBLE: + if (elTypeId == DPELEMENT_FLOAT) *pVar = new FloatVar(((GCFPVDouble*)&macValue)->getValue()); break; - case GCFPValue::LPT_STRING: - if (pvssTypeName == "LPT_STRING") *pVar = new TextVar(((GCFPVString*)&macValue)->getValue().c_str()); + case LPT_STRING: + if (elTypeId == DPELEMENT_TEXT) *pVar = new TextVar(((GCFPVString*)&macValue)->getValue().c_str()); break; -/* case GCFPValue::LPT_REF: - if (pvssTypeName == "LPT_REF") *pVar = new TextVar(((GCFPVRef*)&macValue)->getValue()); +/* case LPT_REF: + if (elTypeId == DPELEMENT_TEXT) *pVar = new TextVar(((GCFPVRef*)&macValue)->getValue()); break; - case GCFPValue::LPT_BLOB: - if (pvssTypeName == "LPT_BLOB") *pVar = new BlobVar(((GCFPVBlob*)&macValue)->getValue()); + case LPT_BLOB: + if (elTypeId == DPELEMENT_BLOB) *pVar = new BlobVar(((GCFPVBlob*)&macValue)->getValue()); break; - case GCFPValue::LPT_DATETIME: - if (pvssTypeName == "LPT_DATETIME") *pVar = new TimeVar(((GCFPVDateTime*)&macValue)->getValue()); + case LPT_DATETIME: + if (elTypeId == DPELEMENT_TIME) *pVar = new TimeVar(((GCFPVDateTime*)&macValue)->getValue()); break; - case GCFPValue::LPT_BIT32: - if (pvssTypeName == "LPT_BIT32") *pVar = new Bit32Var(((GCFPVBit32 *)&macValue)->getValue()); + case LPT_BIT32: + if (elTypeId == DPELEMENT_BIT32) *pVar = new Bit32Var(((GCFPVBit32 *)&macValue)->getValue()); break;*/ default: - if (macValue.getType() > GCFPValue::LPT_DYNARR && - macValue.getType() <= GCFPValue::LPT_DYNSTRING) + if (macValue.getType() > LPT_DYNARR && + macValue.getType() <= LPT_DYNSTRING) { Variable* pItemValue; VariableType type(NOTYPE_VAR); @@ -807,23 +756,23 @@ TSAResult GSAService::convertMACToPVSS(const GCFPValue& macValue, // separat, because the array could be empty switch (macValue.getType()) { - case GCFPValue::LPT_DYNBOOL: - if (pvssTypeName == "LPT_DYNBOOL") type = BIT_VAR; + case LPT_DYNBOOL: + if (elTypeId == DPELEMENT_DYNBIT) type = BIT_VAR; break; - case GCFPValue::LPT_DYNCHAR: - if (pvssTypeName == "LPT_DYNCHAR") type = CHAR_VAR; + case LPT_DYNCHAR: + if (elTypeId == DPELEMENT_DYNCHAR) type = CHAR_VAR; break; - case GCFPValue::LPT_DYNINTEGER: - if (pvssTypeName == "LPT_DYNINTEGER") type = INTEGER_VAR; + case LPT_DYNINTEGER: + if (elTypeId == DPELEMENT_DYNINT) type = INTEGER_VAR; break; - case GCFPValue::LPT_DYNUNSIGNED: - if (pvssTypeName == "LPT_DYNUNSIGNED") type = UINTEGER_VAR; + case LPT_DYNUNSIGNED: + if (elTypeId == DPELEMENT_DYNUINT) type = UINTEGER_VAR; break; - case GCFPValue::LPT_DYNDOUBLE: - if (pvssTypeName == "LPT_DYNDOUBLE") type = FLOAT_VAR; + case LPT_DYNDOUBLE: + if (elTypeId == DPELEMENT_DYNFLOAT) type = FLOAT_VAR; break; - case GCFPValue::LPT_DYNSTRING: - if (pvssTypeName == "LPT_DYNSTRING") type = TEXT_VAR; + case LPT_DYNSTRING: + if (elTypeId == DPELEMENT_DYNTEXT) type = TEXT_VAR; break; default: break; @@ -842,22 +791,22 @@ TSAResult GSAService::convertMACToPVSS(const GCFPValue& macValue, pValue = (*iter); switch (pValue->getType()) { - case GCFPValue::LPT_BOOL: + case LPT_BOOL: pItemValue = new BitVar(((GCFPVBool*)pValue)->getValue()); break; - case GCFPValue::LPT_CHAR: + case LPT_CHAR: pItemValue = new CharVar(((GCFPVChar*)pValue)->getValue()); break; - case GCFPValue::LPT_INTEGER: + case LPT_INTEGER: pItemValue = new IntegerVar(((GCFPVInteger*)pValue)->getValue()); break; - case GCFPValue::LPT_UNSIGNED: + case LPT_UNSIGNED: pItemValue = new UIntegerVar(((GCFPVUnsigned*)pValue)->getValue()); break; - case GCFPValue::LPT_DOUBLE: + case LPT_DOUBLE: pItemValue = new FloatVar(((GCFPVDouble*)pValue)->getValue()); break; - case GCFPValue::LPT_STRING: + case LPT_STRING: pItemValue = new TextVar(((GCFPVString*)pValue)->getValue().c_str()); break; default: @@ -876,9 +825,9 @@ TSAResult GSAService::convertMACToPVSS(const GCFPValue& macValue, CharString valueTypeName; getPVSSType(macValue.getType(), valueTypeName); LOG_ERROR(LOFAR::formatString ( - "Type mismatch! Property type: %s != Value type: %s", - (const char*) pvssTypeName, - (const char*) valueTypeName)); + "Type mismatch! Property type: %s != Value type: %d (see in DpElemnent.hxx)", + (const char*) valueTypeName, + elTypeId)); result = SA_MACTYPE_MISMATCH; } @@ -886,45 +835,45 @@ TSAResult GSAService::convertMACToPVSS(const GCFPValue& macValue, return result; } -bool GSAService::getPVSSType(GCFPValue::TMACValueType macType, +bool GSAService::getPVSSType(TMACValueType macType, CharString& pvssTypeName) const { switch (macType) { - case GCFPValue::LPT_BOOL: + case LPT_BOOL: pvssTypeName = "LPT_BOOL"; break; - case GCFPValue::LPT_CHAR: + case LPT_CHAR: pvssTypeName = "LPT_CHAR"; break; - case GCFPValue::LPT_UNSIGNED: + case LPT_UNSIGNED: pvssTypeName = "LPT_UNSIGNED"; break; - case GCFPValue::LPT_INTEGER: + case LPT_INTEGER: pvssTypeName = "LPT_INTEGER"; break; - case GCFPValue::LPT_DOUBLE: + case LPT_DOUBLE: pvssTypeName = "LPT_DOUBLE"; break; - case GCFPValue::LPT_STRING: + case LPT_STRING: pvssTypeName = "LPT_STRING"; break; - case GCFPValue::LPT_DYNBOOL: + case LPT_DYNBOOL: pvssTypeName = "LPT_DYNBOOL"; break; - case GCFPValue::LPT_DYNCHAR: + case LPT_DYNCHAR: pvssTypeName = "LPT_DYNCHAR"; break; - case GCFPValue::LPT_DYNUNSIGNED: + case LPT_DYNUNSIGNED: pvssTypeName = "LPT_DYNUNSIGNED"; break; - case GCFPValue::LPT_DYNINTEGER: + case LPT_DYNINTEGER: pvssTypeName = "LPT_DYNINTEGER"; break; - case GCFPValue::LPT_DYNDOUBLE: + case LPT_DYNDOUBLE: pvssTypeName = "LPT_DYNDOUBLE"; break; - case GCFPValue::LPT_DYNSTRING: + case LPT_DYNSTRING: pvssTypeName = "LPT_DYNSTRING"; break; default: diff --git a/MAC/GCF/_PAL/SAL/src/GSA_Service.h b/MAC/GCF/_PAL/SAL/src/GSA_Service.h index c694d9e67d4..7b2f8d429e6 100644 --- a/MAC/GCF/_PAL/SAL/src/GSA_Service.h +++ b/MAC/GCF/_PAL/SAL/src/GSA_Service.h @@ -88,7 +88,7 @@ class GSAService TSAResult convertMACToPVSS (const GCFPValue& macValue, Variable** pVar, const DpIdentifier& dpId) const; - bool getPVSSType (GCFPValue::TMACValueType macType, + bool getPVSSType (TMACValueType macType, CharString& pvssTypeName) const; // helper methods diff --git a/MAC/GCF/_PAL/SAL/test/Echo.cc b/MAC/GCF/_PAL/SAL/test/Echo.cc index e2b5b7d0f6a..dce8cfdd75d 100644 --- a/MAC/GCF/_PAL/SAL/test/Echo.cc +++ b/MAC/GCF/_PAL/SAL/test/Echo.cc @@ -80,8 +80,8 @@ GCFEvent::TResult Echo::connected(GCFEvent& e, GCFPortInterface& /*p*/) switch (e.signal) { case F_DISCONNECTED: - service.deleteProp(propName); - service.deleteProp(propName + "_test"); + service.dpDelete(propName); + service.dpDelete(propName + "_test"); cout << "Lost connection to client" << endl; TRAN(Echo::initial); break; @@ -93,66 +93,66 @@ GCFEvent::TResult Echo::connected(GCFEvent& e, GCFPortInterface& /*p*/) switch (ping.seqnr % 13) { case 0: - service.createProp(propName, GCFPValue::LPT_BOOL); + service.dpCreate(propName, "LPT_BOOL"); break; case 1: - service.createProp(propName + "_test", GCFPValue::LPT_CHAR); + service.dpCreate(propName + "_test", "LPT_CHAR"); break; case 2: - service.subscribe(propName); + service.dpeSubscribe(propName); break; case 3: - service.subscribe(propName + "_test"); + service.dpeSubscribe(propName + "_test"); break; case 4: - service.get(propName); + service.dpeGet(propName); break; case 5: { GCFPVBool wrongTestVal(true); - service.set(propName + "_test", wrongTestVal); + service.dpeSet(propName + "_test", wrongTestVal); GCFPVChar goodTestVal('A'); - service.set(propName + "_test", goodTestVal); + service.dpeSet(propName + "_test", goodTestVal); break; } case 6: - service.unsubscribe(propName + "_test1"); - service.unsubscribe(propName + "_test"); - service.unsubscribe(propName); + service.dpeUnsubscribe(propName + "_test1"); + service.dpeUnsubscribe(propName + "_test"); + service.dpeUnsubscribe(propName); break; case 7: { GCFPVChar testVal('B'); - service.set(propName + "_test", testVal); + service.dpeSet(propName + "_test", testVal); break; } case 8: { - service.subscribe(propName); - service.unsubscribe(propName); + service.dpeSubscribe(propName); + service.dpeUnsubscribe(propName); GCFPVBool testVal(true); - service.set(propName, testVal); + service.dpeSet(propName, testVal); break; } case 9: - service.subscribe(propName); + service.dpeSubscribe(propName); break; case 10: - service.get(propName); - service.unsubscribe(propName); + service.dpeGet(propName); + service.dpeUnsubscribe(propName); break; case 11: { - service.subscribe(propName); - service.unsubscribe(propName); - service.subscribe(propName); + service.dpeSubscribe(propName); + service.dpeUnsubscribe(propName); + service.dpeSubscribe(propName); GCFPVBool testVal(false); - service.set(propName, testVal); + service.dpeSet(propName, testVal); break; } case 12: - service.deleteProp(propName); - service.deleteProp(propName + "_test"); + service.dpDelete(propName); + service.dpDelete(propName + "_test"); break; } diff --git a/MAC/GCF/_PAL/SAL/test/Echo.h b/MAC/GCF/_PAL/SAL/test/Echo.h index fd28c77ffc8..be615e6b5cf 100644 --- a/MAC/GCF/_PAL/SAL/test/Echo.h +++ b/MAC/GCF/_PAL/SAL/test/Echo.h @@ -25,7 +25,7 @@ #ifndef _ECHO_H_ #define _ECHO_H_ -#include <GCF/GCF_Control.h> +#include <GCF/TM/GCF_Control.h> #include "Service.h" #include <Common/lofar_string.h> diff --git a/MAC/GCF/_PAL/SAL/test/Makefile.am b/MAC/GCF/_PAL/SAL/test/Makefile.am index 0c53b9ca53f..06fc644c11f 100644 --- a/MAC/GCF/_PAL/SAL/test/Makefile.am +++ b/MAC/GCF/_PAL/SAL/test/Makefile.am @@ -1,4 +1,4 @@ -cppflags = -I$(top_srcdir)/CoreComps/SAL/src +cppflags = -I$(top_srcdir)/SAL/src check_PROGRAMS = echoapp ping diff --git a/MAC/GCF/_PAL/SAL/test/Ping.h b/MAC/GCF/_PAL/SAL/test/Ping.h index 665647fb610..eabfcaee935 100644 --- a/MAC/GCF/_PAL/SAL/test/Ping.h +++ b/MAC/GCF/_PAL/SAL/test/Ping.h @@ -24,7 +24,7 @@ #ifndef _PING_H_ #define _PING_H_ -#include <GCF/GCF_Control.h> +#include <GCF/TM/GCF_Control.h> #include <sys/time.h> /** diff --git a/MAC/GCF/_PAL/SAL/test/Service.cc b/MAC/GCF/_PAL/SAL/test/Service.cc index 71854e30e4f..389542abdd0 100644 --- a/MAC/GCF/_PAL/SAL/test/Service.cc +++ b/MAC/GCF/_PAL/SAL/test/Service.cc @@ -1,73 +1,73 @@ #include "Service.h" -TSAResult Service::createProp(const string& propName, - GCFPValue::TMACValueType macType) +TSAResult Service::dpCreate(const string& propName, + const string& macType) { - return GSAService::createProp(propName, macType); + return GSAService::dpCreate(propName, macType); } -TSAResult Service::deleteProp(const string& propName) +TSAResult Service::dpDelete(const string& propName) { - return GSAService::deleteProp(propName); + return GSAService::dpDelete(propName); } -TSAResult Service::subscribe(const string& propName) +TSAResult Service::dpeSubscribe(const string& propName) { - return GSAService::subscribe(propName); + return GSAService::dpeSubscribe(propName); } -TSAResult Service::unsubscribe(const string& propName) +TSAResult Service::dpeUnsubscribe(const string& propName) { - return GSAService::unsubscribe(propName); + return GSAService::dpeUnsubscribe(propName); } -TSAResult Service::get(const string& propName) +TSAResult Service::dpeGet(const string& propName) { - return GSAService::get(propName); + return GSAService::dpeGet(propName); } -TSAResult Service::set(const string& propName, const GCFPValue& value) +TSAResult Service::dpeSet(const string& propName, const GCFPValue& value) { - return GSAService::set(propName, value); + return GSAService::dpeSet(propName, value); } -bool Service::exists(const string& propName) +bool Service::dpeExists(const string& propName) { - return GSAService::exists(propName); + return GSAService::dpeExists(propName); } -void Service::propCreated(const string& propName) +void Service::dpCreated(const string& propName) { LOG_DEBUG(LOFAR::formatString ( "Property '%s' created", propName.c_str())); } -void Service::propDeleted(const string& propName) +void Service::dpDeleted(const string& propName) { LOG_DEBUG(LOFAR::formatString ( "Property '%s' deleted", propName.c_str())); } -void Service::propSubscribed(const string& propName) +void Service::dpeSubscribed(const string& propName) { LOG_DEBUG(LOFAR::formatString ( "Property '%s' subscribed", propName.c_str())); } -void Service::propUnsubscribed(const string& propName) +void Service::dpeUnsubscribed(const string& propName) { LOG_DEBUG(LOFAR::formatString ( "Property '%s' unsubscribed", propName.c_str())); } -void Service::propValueGet(const string& propName, const GCFPValue& /*value*/) +void Service::dpeValueGet(const string& propName, const GCFPValue& /*value*/) { LOG_DEBUG(LOFAR::formatString ( "Value of property '%s' get", propName.c_str())); } -void Service::propValueChanged(const string& propName, const GCFPValue& /*value*/) +void Service::dpeValueChanged(const string& propName, const GCFPValue& /*value*/) { LOG_DEBUG(LOFAR::formatString ( "Value of property '%s' changed", propName.c_str())); diff --git a/MAC/GCF/_PAL/SAL/test/Service.h b/MAC/GCF/_PAL/SAL/test/Service.h index 08a3f20123c..7a59d3a41a3 100644 --- a/MAC/GCF/_PAL/SAL/test/Service.h +++ b/MAC/GCF/_PAL/SAL/test/Service.h @@ -6,22 +6,22 @@ class Service : public GSAService Service() {}; virtual ~Service() {}; - virtual TSAResult createProp(const string& propName, - GCFPValue::TMACValueType macType); - virtual TSAResult deleteProp(const string& propName); - virtual TSAResult subscribe(const string& propName); - virtual TSAResult unsubscribe(const string& propName); - virtual TSAResult get(const string& propName); - virtual TSAResult set(const string& propName, const GCFPValue& value); - virtual bool exists(const string& propName); + virtual TSAResult dpCreate(const string& propName, + const string& macType); + virtual TSAResult dpDelete(const string& propName); + virtual TSAResult dpeSubscribe(const string& propName); + virtual TSAResult dpeUnsubscribe(const string& propName); + virtual TSAResult dpeGet(const string& propName); + virtual TSAResult dpeSet(const string& propName, const GCFPValue& value); + virtual bool dpeExists(const string& propName); protected: - virtual void propCreated(const string& propName); - virtual void propDeleted(const string& propName); - virtual void propSubscribed(const string& propName); - virtual void propUnsubscribed(const string& propName); - virtual void propValueGet(const string& propName, const GCFPValue& value); - virtual void propValueChanged(const string& propName, const GCFPValue& value); + virtual void dpCreated(const string& propName); + virtual void dpDeleted(const string& propName); + virtual void dpeSubscribed(const string& propName); + virtual void dpeUnsubscribed(const string& propName); + virtual void dpeValueGet(const string& propName, const GCFPValue& value); + virtual void dpeValueChanged(const string& propName, const GCFPValue& value); private: }; diff --git a/MAC/GCF/_PAL/include/GCF/PAL/GCF_Answer.h b/MAC/GCF/_PAL/include/GCF/PAL/GCF_Answer.h index bee8e1dda89..f867c0b9992 100644 --- a/MAC/GCF/_PAL/include/GCF/PAL/GCF_Answer.h +++ b/MAC/GCF/_PAL/include/GCF/PAL/GCF_Answer.h @@ -115,6 +115,36 @@ class GCFAnswer //@} }; +enum { + F_PML_PROTOCOL = F_GCF_PROTOCOL + 2, +}; +/** + * F_PML_PROTOCOL signals + */ +enum { + F_SUBSCRIBED_ID = 1, + F_UNSUBSCRIBED_ID, + F_VCHANGEMSG_ID, + F_VGETRESP_ID, + F_EXTPS_LOADED_ID, + F_EXTPS_UNLOADED_ID, + F_PS_CONFIGURED_ID, + F_MYPS_ENABLED_ID, + F_MYPS_DISABLED_ID, + F_SERVER_GONE_ID, +}; + +#define F_SUBSCRIBED F_SIGNAL(F_PML_PROTOCOL, F_SUBSCRIBED_ID, F_IN) +#define F_UNSUBSCRIBED F_SIGNAL(F_PML_PROTOCOL, F_UNSUBSCRIBED_ID, F_IN) +#define F_VCHANGEMSG F_SIGNAL(F_PML_PROTOCOL, F_VCHANGEMSG_ID, F_IN) +#define F_VGETRESP F_SIGNAL(F_PML_PROTOCOL, F_VGETRESP_ID, F_IN) +#define F_EXTPS_LOADED F_SIGNAL(F_PML_PROTOCOL, F_EXTPS_LOADED_ID, F_IN) +#define F_EXTPS_UNLOADED F_SIGNAL(F_PML_PROTOCOL, F_EXTPS_UNLOADED_ID,F_IN) +#define F_PS_CONFIGURED F_SIGNAL(F_PML_PROTOCOL, F_PS_CONFIGURED_ID, F_IN) +#define F_MYPS_ENABLED F_SIGNAL(F_PML_PROTOCOL, F_MYPS_ENABLED_ID, F_IN) +#define F_MYPS_DISABLED F_SIGNAL(F_PML_PROTOCOL, F_MYPS_DISABLED_ID, F_IN) +#define F_SERVER_GONE F_SIGNAL(F_PML_PROTOCOL, F_SERVER_GONE_ID, F_IN) + /// NOTE: These structs cannot be used to send messages by real port /// implementations like TCP. struct GCFPropValueEvent : public GCFEvent @@ -157,40 +187,13 @@ struct GCFPropSetAnswerEvent : public GCFEvent struct GCFConfAnswerEvent : public GCFPropSetAnswerEvent { /// @param sig can only be F_PS_CONFIGURED - GCFConfAnswerEvent(unsigned short sig) : GCFPropSetAnswerEvent(sig) + GCFConfAnswerEvent() : GCFPropSetAnswerEvent(F_PS_CONFIGURED) { length = sizeof(GCFConfAnswerEvent); } const char* pApcName; ///< Pointer to the name string of the APC (excl. path and extension) }; -enum { - F_PML_PROTOCOL = F_GCF_PROTOCOL + 2, -}; -/** - * F_PML_PROTOCOL signals - */ -enum { - F_SUBSCRIBED_ID = 1, - F_UNSUBSCRIBED_ID, - F_VCHANGEMSG_ID, - F_VGETRESP_ID, - F_EXTPS_LOADED_ID, - F_EXTPS_UNLOADED_ID, - F_PS_CONFIGURED_ID, - F_MYPS_ENABLED_ID, - F_MYPS_DISABLED_ID, -}; - -#define F_SUBSCRIBED F_SIGNAL(F_PML_PROTOCOL, F_SUBSCRIBED_ID, F_IN) -#define F_UNSUBSCRIBED F_SIGNAL(F_PML_PROTOCOL, F_UNSUBSCRIBED_ID, F_IN) -#define F_VCHANGEMSG F_SIGNAL(F_PML_PROTOCOL, F_VCHANGEMSG_ID, F_IN) -#define F_VGETRESP F_SIGNAL(F_PML_PROTOCOL, F_VGETRESP_ID, F_IN) -#define F_EXTPS_LOADED F_SIGNAL(F_PML_PROTOCOL, F_EXTPS_LOADED_ID, F_IN) -#define F_EXTPS_UNLOADED F_SIGNAL(F_PML_PROTOCOL, F_EXTPS_UNLOADED_ID,F_IN) -#define F_PS_CONFIGURED F_SIGNAL(F_PML_PROTOCOL, F_PS_CONFIGURED_ID, F_IN) -#define F_MYPS_ENABLED F_SIGNAL(F_PML_PROTOCOL, F_MYPS_ENABLED_ID, F_IN) -#define F_MYPS_DISABLED F_SIGNAL(F_PML_PROTOCOL, F_MYPS_DISABLED_ID, F_IN) extern const char* F_PML_PROTOCOL_signalnames[]; diff --git a/MAC/GCF/_PAL/include/GCF/PAL/GCF_ExtPropertySet.h b/MAC/GCF/_PAL/include/GCF/PAL/GCF_ExtPropertySet.h index f47b50688d2..435646112f4 100644 --- a/MAC/GCF/_PAL/include/GCF/PAL/GCF_ExtPropertySet.h +++ b/MAC/GCF/_PAL/include/GCF/PAL/GCF_ExtPropertySet.h @@ -26,6 +26,8 @@ #include <GCF/GCF_Defines.h> #include <GCF/PAL/GCF_PropertySet.h> +class GPMController; + /** * This class represents a property set of properties specified in an APC. It * gives the Application the possibility to access properties of for instance a @@ -48,7 +50,7 @@ class GCFExtPropertySet : public GCFPropertySet GCFExtPropertySet (const char* name, const TPropertySet& propSet, GCFAnswer* pAnswerObj = 0); - virtual ~GCFExtPropertySet () {} + virtual ~GCFExtPropertySet (); /** * Asynchronous method @@ -95,7 +97,16 @@ class GCFExtPropertySet : public GCFPropertySet * GCF_PML_ERROR (see for more info in the logging of the SAL of GCF) */ TGCFResult unsubscribeProp (const string propName) const; - + + bool isLoaded() const { return _isLoaded;} + + private: + friend class GPMController; + void loaded(TGCFResult result); + + void unloaded(TGCFResult result); + void GCFExtPropertySet::serverIsGone(); + private: GCFExtPropertySet(); //@{ @@ -105,7 +116,7 @@ class GCFExtPropertySet : public GCFPropertySet //@} private: // helper methods - GCFProperty* createPropObject(TProperty& propInfo); + GCFProperty* createPropObject(const TProperty& propInfo); private: // data members bool _isLoaded; diff --git a/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyProperty.h b/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyProperty.h index dd0b5a853de..5d31d438a4d 100644 --- a/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyProperty.h +++ b/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyProperty.h @@ -90,7 +90,9 @@ class GCFMyProperty : public GCFProperty GCFMyPropertySet& propertySet); virtual ~GCFMyProperty (); - bool link (); + /// @param setDefault true => use my defaults (set value), false => use DB defaults (get value) + /// @return true if is an asynchronous action, false if not + bool link (bool setDefault, TGCFResult& result); void unlink (); private: // overrides base class methods diff --git a/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyPropertySet.h b/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyPropertySet.h index 25347bab7b5..b97e1e2636c 100644 --- a/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyPropertySet.h +++ b/MAC/GCF/_PAL/include/GCF/PAL/GCF_MyPropertySet.h @@ -44,6 +44,8 @@ class GCFAnswer; class GCFMyPropertySet : public GCFPropertySet { public: + typedef enum {USE_DB_DEFAULTS, USE_MY_DEFAULTS} TDefaultUse; + /** * Constructor * Creates an property set with owned properties @@ -51,11 +53,17 @@ class GCFMyPropertySet : public GCFPropertySet * @param scope explicite specified scope * @param answerObj the call back object for answers on property set actions */ - GCFMyPropertySet (const char* name, + explicit GCFMyPropertySet (const char* name, const TPropertySet& propSet, - GCFAnswer* pAnswerObj = 0); - virtual ~GCFMyPropertySet (); + GCFAnswer* pAnswerObj, + TDefaultUse defaultUse = USE_MY_DEFAULTS); + + explicit GCFMyPropertySet (const char* name, + const TPropertySet& propSet, + TDefaultUse defaultUse = USE_MY_DEFAULTS); + virtual ~GCFMyPropertySet (); + /** * Asynchronous method * In fact it registers the scope on the Property Agent. @@ -86,10 +94,7 @@ class GCFMyPropertySet : public GCFPropertySet inline bool isEnabled () { return (_state == S_ENABLED || _state == S_LINKING || _state == S_LINKED); } - - TGCFResult setValue (const string propName, ///< can be specified with or without the scope - const string value); - + //@{ /** * @param propName can be specified with or without the scope @@ -108,13 +113,13 @@ class GCFMyPropertySet : public GCFPropertySet friend class GPMController; void scopeRegistered (TGCFResult result); void scopeUnregistered (TGCFResult result); - void linkProperties (); + bool linkProperties (); void unlinkProperties (); + bool tryLinking (); private: // helper methods - void retryLinking (); - void init(); - GCFProperty* createPropObject(TProperty& propInfo); + GCFProperty* createPropObject(const TProperty& propInfo); + void wrongState(const char* request); private: GCFMyPropertySet (); @@ -125,12 +130,12 @@ class GCFMyPropertySet : public GCFPropertySet //@} private: // attribute members - bool _isEnabled; typedef enum TSTATE {S_DISABLED, S_DISABLING, S_ENABLING, S_ENABLED, S_LINKING, S_LINKED}; TSTATE _state; + TDefaultUse _defaultUse; + private: // administrative members unsigned short _counter; - unsigned short _missing; - const TPropertySet& _propSet; + unsigned short _missing; }; #endif diff --git a/MAC/GCF/_PAL/include/GCF/PAL/GCF_Property.h b/MAC/GCF/_PAL/include/GCF/PAL/GCF_Property.h index 3a74d678b2c..d1ec1b6a8fa 100644 --- a/MAC/GCF/_PAL/include/GCF/PAL/GCF_Property.h +++ b/MAC/GCF/_PAL/include/GCF/PAL/GCF_Property.h @@ -67,6 +67,13 @@ class GCFProperty */ virtual TGCFResult setValue(const GCFPValue& value); + /** + * Synchronous (!) action + * Performs a set operation on the SCADA DB + * @return can be GCF_NO_ERROR or GCF_PML_ERROR + */ + virtual TGCFResult setValue(const string& value); + /** * Synchronous (!) action * Checks whether the property exists in the SCADA DB or not @@ -130,7 +137,6 @@ class GCFProperty private: // data members GCFPropertySet* _pPropertySet; GCFAnswer* _pAnswerObj; - string _name; GPMPropertyService* _pPropService; private: // admin. data members diff --git a/MAC/GCF/_PAL/include/GCF/PAL/GCF_PropertySet.h b/MAC/GCF/_PAL/include/GCF/PAL/GCF_PropertySet.h index f9478754de3..5436c24f1b0 100644 --- a/MAC/GCF/_PAL/include/GCF/PAL/GCF_PropertySet.h +++ b/MAC/GCF/_PAL/include/GCF/PAL/GCF_PropertySet.h @@ -29,6 +29,7 @@ #include <Common/lofar_map.h> class GCFAnswer; class GCFPValue; +class GPMController; /** * This class is the base class for the 2 types of property set containers. It @@ -69,9 +70,12 @@ class GCFPropertySet * @param propName with or without the scope * @returns 0 if not in this property set */ - virtual TGCFResult setValue (const string propName, + TGCFResult setValue (const string propName, const GCFPValue& value); + TGCFResult setValue (const string propName, ///< can be specified with or without the scope + const string value); + virtual void setAnswer (GCFAnswer* pAnswerObj); virtual bool exists (const string propName) const; @@ -83,9 +87,10 @@ class GCFPropertySet GCFAnswer* pAnswerObj); protected: // helper methods - virtual GCFProperty* createPropObject(TProperty& propInfo) = 0; - void loadPropSetIntoRam(); + virtual GCFProperty* createPropObject(const TProperty& propInfo) = 0; void dispatchAnswer (unsigned short sig, TGCFResult result); + void setDefaults(); + void loadPropSetIntoRam(); protected: // helper attributes typedef map<string /*propName*/, GCFProperty*> TPropertyList; diff --git a/MAC/MACCommon/autogen/protocol.tpl b/MAC/MACCommon/autogen/protocol.tpl index 887e9f6dbd9..07666ca183b 100644 --- a/MAC/MACCommon/autogen/protocol.tpl +++ b/MAC/MACCommon/autogen/protocol.tpl @@ -41,7 +41,7 @@ const char* [+ protocol_name +]_signalnames[] = #ifdef SWIG %module [+ (base-name) +] -%include GCF/GCF_Event.h +%include GCF/TM/GCF_Event.h %include carrays.i %include std_string.i %include typemaps.i @@ -54,12 +54,12 @@ const char* [+ protocol_name +]_signalnames[] = %{ #include "[+ (base-name) +].ph"[+ FOR include "" +] #include [+ (get "include") +][+ ENDFOR +] -#include <GCF/GCF_TMProtocols.h> +#include <GCF/TM/GCF_Protocols.h> %} #else [+ FOR include "" +] #include [+ (get "include") +][+ ENDFOR +] -#include <GCF/GCF_TMProtocols.h> +#include <GCF/TM/GCF_Protocols.h> #include <string> #endif @@ -135,11 +135,11 @@ void* [+ event_class_name +]::pack(unsigned int& packsize) { [+ FOR param "" +][+ IF (or (*== (get "type") "[]") (*== (get "type") "*")) +]assert([+ (get "name") +]);[+ ENDIF +] [+ ENDFOR +] - unsigned int requiredSize = [+ IF (not (exist? "noheader")) +]sizeof(signal) + sizeof(length) + [+ ENDIF +][+ FOR param " +" +] - [+ IF (exist? "userdefined") +][+ (get "name") +][+ IF (*== (get "type") "*") +]->[+ ELSE +].[+ ENDIF +]getSize() - [+ ELIF (not (*== (get "type") "]")) +][+ IF (== (get "type") "string") +][+ (get "name") +].length() + sizeof(unsigned int)[+ ELSE +]sizeof([+ (get "name") +])[+ ENDIF+] - [+ ELIF (*== (get "type") "[]") +]sizeof([+ (get "name") +]Dim) + ([+ (get "name") +]Dim * sizeof([+ (get "name") +][0])) - [+ ELSE +]sizeof([+ (get "name") +])[+ ENDIF +][+ ENDFOR +]; + unsigned int requiredSize = [+ IF (not (exist? "noheader")) +]sizeof(signal) + sizeof(length)[+ ENDIF +][+ FOR param "" +] + [+ IF (exist? "userdefined") +]+ [+ (get "name") +][+ IF (*== (get "type") "*") +]->[+ ELSE +].[+ ENDIF +]getSize() + [+ ELIF (not (*== (get "type") "]")) +]+ [+ IF (== (get "type") "string") +][+ (get "name") +].length() + sizeof(unsigned int)[+ ELSE +]sizeof([+ (get "name") +])[+ ENDIF+] + [+ ELIF (*== (get "type") "[]") +]+ sizeof([+ (get "name") +]Dim) + ([+ (get "name") +]Dim * sizeof([+ (get "name") +][0])) + [+ ELSE +]+ sizeof([+ (get "name") +])[+ ENDIF +][+ ENDFOR +]; resizeBuf(requiredSize); unsigned int offset = 0; diff --git a/MAC/Test/GCF/configure.in b/MAC/Test/GCF/configure.in index 69457ab4655..8ff73b412d8 100644 --- a/MAC/Test/GCF/configure.in +++ b/MAC/Test/GCF/configure.in @@ -56,9 +56,12 @@ lofar_QATOOLS lofar_DOCXX lofar_MPI(0) lofar_PVSS(1) -lofar_EXTERNAL(lofarlogger,1,LofarLogger/LofarLogger.h,,) lofar_EXTERNAL(common,1,Common/LofarTypes.h,,) -lofar_EXTERNAL(gcf,1,GCF/GCF_Task.h,,) +lofar_EXTERNAL(GCFTM,1,GCF/TM/GCF_Control.h,,) +lofar_EXTERNAL(GCFCommon,1,GCF/GCF_Defines.h,,) +lofar_EXTERNAL(GCFPAL,1,GCF/PAL/GCF_Property.h,,) +lofar_PACKAGE(MAC/Test/Suite) + dnl dnl Output Makefiles diff --git a/MAC/Test/GCF/src/Answer.h b/MAC/Test/GCF/src/Answer.h index 383bbe137af..bb59058ce61 100644 --- a/MAC/Test/GCF/src/Answer.h +++ b/MAC/Test/GCF/src/Answer.h @@ -1,15 +1,15 @@ #ifndef ANSWER_H #define ANSWER_H -#include <GCF/GCF_Answer.h> +#include <GCF/PAL/GCF_Answer.h> class GCFEvent; -class SupervisedTask; +class Task; class Answer : public GCFAnswer { public: - Answer(SupervisedTask& st) : + Answer(Task& st) : _st(st) {;} @@ -18,6 +18,6 @@ class Answer : public GCFAnswer void handleAnswer(GCFEvent& answer); private: - SupervisedTask& _st; + Task& _st; }; #endif diff --git a/MAC/Test/GCF/src/Application1.cc b/MAC/Test/GCF/src/Application1.cc index 75dda49d1b3..8ada39c7b5e 100644 --- a/MAC/Test/GCF/src/Application1.cc +++ b/MAC/Test/GCF/src/Application1.cc @@ -3,41 +3,30 @@ #include <GCF/GCF_PVInteger.h> #include <GCF/GCF_PVChar.h> #include <GCF/GCF_PVDouble.h> -#include <GCF/GCF_Property.h> -#include <GCF/GCF_MyProperty.h> +#include <GCF/PAL/GCF_Property.h> +#include <GCF/PAL/GCF_MyProperty.h> #include <math.h> #include <stdio.h> -#define DECLARE_SIGNAL_NAMES #include "TST_Protocol.ph" +#include <Suite/suite.h> -#ifdef WAIT_FOR_INPUT -#define CHECK_DB \ - { \ - string input; \ - cout << "Check SCADA DB content: "; \ - cin >> input; \ - } -#else -#define CHECK_DB {} -#endif static string sTaskName = "TA1"; Application::Application() : GCFTask((State)&Application::initial, sTaskName), + Test("TestApplication1"), _supTask1(*this, "ST1"), _supTask2(*this, "ST2"), - _passed(0), - _failed(0), _counter(0), _curRemoteTestNr(0), - _propertySetA1(propertySetA1, &_supTask1.getAnswerObj()), - _propertySetE1(propertySetE1, &_supTask1.getAnswerObj()), - _propertySetB1(propertySetB1, &_supTask1.getAnswerObj()), - _propertySetB2(propertySetB2, &_supTask2.getAnswerObj()), - _propertySetB3(propertySetB3, &_supTask2.getAnswerObj()), - _propertySetB4(propertySetB4, &_supTask2.getAnswerObj()), - _apcT1("ApcT1", "A_C", &_supTask2.getAnswerObj()), - _apcT3("ApcT3", "A_H", &_supTask1.getAnswerObj()) + _propertySetA1("A_B", propertySetA1, &_supTask1.getAnswerObj()), + _propertySetE1("A_L", propertySetE1, &_supTask1.getAnswerObj()), + _propertySetXX("A_X", propertySetE1, &_supTask1.getAnswerObj()), + _propertySetB1("A_C", propertySetB1, &_supTask1.getAnswerObj()), + _propertySetB2("A_D", propertySetB2, &_supTask2.getAnswerObj()), + _propertySetB3("A_E", propertySetB3, &_supTask2.getAnswerObj()), + _ePropertySetAC("A_C", propertySetB1, &_supTask2.getAnswerObj()), + _ePropertySetAL("A_L", propertySetB1, &_supTask2.getAnswerObj()) { // register the protocol for debugging purposes registerProtocol(TST_PROTOCOL, TST_PROTOCOL_signalnames); @@ -52,7 +41,8 @@ GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) case F_INIT: _supTask1.getPort().init(_supTask1, "client", GCFPortInterface::SAP, TST_PROTOCOL); _supTask2.getPort().init(_supTask2, "client", GCFPortInterface::SAP, TST_PROTOCOL); - TRAN(Application::test401); + + NEXT_TEST(1_1) break; default: @@ -63,48 +53,38 @@ GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test101(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test1_1(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; switch (e.signal) { case F_ENTRY: - if (_propertySetA1.load() != GCF_NO_ERROR) - { - failed(101); - TRAN(Application::test102); - } - else - { - _supTask1.getPort().setTimer(5.0); - } + _supTask1.getPort().init(_supTask1, "client", GCFPortInterface::SAP, TST_PROTOCOL); + TESTC(1 == _supTask1.getPort().open()); + break; + + case F_TIMER: + TESTC(1 == _supTask1.getPort().open()); break; - case F_MYPLOADED: + case F_CONNECTED: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - if (ready) { TRAN(Application::test102); break;} - if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - passed(101); - } - else - { - failed(101); - } - ready = true; + TSTTestreqEvent r; + r.testnr = 101; + TESTC(_supTask1.getPort().send(r) == SIZEOF_EVENT(r)); break; - } - case F_TIMER: - if (!ready) {failed(101); ready = true;} - else TRAN(Application::test102); + } + case F_DISCONNECTED: + if (&p == &_supTask1.getPort()) + _supTask1.getPort().setTimer(1.0); // try again after 1 second break; + case TST_TESTRESP: + { + NEXT_TEST(1_2) + break; + } default: status = GCFEvent::NOT_HANDLED; break; @@ -113,50 +93,76 @@ GCFEvent::TResult Application::test101(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test1_2(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; - + static bool closing = true; + switch (e.signal) { case F_ENTRY: - if (_propertySetA1.unload() != GCF_NO_ERROR) + closing = true; + break; + + case F_TIMER: + if (&p == &_supTask1.getPort()) + TESTC(1 == _supTask1.getPort().open()); + if (&p == &_supTask2.getPort()) + TESTC(1 == _supTask2.getPort().open()); + break; + + case F_CONNECTED: + { + if (_supTask1.getPort().isConnected()) { - failed(102); - TRAN(Application::test103); - } + if (_supTask2.getPort().isConnected()) + { + TSTTestreqEvent r; + r.testnr = 102; + TESTC(_supTask1.getPort().send(r) == SIZEOF_EVENT(r)); + } + else + TESTC(1 == _supTask2.getPort().open()); + } + break; + } + + case F_DISCONNECTED: + if (closing) + { + _supTask2.getPort().init(_supTask2, "client", GCFPortInterface::SAP, TST_PROTOCOL); + TESTC(1 == _supTask1.getPort().open()); + closing = false; + } else { - _supTask1.getPort().setTimer(1.0); - } + if (&p == &_supTask1.getPort()) + _supTask1.getPort().setTimer(1.0); // try again after 1 second + if (&p == &_supTask2.getPort()) + _supTask2.getPort().setTimer(1.0); // try again after 1 second + } break; - case F_MYPUNLOADED: - { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - if (ready) { TRAN(Application::test103); break;} - if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) + case TST_TESTRESP: + if (&p == &_supTask1.getPort()) { - passed(102); + TSTTestreqEvent r; + r.testnr = 102; + TESTC(_supTask2.getPort().send(r) == SIZEOF_EVENT(r)); } else { - failed(102); - } - ready = true; + TSTTestreadyEvent r; + r.testnr = 102; + TESTC(_supTask1.getPort().send(r) == SIZEOF_EVENT(r)); + } break; - } - - case F_TIMER: - if (!ready) {failed(102); ready = true;} - else TRAN(Application::test103); + + case TST_TESTREADY: + NEXT_TEST(2_1); break; - - default: + + default: status = GCFEvent::NOT_HANDLED; break; } @@ -164,53 +170,41 @@ GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test2_1(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; switch (e.signal) { case F_ENTRY: - if (_propertySetB1.load() != GCF_NO_ERROR) + if (TESTC(_propertySetA1.enable() == GCF_NO_ERROR)) { - failed(103); - TRAN(Application::test104); + _supTask1.getPort().setTimer(10.0); } else { - _counter = 1; - if (_propertySetB1.load() == GCF_NO_ERROR) - { - _counter = 2; - } - _supTask1.getPort().setTimer(1.0); + FAIL_AND_DONE("PML could not enable propset A1"); } break; - case F_MYPLOADED: + case F_MYPS_ENABLED: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - if (ready) { TRAN(Application::test103); break;} - if ((strcmp(pResponse->pScope, propertySetB1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) + _supTask1.getPort().cancelAllTimers(); + + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - passed(103); + TESTC(strcmp(pResponse->pScope, _propertySetA1.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } - else - { - failed(103); - } - if (_counter > 0) _counter--; - if (_counter == 0) - ready = true; + TESTC(&p == &_supTask1.getPort()); + TESTC(_propertySetA1.isEnabled()); + TESTC(_supTask1.getProxy().exists("A_B_temp")); + NEXT_TEST(2_2); break; } case F_TIMER: - if (!ready) {failed(103); ready = true;} - else TRAN(Application::test104); + FAIL_AND_DONE("Gets not response on enable request in time."); break; default: @@ -221,157 +215,41 @@ GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test2_2(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; switch (e.signal) { case F_ENTRY: - if (_propertySetA1.load() != GCF_NO_ERROR) + if (TESTC(_propertySetA1.disable() == GCF_NO_ERROR)) { - failed(104); - TRAN(Application::test105); + _supTask1.getPort().setTimer(10.0); } else { - _supTask1.getPort().setTimer(10.0); + FAIL_AND_DONE("PML could not disable propset A1"); } - _counter = 1; break; - case F_MYPLOADED: + case F_MYPS_DISABLED: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) - { - case 1: - if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - if (_propertySetB2.load() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; - - case 2: - if ((strcmp(pResponse->pScope, propertySetB2.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - if (_propertySetB3.load() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; - - case 3: - if ((strcmp(pResponse->pScope, propertySetB3.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - if (_propertySetB4.load() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; + _supTask1.getPort().cancelAllTimers(); - case 4: - if ((strcmp(pResponse->pScope, propertySetB4.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - if (_propertySetA1.unload() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; - } - break; - } - case F_MYPUNLOADED: - { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 5: - if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - if (_propertySetB2.unload() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; - - case 6: - if ((strcmp(pResponse->pScope, propertySetB2.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - if (_propertySetB3.unload() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; - - case 7: - if ((strcmp(pResponse->pScope, propertySetB3.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - if (_propertySetB4.unload() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - } - _counter++; - break; - - case 8: - if ((strcmp(pResponse->pScope, propertySetB4.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - if (!ready) - { - passed(104); - ready = true; - } - else TRAN(Application::test105); - } - break; + TESTC(strcmp(pResponse->pScope, _propertySetA1.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } + TESTC(&p == &_supTask1.getPort()); + TESTC(!_propertySetA1.isEnabled()); + TESTC(!_supTask1.getProxy().exists("A_B_temp")); + NEXT_TEST(2_3); break; } case F_TIMER: - if (!ready) {failed(104); ready = true;} - else TRAN(Application::test105); + FAIL_AND_DONE("Gets not response on disable request in time."); break; default: @@ -382,71 +260,52 @@ GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test2_3(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; switch (e.signal) { case F_ENTRY: - if (_propertySetA1.load() != GCF_NO_ERROR) + if (TESTC(_propertySetB1.enable() == GCF_NO_ERROR)) { - failed(105); - TRAN(Application::test201); + if (!TESTC(_propertySetB1.enable() != GCF_NO_ERROR)) + { + FAIL_AND_DONE("This should not be possible"); + } } else - _counter = 1; + { + FAIL_AND_DONE("PML could not enable propset B1"); + } break; - case F_MYPLOADED: + case F_MYPS_ENABLED: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 1: - if ((strcmp(pResponse->pScope, propertySetA1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - if (_propertySetB2.load() != GCF_NO_ERROR) - { - failed(105); - TRAN(Application::test201); - } - else - _counter++; - } - break; - - case 2: - if ((strcmp(pResponse->pScope, propertySetB2.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - passed(105); - } - else - failed(105); - TRAN(Application::test201); - break; + TESTC(strcmp(pResponse->pScope, _propertySetB1.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + TESTC(&p == &_supTask1.getPort()); + TESTC(_propertySetB1.isEnabled()); + TESTC(_supTask1.getProxy().exists("A_C_temp")); + if (TESTC(_propertySetB1.enable() != GCF_NO_ERROR)) + { + TSTTestreadyEvent r; + r.testnr = 203; + if (_supTask1.getPort().isConnected()) + _supTask1.getPort().send(r); + NEXT_TEST(2_5); + } + else + { + FAIL_AND_DONE("This should not be possible"); } break; } - case F_TIMER: - if (!ready) {failed(105); ready = true;} - else TRAN(Application::test201); - break; - case F_EXIT: - { - TSTTestreadyEvent r; - r.testnr = 105; - if (_supTask1.getPort().isConnected()) - _supTask1.getPort().send(r); - break; - } default: status = GCFEvent::NOT_HANDLED; break; @@ -455,24 +314,138 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test2_5(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY: - skipped(201); - TRAN(Application::test202); + _counter = 3; + if (!TESTC(_propertySetA1.enable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not enable propset A1"); + } + else if (!TESTC(_propertySetB2.enable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not enable propset B2"); + } + else if (!TESTC(_propertySetB3.enable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not enable propset B3"); + } + else + { + _supTask1.getPort().setTimer(10.0); + } break; - case TST_TESTREADY: + case F_MYPS_ENABLED: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + _counter--; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(pResponse->result == GCF_NO_ERROR); + if (strcmp(pResponse->pScope, "A_B") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetA1.getScope().c_str()) == 0); + TESTC(&p == &_supTask1.getPort()); + TESTC(_propertySetA1.isEnabled()); + TESTC(_supTask1.getProxy().exists("A_B_temp")); + } + else if (strcmp(pResponse->pScope, "A_D") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetB2.getScope().c_str()) == 0); + TESTC(&p == &_supTask2.getPort()); + TESTC(_propertySetB2.isEnabled()); + TESTC(_supTask2.getProxy().exists("A_D_temp")); + } + else if (strcmp(pResponse->pScope, "A_E") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetB3.getScope().c_str()) == 0); + TESTC(&p == &_supTask2.getPort()); + TESTC(_propertySetB3.isEnabled()); + TESTC(_supTask2.getProxy().exists("A_E_temp")); + } + } + + if (_counter == 0) + { + _counter = 4; + _supTask1.getPort().cancelAllTimers(); + if (!TESTC(_propertySetA1.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not disable propset A1"); + } + else if (!TESTC(_propertySetB1.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not disable propset B1"); + } + else if (!TESTC(_propertySetB2.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not disable propset B2"); + } + else if (!TESTC(_propertySetB3.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not disable propset B3"); + } + else + { + _supTask1.getPort().setTimer(10.0); + } + } + break; + } + case F_MYPS_DISABLED: + { + _counter--; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(pResponse->result == GCF_NO_ERROR); + if (strcmp(pResponse->pScope, "A_B") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetA1.getScope().c_str()) == 0); + TESTC(&p == &_supTask1.getPort()); + TESTC(!_propertySetA1.isEnabled()); + TESTC(!_supTask1.getProxy().exists("A_B_temp")); + } + else if (strcmp(pResponse->pScope, "A_C") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetB1.getScope().c_str()) == 0); + TESTC(&p == &_supTask1.getPort()); + TESTC(!_propertySetB1.isEnabled()); + TESTC(!_supTask1.getProxy().exists("A_C_temp")); + } + else if (strcmp(pResponse->pScope, "A_D") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetB2.getScope().c_str()) == 0); + TESTC(&p == &_supTask2.getPort()); + TESTC(!_propertySetB2.isEnabled()); + TESTC(!_supTask2.getProxy().exists("A_D_temp")); + } + else if (strcmp(pResponse->pScope, "A_E") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetB3.getScope().c_str()) == 0); + TESTC(&p == &_supTask2.getPort()); + TESTC(!_propertySetB3.isEnabled()); + TESTC(!_supTask2.getProxy().exists("A_E_temp")); + } + } + if (_counter == 0) + { + _supTask1.getPort().cancelAllTimers(); + TSTTestreadyEvent r; + r.testnr = 205; + _supTask1.getPort().send(r); + NEXT_TEST(3_4); + } break; } - + case F_TIMER: + FAIL_AND_DONE("Gets not response on disable request in time."); + break; default: status = GCFEvent::NOT_HANDLED; break; @@ -481,49 +454,41 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test3_4(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { - case F_ENTRY: - skipped(202); - TRAN(Application::test203); - break; - case TST_TESTREADY: { TSTTestreadyEvent indicationIn(e); _curRemoteTestNr = indicationIn.testnr; - break; + //intentional fall through } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { case F_ENTRY: - skipped(203); - TRAN(Application::test204); + if (_curRemoteTestNr != 303) break; + TESTC(!_supTask1.getProxy().exists("A_X")); + if (!TESTC(_propertySetXX.enable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not enable propset XX"); + } break; - case TST_TESTREADY: + case F_MYPS_ENABLED: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _propertySetXX.getScope().c_str()) == 0); + TESTC(pResponse->result != GCF_NO_ERROR); + } + TESTC(&p == &_supTask1.getPort()); + TESTC(!_propertySetXX.isEnabled()); + TESTC(!_supTask1.getProxy().exists("A_X")); + NEXT_TEST(4_1); break; - } + } default: status = GCFEvent::NOT_HANDLED; @@ -533,23 +498,36 @@ GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test4_1(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY: - skipped(204); - TRAN(Application::test205); + if (!TESTC(_propertySetB1.enable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not enable propset B1"); + } break; - case TST_TESTREADY: + case F_MYPS_ENABLED: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _propertySetB1.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + TESTC(&p == &_supTask1.getPort()); + TESTC(_propertySetB1.isEnabled()); + TESTC(_supTask1.getProxy().exists("A_C_temp")); + TSTTestreadyEvent r; + r.testnr = 401; + _supTask1.getPort().send(r); + NEXT_TEST(4_3); break; - } + } default: status = GCFEvent::NOT_HANDLED; @@ -559,209 +537,104 @@ GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test4_3(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; + static bool delayedUnLoad = false; switch (e.signal) { case TST_TESTREADY: { TSTTestreadyEvent indicationIn(e); - if (_curRemoteTestNr == 0) - _curRemoteTestNr = indicationIn.testnr; - //intentional fall through - else - break; - } - case F_ENTRY: - if (_curRemoteTestNr == 0) break; - if (_apcT1.load() != GCF_NO_ERROR) - { - failed(205); - TRAN(Application::test206); - } - _counter = 1; - break; - - case F_APCLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + _curRemoteTestNr = indicationIn.testnr; + if (!delayedUnLoad) break; + + delayedUnLoad = false; + switch (_curRemoteTestNr) { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) + case 402: + if (!TESTC(_ePropertySetAC.load() == GCF_NO_ERROR)) { - CHECK_DB; - if (_apcT1.unload() != GCF_NO_ERROR) - { - failed(204); - TRAN(Application::test205); - } - else - { - TSTTestreadyEvent r; - r.testnr = 205; - _supTask1.getPort().send(r); - } - } - _counter++; + FAIL_AND_DONE("PML could not load propset A_C"); + } break; - } - break; - } - - case F_APCUNLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) - { - case 2: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) + case 403: + if (!TESTC(_ePropertySetAC.unload() == GCF_NO_ERROR)) { - CHECK_DB - passed(205); + FAIL_AND_DONE("PML could not unload propset A_C"); } - else - failed(205); - TRAN(Application::test206); break; } break; - } - - case F_EXIT: - { - TSTTestreadyEvent r; - r.testnr = 205; - _supTask1.getPort().send(r); - break; } - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { case F_ENTRY: - _counter = 0; - break; - - case TST_TESTREADY: - { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; - if (_apcT1.load() != GCF_NO_ERROR) + if (_curRemoteTestNr != 402) { - failed(206); - TRAN(Application::test207); + delayedUnLoad = true; + break; } - else + if (!TESTC(_ePropertySetAC.load() == GCF_NO_ERROR)) { - _counter = 1; + FAIL_AND_DONE("PML could not load propset A_C"); } break; - } - case F_APCLOADED: + + case F_EXTPS_LOADED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 1) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) - { - CHECK_DB; - if (_apcT1.unload() != GCF_NO_ERROR) - { - failed(206); - TRAN(Application::test207); - } - else - { - TSTTestreadyEvent r; - r.testnr = 206; - _supTask1.getPort().send(r); - _counter++; - } - } + TESTC(strcmp(pResponse->pScope, _ePropertySetAC.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } - break; - } - - case F_APCUNLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 2) + + if (TESTC(_ePropertySetAC.isLoaded())) { - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask2.getPort())) + TSTTestreadyEvent r; + r.testnr = 402; + _supTask1.getPort().send(r); + if (_curRemoteTestNr != 403) { - CHECK_DB; - passed(206); + delayedUnLoad = true; + break; } - else - failed(206); - TRAN(Application::test207); + if (!TESTC(_ePropertySetAC.unload() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("PML could not unload propset A_C"); + } + } + else + { + FAIL_AND_DONE("PA could not load propset A_C"); } break; - } - - case F_EXIT: - { - TSTTestreadyEvent r; - r.testnr = 206; - _supTask1.getPort().send(r); - break; } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - return status; -} - -GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - skipped(207); - TRAN(Application::test208); - break; - - case TST_TESTREADY: + case F_EXTPS_UNLOADED: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _ePropertySetAC.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + + if (TESTC(!_ePropertySetAC.isLoaded())) + { + TSTTestreadyEvent r; + r.testnr = 403; + _supTask1.getPort().send(r); + NEXT_TEST(5_1); + } + else + { + FAIL_AND_DONE("PA could not unload propset A_C"); + } break; } + default: status = GCFEvent::NOT_HANDLED; break; @@ -770,7 +643,7 @@ GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test5_1(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -783,104 +656,78 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) //intentional fall through } case F_ENTRY: - if (_curRemoteTestNr != 208) break; - if (_apcT3.load(false) != GCF_NO_ERROR) - { - failed(208); - TRAN(Application::test301); - } - else + if (_curRemoteTestNr != 404) break; + if (!TESTC(_propertySetE1.enable() == GCF_NO_ERROR)) { - _counter = 1; + FAIL_AND_DONE("PML could not enable propset E1"); } break; - case F_APCLOADED: + + case F_MYPS_ENABLED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 1) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - if ((strcmp(pResponse->pScope, "A_H") == 0) && - (strcmp(pResponse->pApcName, "ApcT3") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - CHECK_DB - - if (_apcT3.unload() != GCF_NO_ERROR) - { - failed(208); - TRAN(Application::test301); - } - else - { - _counter++; - } - } - else + TESTC(strcmp(pResponse->pScope, _propertySetE1.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + + if (TESTC(_propertySetE1.isEnabled())) + { + if (!TESTC(_ePropertySetAL.load() == GCF_NO_ERROR)) { - failed(208); - TRAN(Application::test301); + FAIL_AND_DONE("PML could not load propset A_L"); } } + else + { + FAIL_AND_DONE("PA could not enable propset E1"); + } break; - } - - case F_APCUNLOADED: + } + case F_EXTPS_LOADED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 2) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _propertySetE1.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + if (TESTC(_ePropertySetAL.isLoaded())) + { + _propertySetE1.configure("e1"); + } + else + { + FAIL_AND_DONE("PA could not load propset A_L"); + } + break; + } + case F_PS_CONFIGURED: + { + GCFConfAnswerEvent* pResponse = (GCFConfAnswerEvent*)(&e); + if (TESTC(pResponse)) { - if ((strcmp(pResponse->pScope, "A_H") == 0) && - (strcmp(pResponse->pApcName, "ApcT3") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) + TESTC(strcmp(pResponse->pScope, _propertySetE1.getScope().c_str()) == 0); + TESTC(strcmp(pResponse->pApcName, "e1") == 0); + if (!TESTC(pResponse->result == GCF_NO_ERROR)) { - CHECK_DB - passed(208); + FAIL_AND_DONE("PA could not configure the propset A_L"); } else - failed(208); - TRAN(Application::test301); + { + TSTTestreadyEvent r; + r.testnr = 501; + _supTask1.getPort().send(r); + NEXT_TEST(6_1); + } + } + else + { + FAIL_AND_DONE("PA could not configure the propset A_L"); } break; - } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - break; - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - break; - + } default: status = GCFEvent::NOT_HANDLED; break; @@ -889,142 +736,70 @@ GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test6_1(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - GCFPValue* pValue; - switch (e.signal) { - case F_ENTRY: - if (_propertySetB1.unload() != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - else - _counter = 1; - break; - - case F_MYPUNLOADED: + case TST_TESTREADY: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - if ((strcmp(pResponse->pScope, propertySetB1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - if (_propertySetB1.load() != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - } - else - { - failed(301); - TRAN(Application::test302); - } - break; + TSTTestreadyEvent indicationIn(e); + _curRemoteTestNr = indicationIn.testnr; + //intentional fall through } - - case F_MYPLOADED: + case F_ENTRY: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - if ((strcmp(pResponse->pScope, propertySetB1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask1.getPort())) - { - // A_C_P1 section start - pValue = _propertySetB1.getValue("P1"); // its a clone - assert(pValue); - if (((GCFPVInteger*)pValue)->getValue() != 11) - { - failed(301); - TRAN(Application::test302); - } - delete pValue; - GCFPVInteger iv(12); - if (_propertySetB1.setValue("P1", iv) != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - } - pValue = _propertySetB1.getValue("P1"); // its a clone - assert(pValue); - if (((GCFPVInteger*)pValue)->getValue() != 12) - { - failed(301); - TRAN(Application::test302); - } - delete pValue; - - // A_C_P2 section start - GCFMyProperty* pProperty(0); - pProperty = static_cast<GCFMyProperty*>(_propertySetB1.getProperty("A_C_P2")); - assert(pProperty); - pValue = pProperty->getValue(); // its a clone - assert(pValue); - if (((GCFPVChar*)pValue)->getValue() != 25) - { - failed(301); - TRAN(Application::test302); - break; - } - delete pValue; - GCFPVChar cv(26); - if (_propertySetB1.setValue("P2", cv) != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - break; - } - pValue = _propertySetB1.getValue("P2"); // its a clone - assert(pValue); - if (((GCFPVChar*)pValue)->getValue() != 26) - { - failed(301); - TRAN(Application::test302); - break; - } - delete pValue; - // A_C_P3 section start - pValue = _propertySetB1.getValue("A_C_P3"); - assert(pValue); - if (((GCFPVDouble*)pValue)->getValue() != 33.3) - { - failed(301); - TRAN(Application::test302); - break; - } - delete pValue; - GCFPVDouble dv(33.4); - if (_propertySetB1.setValue("P3", dv) != GCF_NO_ERROR) - { - failed(301); - TRAN(Application::test302); - break; - } - pValue = _propertySetB1.getValue("P3"); // its a clone - assert(pValue); - if (((GCFPVDouble*)pValue)->getValue() != 33.4) - { - failed(301); - TRAN(Application::test302); - break; - } - delete pValue; - - passed(301); - TRAN(Application::test302); - } - else - { - failed(301); - TRAN(Application::test302); - } + if (_curRemoteTestNr != 503) break; + GCFPValue* pValue; + + // A_D.P1 section start + pValue = _propertySetB2.getValue("P1"); // its a clone + assert(pValue); + TESTC(((GCFPVInteger*)pValue)->getValue() == 12); + delete pValue; + + GCFPVInteger iv(13); + TESTC(_propertySetB2.setValue("P1", iv) == GCF_NO_ERROR); + + pValue = _propertySetB2.getValue("P1"); // its a clone + assert(pValue); + TESTC(((GCFPVInteger*)pValue)->getValue() == 13); + delete pValue; + + // A_D.P2 section start + GCFMyProperty* pProperty(0); + pProperty = static_cast<GCFMyProperty*>(_propertySetB2.getProperty("A_D.P2")); + assert(pProperty); + + pValue = pProperty->getValue(); // its a clone + assert(pValue); + TESTC(((GCFPVChar*)pValue)->getValue() == 26); + delete pValue; + + GCFPVChar cv(27); + TESTC(_propertySetB2.setValue("P2", cv) == GCF_NO_ERROR); + + pValue = _propertySetB2.getValue("P2"); // its a clone + assert(pValue); + TESTC(((GCFPVChar*)pValue)->getValue() == 27); + delete pValue; + + // A_D.P3 section start + pValue = _propertySetB2.getValue("A_D.P3"); // its a clone + assert(pValue); + TESTC(((GCFPVDouble*)pValue)->getValue() == 34.3); + delete pValue; + + GCFPVDouble dv(35.4); + TESTC(_propertySetB2.setValue("P3", dv) == GCF_NO_ERROR); + + pValue = _propertySetB2.getValue("P3"); // its a clone + assert(pValue); + TESTC(((GCFPVDouble*)pValue)->getValue() == 35.4); + delete pValue; + + FINISHED; break; } @@ -1036,6 +811,7 @@ GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& p) return status; } +/* GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -1463,7 +1239,7 @@ GCFEvent::TResult Application::test305(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; static unsigned int nrOfFaults = 0; @@ -1568,126 +1344,8 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test401(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - _supTask1.getPort().init(_supTask1, "client", GCFPortInterface::SAP, TST_PROTOCOL); - _supTask1.getPort().open(); - break; - - case F_TIMER: - _supTask1.getPort().open(); - break; - - case F_CONNECTED: - { - TSTTestreqEvent r; - r.testnr = 401; - _supTask1.getPort().send(r); - break; - } - case F_DISCONNECTED: - if (&p == &_supTask1.getPort()) - _supTask1.getPort().setTimer(1.0); // try again after 1 second - break; - - case TST_TESTRESP: - { - passed(401); - TRAN(Application::test402); - break; - } - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test402(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - static bool closing = true; - - switch (e.signal) - { - case F_ENTRY: - closing = true; - break; - - case F_TIMER: - if (&p == &_supTask1.getPort()) - _supTask1.getPort().open(); - if (&p == &_supTask2.getPort()) - _supTask2.getPort().open(); - break; - - case F_CONNECTED: - { - if (_supTask1.getPort().isConnected()) - { - if (_supTask2.getPort().isConnected()) - { - TSTTestreqEvent r; - r.testnr = 402; - _supTask1.getPort().send(r); - } - else - _supTask2.getPort().open(); - } - break; - } - - case F_DISCONNECTED: - if (closing) - { - _supTask2.getPort().init(_supTask2, "client", GCFPortInterface::SAP, TST_PROTOCOL); - _supTask1.getPort().open(); - closing = false; - } - else - { - if (&p == &_supTask1.getPort()) - _supTask1.getPort().setTimer(1.0); // try again after 1 second - if (&p == &_supTask2.getPort()) - _supTask2.getPort().setTimer(1.0); // try again after 1 second - } - break; - - case TST_TESTRESP: - if (&p == &_supTask1.getPort()) - { - TSTTestreqEvent r; - r.testnr = 402; - _supTask2.getPort().send(r); - } - else - { - TSTTestreadyEvent r; - r.testnr = 402; - _supTask1.getPort().send(r); - } - break; - - case TST_TESTREADY: - passed(402); - TRAN(Application::test101); - break; - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} -GCFEvent::TResult Application::test501(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test501(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -1776,18 +1434,29 @@ GCFEvent::TResult Application::test501(GCFEvent& e, GCFPortInterface& /*p*/) return status; } - +*/ GCFEvent::TResult Application::finished(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { + case TST_TESTREADY: + { + TSTTestreadyEvent indicationIn(e); + _curRemoteTestNr = indicationIn.testnr; + //intentional fall through + } case F_ENTRY: - fprintf(stderr, "Ready with tests: passed %d, failed %d\n", _passed, _failed); + { + if (_curRemoteTestNr != 999) break; + TSTTestreadyEvent r; + r.testnr = 999; + if (_supTask1.getPort().isConnected()) + // _supTask1.getPort().send(r); GCFTask::stop(); break; - + } default: status = GCFEvent::NOT_HANDLED; break; @@ -1796,15 +1465,21 @@ GCFEvent::TResult Application::finished(GCFEvent& e, GCFPortInterface& /*p*/) return status; } +void Application::run() +{ + start(); // make initial transition + GCFTask::run(); +} + int main(int argc, char* argv[]) { GCFTask::init(argc, argv); - - Application a; - - a.start(); - - GCFTask::run(); + + Suite s("GCF Test", &cerr); + s.addTest(new Application); + s.run(); + s.report(); + s.free(); return 0; } diff --git a/MAC/Test/GCF/src/Application1.h b/MAC/Test/GCF/src/Application1.h index df48f9ed7ee..ea1e3a756df 100644 --- a/MAC/Test/GCF/src/Application1.h +++ b/MAC/Test/GCF/src/Application1.h @@ -1,75 +1,52 @@ #ifndef APPLICATION_H #define APPLICATION_H -#include <GCF/GCF_Task.h> +#include <GCF/TM/GCF_Task.h> #include "SupervisedTask.h" -#include <GCF/GCF_MyPropertySet.h> -#include <GCF/GCF_Apc.h> +#include <GCF/PAL/GCF_MyPropertySet.h> +#include <GCF/PAL/GCF_ExtPropertySet.h> +#include <Suite/test.h> class GCFEvent; class GCFPortInterface; -class Application : public GCFTask +class Application : public GCFTask, public Test { public: Application(); + void run(); private: GCFEvent::TResult initial(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test101(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test102(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test103(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test104(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test105(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test201(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test202(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test203(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test204(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test205(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test206(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test207(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test208(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test209(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test210(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test301(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test302(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test303(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test304(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test305(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test306(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test401(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test402(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test501(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test1_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test1_2(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test2_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test2_2(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test2_3(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test2_5(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test3_4(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test4_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test4_3(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test5_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test6_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult finished(GCFEvent& e, GCFPortInterface& p); - void passed(unsigned int passedTest) - { - cerr << "Test " << passedTest << " passed\n"; - _passed++; - } - void failed(unsigned int failedTest) - { - cerr << "Test " << failedTest << " failed\n"; - _failed++; - } - void skipped(unsigned int skippedTest) - { - cerr << "Nothing to do in test " << skippedTest << " => skipped\n"; - } private: - SupervisedTask _supTask1; - SupervisedTask _supTask2; - unsigned char _passed; - unsigned char _failed; + Task _supTask1; + Task _supTask2; unsigned int _counter; unsigned int _curRemoteTestNr; + // Task1 GCFMyPropertySet _propertySetA1; GCFMyPropertySet _propertySetE1; + GCFMyPropertySet _propertySetXX; + // Task2 GCFMyPropertySet _propertySetB1; GCFMyPropertySet _propertySetB2; GCFMyPropertySet _propertySetB3; - GCFMyPropertySet _propertySetB4; - GCFApc _apcT1; - GCFApc _apcT3; + + GCFExtPropertySet _ePropertySetAC; + GCFExtPropertySet _ePropertySetAL; }; #endif diff --git a/MAC/Test/GCF/src/Application2.cc b/MAC/Test/GCF/src/Application2.cc index 8381f6f0b2d..f0fd9023188 100644 --- a/MAC/Test/GCF/src/Application2.cc +++ b/MAC/Test/GCF/src/Application2.cc @@ -2,42 +2,28 @@ #include "Defines.h" #include <GCF/GCF_PVInteger.h> #include <GCF/GCF_PVDouble.h> -#include <GCF/GCF_Property.h> +#include <GCF/PAL/GCF_Property.h> #include <math.h> #include <stdio.h> -#define DECLARE_SIGNAL_NAMES #include "TST_Protocol.ph" - -#ifdef WAIT_FOR_INPUT -#define CHECK_DB \ - { \ - string input; \ - cout << "Check SCADA DB content: "; \ - cin >> input; \ - } -#else -#define CHECK_DB {} -#endif +#include <Suite/suite.h> static string sTaskName = "TA2"; Application::Application() : GCFTask((State)&Application::initial, sTaskName), + Test("TestApplication2"), _supTask3(*this, "ST3"), - _passed(0), - _failed(0), _counter(0), _curRemoteTestNr(0), _pSTPort1(0), _pSTPort2(0), - _propertySetC1(propertySetC1, &_supTask3.getAnswerObj()), - _propertySetD1(propertySetD1, &_supTask3.getAnswerObj()), - _propertySetB4(propertySetB4, &_supTask3.getAnswerObj()), - _apcT1("ApcT1", "A_C", &_supTask3.getAnswerObj()), - _apcT1K("ApcT1", "A_K", &_supTask3.getAnswerObj()), - _apcT1a("ApcT1a", "A_C", &_supTask3.getAnswerObj()), - _apcT1b("ApcT1b", "A", &_supTask3.getAnswerObj()), - _apcT3("ApcT3", "A_H", &_supTask3.getAnswerObj()) + _propertySetC1("A_H_I", propertySetC1, &_supTask3.getAnswerObj()), + _propertySetD1("A_H", propertySetD1, &_supTask3.getAnswerObj()), + _propertySetB4("A_K", propertySetB4, &_supTask3.getAnswerObj(), GCFMyPropertySet::USE_DB_DEFAULTS), + _ePropertySetAC("A_C", propertySetB1, &_supTask3.getAnswerObj()), + _ePropertySetAH("A_H", propertySetD1, &_supTask3.getAnswerObj()), + _ePropertySetAK("A_K", propertySetB4, &_supTask3.getAnswerObj()) { // register the protocol for debugging purposes registerProtocol(TST_PROTOCOL, TST_PROTOCOL_signalnames); @@ -51,7 +37,7 @@ GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) { case F_INIT: _supTask3.getPort().init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); - TRAN(Application::test401); + NEXT_TEST(1_1); break; default: @@ -62,48 +48,38 @@ GCFEvent::TResult Application::initial(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test101(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test1_1(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY: - skipped(101); - TRAN(Application::test102); + _supTask3.getPort().init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); + TESTC(1 == _supTask3.getPort().open()); break; - case TST_TESTREADY: - { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; - break; - } - default: - status = GCFEvent::NOT_HANDLED; + case F_TIMER: + TESTC(1 == _supTask3.getPort().open()); break; - } - return status; -} - -GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; + case F_CONNECTED: + break; - switch (e.signal) - { - case F_ENTRY: - skipped(102); - TRAN(Application::test103); + case F_DISCONNECTED: + if (&p == &_supTask3.getPort()) + _supTask3.getPort().setTimer(1.0); // try again after 1 second break; - case TST_TESTREADY: + case TST_TESTREQ: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + TSTTestrespEvent r; + r.testnr = 101; + TESTC(_supTask3.getPort().send(r) == SIZEOF_EVENT(r)); + NEXT_TEST(1_2); break; } + default: status = GCFEvent::NOT_HANDLED; break; @@ -112,207 +88,97 @@ GCFEvent::TResult Application::test102(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test103(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test1_2(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; + + + static bool closing = true; switch (e.signal) { case F_ENTRY: - skipped(103); - TRAN(Application::test104); + closing = true; + _supTask3.getPort().close(); break; - case TST_TESTREADY: - { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; - break; - } - default: - status = GCFEvent::NOT_HANDLED; + case F_TIMER: + TESTC(1 == _port.open()); break; - } - - return status; -} - -GCFEvent::TResult Application::test104(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; - - switch (e.signal) - { - case TST_TESTREADY: - { - TSTTestreadyEvent indicationIn(e); - if (_curRemoteTestNr == 0) - _curRemoteTestNr = indicationIn.testnr; - //intentional fall through - else - break; - } - case F_ENTRY: - if (_curRemoteTestNr == 0) break; - if (_propertySetC1.load() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - else - { - _supTask3.getPort().setTimer(10.0); - _counter = 1; - } + case F_CONNECTED: + _counter = 0; break; - - case F_MYPLOADED: - { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + + case F_ACCEPT_REQ: + if (_pSTPort1 == 0) { - case 1: - if ((strcmp(pResponse->pScope, propertySetC1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_propertySetD1.load() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - else _counter++; - } - break; - - case 2: - if ((strcmp(pResponse->pScope, propertySetD1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_propertySetC1.unload() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - else _counter++; - } - break; + _pSTPort1 = new GCFTCPPort(); + _pSTPort1->init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); + TESTC(0 == _port.accept(*_pSTPort1)); } - break; - } - case F_MYPUNLOADED: - { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + else { - case 3: - if ((strcmp(pResponse->pScope, propertySetC1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_propertySetD1.unload() != GCF_NO_ERROR) - { - failed(104); - TRAN(Application::test105); - } - else _counter++; - } - break; - - case 4: - if ((strcmp(pResponse->pScope, propertySetD1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (!ready) - { - passed(104); - ready = true; - } - else TRAN(Application::test105) - } - break; + _pSTPort2 = new GCFTCPPort(); + _pSTPort2->init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); + TESTC(0 == _port.accept(*_pSTPort2)); } break; - } - case F_TIMER: - if (!ready) {failed(104); ready = true;} - else TRAN(Application::test105); - break; - - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - if (_propertySetC1.load() != GCF_NO_ERROR) + + case F_DISCONNECTED: + if (closing) { - failed(105); - TRAN(Application::test201); + _port.init(_supTask3, "server", GCFPortInterface::MSPP, TST_PROTOCOL); + TESTC(1 == _port.open()); + closing = false; } else { - _counter = 1; + if (&p == &_port) + _port.setTimer(1.0); // try again after 1 second } break; - case F_MYPLOADED: + case F_CLOSED: + _port.init(_supTask3, "server", GCFPortInterface::MSPP, TST_PROTOCOL); + TESTC(1 == _port.open()); + closing = false; + break; + + case TST_TESTREQ: { - GCFMYPropAnswerEvent* pResponse = static_cast<GCFMYPropAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + TSTTestrespEvent r; + r.testnr = 102; + _counter++; + if (_counter == 1) { - case 1: - if ((strcmp(pResponse->pScope, propertySetC1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_propertySetD1.load() != GCF_NO_ERROR) - { - failed(105); - TRAN(Application::test201); - } - else _counter++; - } - break; - - case 2: - if ((strcmp(pResponse->pScope, propertySetD1.scope) == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - passed(105); - } - else - failed(105); - TRAN(Application::test201); - break; + if (TESTC(_pSTPort1)) + TESTC(_pSTPort1->send(r) == SIZEOF_EVENT(r)); + else + FAIL_AND_DONE("Pointer error"); + } + else if (_counter == 2) + { + if (TESTC(_pSTPort2)) + TESTC(_pSTPort2->send(r) == SIZEOF_EVENT(r)); + else + FAIL_AND_DONE("Pointer error"); } break; } - case TST_TESTREADY: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + TSTTestreadyEvent r(e); + assert(_pSTPort1); + if (TESTC(_pSTPort1)) + { + TESTC(_pSTPort1->send(r) == SIZEOF_EVENT(r)); + NEXT_TEST(2_5); + } + else + FAIL_AND_DONE("Pointer error"); break; - } + } default: status = GCFEvent::NOT_HANDLED; break; @@ -321,10 +187,10 @@ GCFEvent::TResult Application::test105(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) + +GCFEvent::TResult Application::test2_5(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; switch (e.signal) { @@ -332,71 +198,98 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) { TSTTestreadyEvent indicationIn(e); _curRemoteTestNr = indicationIn.testnr; - //intentional fall through + //intentional fall through } case F_ENTRY: - if (_curRemoteTestNr != 105) break; - if (_apcT1.load() != GCF_NO_ERROR) + if (_curRemoteTestNr != 203) break; + _counter = 2; + if (!TESTC(_propertySetC1.enable() == GCF_NO_ERROR)) { - failed(201); - TRAN(Application::test202); - } - else + FAIL_AND_DONE("Could not enable propset C1"); + } + else if (!TESTC(_propertySetD1.enable() == GCF_NO_ERROR)) { - _supTask3.getPort().setTimer(15.0); - _counter = 1; + FAIL_AND_DONE("Could not enable propset D1"); } + else + { + _supTask3.getPort().setTimer(10.0); + } break; - case F_APCLOADED: + case F_MYPS_ENABLED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + _counter--; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_apcT1.unload() != GCF_NO_ERROR) - { - failed(201); - TRAN(Application::test202); - } - else _counter++; - } - break; + TESTC(pResponse->result == GCF_NO_ERROR); + if (strcmp(pResponse->pScope, "A_H_I") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetC1.getScope().c_str()) == 0); + TESTC(&p == &_supTask3.getPort()); + TESTC(_propertySetC1.isEnabled()); + TESTC(_supTask3.getProxy().exists("A_H_I_temp")); + } + else if (strcmp(pResponse->pScope, "A_H") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetD1.getScope().c_str()) == 0); + TESTC(&p == &_supTask3.getPort()); + TESTC(_propertySetD1.isEnabled()); + TESTC(_supTask3.getProxy().exists("A_H_temp")); + } } - break; - } - case F_APCUNLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + + if (_counter == 0) { - case 2: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (!ready) - { - passed(201); - ready = true; - } - else TRAN(Application::test202); - } - break; + _counter = 2; + _supTask3.getPort().cancelAllTimers(); + if (!TESTC(_propertySetC1.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not disable propset C1"); + } + else if (!TESTC(_propertySetD1.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not disable propset D1"); + } + else + { + _supTask3.getPort().setTimer(10.0); + } } break; } + case F_MYPS_DISABLED: + { + _counter--; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(pResponse->result == GCF_NO_ERROR); + if (strcmp(pResponse->pScope, "A_H_I") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetC1.getScope().c_str()) == 0); + TESTC(&p == &_supTask3.getPort()); + TESTC(!_propertySetC1.isEnabled()); + TESTC(!_supTask3.getProxy().exists("A_H_I_temp")); + } + else if (strcmp(pResponse->pScope, "A_H") == 0) + { + TESTC(strcmp(pResponse->pScope, _propertySetD1.getScope().c_str()) == 0); + TESTC(&p == &_supTask3.getPort()); + TESTC(!_propertySetD1.isEnabled()); + TESTC(!_supTask3.getProxy().exists("A_H_temp")); + } + } + if (_counter == 0) + { + _supTask3.getPort().cancelAllTimers(); + NEXT_TEST(3_1); + } + break; + } case F_TIMER: - if (!ready) {failed(201); ready = true;} - else TRAN(Application::test202); + FAIL_AND_DONE("Gets not response on disable request in time."); break; default: @@ -407,54 +300,40 @@ GCFEvent::TResult Application::test201(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test3_1(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; switch (e.signal) { + case TST_TESTREADY: + { + TSTTestreadyEvent indicationIn(e); + _curRemoteTestNr = indicationIn.testnr; + //intentional fall through + } case F_ENTRY: - if (_apcT1.load(false) != GCF_NO_ERROR) - { - failed(202); - TRAN(Application::test203); - } - else + if (_curRemoteTestNr != 205) break; + if (!TESTC(_propertySetB4.enable() == GCF_NO_ERROR)) { - _supTask3.getPort().setTimer(10.0); - _counter = 1; + FAIL_AND_DONE("Could not enable propset B4"); } break; - case F_APCLOADED: + case F_MYPS_ENABLED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) - { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - CHECK_DB - if (!ready) - { - passed(202); - ready = true; - } - else TRAN(Application::test203); - } - break; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _propertySetB4.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } + TESTC(&p == &_supTask3.getPort()); + TESTC(_propertySetB4.isEnabled()); + TESTC(!_supTask3.getProxy().exists("A_K_temp")); + NEXT_TEST(3_2); break; - } - case F_TIMER: - if (!ready) {failed(202); ready = true;} - else TRAN(Application::test203); - break; + } default: status = GCFEvent::NOT_HANDLED; @@ -464,45 +343,33 @@ GCFEvent::TResult Application::test202(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test3_2(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { - case F_ENTRY: - if (_apcT1.unload() != GCF_NO_ERROR) - { - failed(203); - TRAN(Application::test204); - } - else + case F_ENTRY: + if (!TESTC(_propertySetB4.disable() == GCF_NO_ERROR)) { - _counter = 1; + FAIL_AND_DONE("Could not disable propset B4"); } break; - case F_APCUNLOADED: + case F_MYPS_DISABLED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 1) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - CHECK_DB - passed(203); - } - else - failed(203); - - TRAN(Application::test204); + TESTC(strcmp(pResponse->pScope, _propertySetB4.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } + TESTC(&p == &_supTask3.getPort()); + TESTC(!_propertySetB4.isEnabled()); + TESTC(!_supTask3.getProxy().exists("A_K_temp")); + NEXT_TEST(3_3); break; - } + } default: status = GCFEvent::NOT_HANDLED; @@ -512,65 +379,61 @@ GCFEvent::TResult Application::test203(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test3_3(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { + case TST_TESTREADY: + { + TSTTestreadyEvent indicationIn(e); + _curRemoteTestNr = indicationIn.testnr; + //intentional fall through + } case F_ENTRY: - if (_apcT1.load() != GCF_NO_ERROR) - { - failed(204); - TRAN(Application::test205); - } - else + if (_curRemoteTestNr != 205) break; + if (!TESTC(_propertySetB4.enable() == GCF_NO_ERROR)) { - _counter = 1; + FAIL_AND_DONE("Could not enable propset B4"); } break; - case F_APCLOADED: + case F_MYPS_ENABLED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_apcT1.reload() != GCF_NO_ERROR) - { - failed(204); - TRAN(Application::test205); - } - else _counter++; - } - break; + TESTC(strcmp(pResponse->pScope, _propertySetB4.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } + + if (!TESTC(_propertySetB4.disable() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not disable propset B4"); + } break; - } - case F_APCRELOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + } + + case F_MYPS_DISABLED: + { + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 2: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - passed(204); - } - else - failed(204); - TRAN(Application::test205); - break; + TESTC(strcmp(pResponse->pScope, _propertySetB4.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + + if (!TESTC(_propertySetB4.disable() != GCF_NO_ERROR)) + { + FAIL_AND_DONE("This should not be possible"); + } + else + { + TSTTestreadyEvent r; + r.testnr = 303; + _pSTPort1->send(r); + NEXT_TEST(4_1); } break; } @@ -583,69 +446,54 @@ GCFEvent::TResult Application::test204(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test4_1(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; - static bool ready = false; - static bool started = false; - + switch (e.signal) { - case F_ENTRY: - { - TSTTestreadyEvent r; - r.testnr = 204; - assert(_pSTPort1); - _pSTPort1->send(r); - break; - } case TST_TESTREADY: { TSTTestreadyEvent indicationIn(e); _curRemoteTestNr = indicationIn.testnr; - if (started) + //intentional fall through + } + case F_ENTRY: + if (_curRemoteTestNr != 401) break; + if (!TESTC(_ePropertySetAC.load() == GCF_NO_ERROR)) { - if (ready) TRAN(Application::test206) - else ready = true; - } + FAIL_AND_DONE("Could not load propset A_C"); + } else { - started = true; - if (_apcT1.unload() != GCF_NO_ERROR) - { - failed(205); - TRAN(Application::test206); - } - else - { - _counter = 1; - } + _supTask3.getPort().setTimer(10.0); } break; - } - case F_APCUNLOADED: + + case F_EXTPS_LOADED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) - { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - CHECK_DB - passed(205); - } - else - failed(205); - if (ready) TRAN(Application::test206) - else ready = true; - break; + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _ePropertySetAC.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); + } + + _supTask3.getPort().cancelAllTimers(); + if (TESTC(_ePropertySetAC.isLoaded())) + { + NEXT_TEST(4_2); + } + else + { + FAIL_AND_DONE("Could not load propset A_C"); } break; - } + } + + case F_TIMER: + FAIL_AND_DONE("Gets not response on load request in time."); + break; default: status = GCFEvent::NOT_HANDLED; @@ -655,101 +503,50 @@ GCFEvent::TResult Application::test205(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test4_2(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { case F_ENTRY: - _counter = 0; - if (_apcT1.load() != GCF_NO_ERROR) + if (!TESTC(_ePropertySetAC.unload() == GCF_NO_ERROR)) { - failed(204); - TRAN(Application::test205); - } + FAIL_AND_DONE("Could not unload propset A_C"); + } else { - _counter = 1; + _supTask3.getPort().setTimer(10.0); } break; - - case TST_TESTREADY: + + case F_EXTPS_UNLOADED: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; - if (_counter == 2) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - if (_apcT1.unload() != GCF_NO_ERROR) - { - failed(206); - TRAN(Application::test207); - } - else _counter++; + TESTC(strcmp(pResponse->pScope, _ePropertySetAC.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } - break; - } - case F_APCLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 1) + + _supTask3.getPort().cancelAllTimers(); + if (TESTC(!_ePropertySetAC.isLoaded())) { - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_apcT1.reload() != GCF_NO_ERROR) - { - failed(206); - TRAN(Application::test207); - } - else _counter++; - } - } - break; - } - case F_APCRELOADED: - { - - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 2) + TSTTestreadyEvent r; + r.testnr = 402; + _pSTPort1->send(r); + NEXT_TEST(4_3); + } + else { - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - TSTTestreadyEvent r; - r.testnr = 206; - assert(_pSTPort1); - _pSTPort1->send(r); - } + FAIL_AND_DONE("Could not unload propset A_C"); } break; } - case F_APCUNLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - if (_counter == 3) - { - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - CHECK_DB - passed(206); - } - else - failed(206); - TRAN(Application::test207); - } + + case F_TIMER: + FAIL_AND_DONE("Gets not response on unload request in time."); break; - } default: status = GCFEvent::NOT_HANDLED; @@ -759,161 +556,85 @@ GCFEvent::TResult Application::test206(GCFEvent& e, GCFPortInterface& p) return status; } -GCFEvent::TResult Application::test207(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test4_3(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; + static bool delayedUnload = false; switch (e.signal) { - case TST_TESTREADY: - { - TSTTestreadyEvent indicationIn(e); - if (_curRemoteTestNr == 0) - _curRemoteTestNr = indicationIn.testnr; - //intentional fall through - else - break; - } case F_ENTRY: - if (_curRemoteTestNr == 0) break; - if (_apcT1a.load(false) != GCF_NO_ERROR) - { - failed(207); - TRAN(Application::test208); - } - else + if (!TESTC(_ePropertySetAC.load() == GCF_NO_ERROR)) { - _counter = 1; + FAIL_AND_DONE("Could not load propset A_C"); } break; - case F_APCLOADED: + case F_EXTPS_LOADED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1a") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_apcT1a.unload() != GCF_NO_ERROR) - { - failed(207); - TRAN(Application::test208); - } - else _counter++; - } - break; - } - break; - } - case F_APCUNLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) - { - case 2: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT1a") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - passed(207); - } - else - failed(207); - TRAN(Application::test208); - break; + TESTC(strcmp(pResponse->pScope, _ePropertySetAC.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } - break; - } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - if (_apcT1b.load(false) != GCF_NO_ERROR) + + if (TESTC(_ePropertySetAC.isLoaded())) { - failed(208); - TRAN(Application::test301); - } + TSTTestreadyEvent r; + r.testnr = 403; + _pSTPort1->send(r); + + if (_curRemoteTestNr != 402) + { + delayedUnload = true; + break; + } + if (!TESTC(_ePropertySetAC.unload() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not unload propset A_C"); + } + } else { - _counter = 1; - } + FAIL_AND_DONE("Could not load propset A_C"); + } break; + } - case F_APCLOADED: + case F_EXTPS_UNLOADED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) { - case 1: - if ((strcmp(pResponse->pScope, "A") == 0) && - (strcmp(pResponse->pApcName, "ApcT1b") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - if (_apcT1b.unload() != GCF_NO_ERROR) - { - failed(208); - TRAN(Application::test301); - } - else _counter++; - } - else - { - failed(208); - TRAN(Application::test301); - } - break; + TESTC(strcmp(pResponse->pScope, _ePropertySetAC.getScope().c_str()) == 0); + TESTC(pResponse->result == GCF_NO_ERROR); } - break; - } - case F_APCUNLOADED: - { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + + if (TESTC(!_ePropertySetAC.isLoaded())) + { + TSTTestreadyEvent r; + r.testnr = 403; + //_pSTPort1->send(r); + NEXT_TEST(4_4); + } + else { - case 2: - if ((strcmp(pResponse->pScope, "A") == 0) && - (strcmp(pResponse->pApcName, "ApcT1b") == 0) && - (pResponse->result == GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) - { - passed(208); - } - else - failed(208); - TRAN(Application::test301); - break; + FAIL_AND_DONE("Could not unload propset A_C"); } break; - } + } - case F_EXIT: + case TST_TESTREADY: { - TSTTestreadyEvent r; - r.testnr = 208; - assert(_pSTPort1); - _pSTPort1->send(r); + TSTTestreadyEvent indicationIn(e); + _curRemoteTestNr = indicationIn.testnr; + if (!delayedUnload) break; + if (_curRemoteTestNr != 402) break; + if (!TESTC(_ePropertySetAC.unload() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not unload propset A_C"); + } break; } @@ -925,72 +646,124 @@ GCFEvent::TResult Application::test208(GCFEvent& e, GCFPortInterface& p) return status; } -// Will be skipped due to problems in the design -GCFEvent::TResult Application::test209(GCFEvent& e, GCFPortInterface& p) +GCFEvent::TResult Application::test4_4(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { - case F_ENTRY: - break; - case TST_TESTREADY: { TSTTestreadyEvent indicationIn(e); _curRemoteTestNr = indicationIn.testnr; - _apcT3.setScope("A_C"); - if (_apcT3.load(false) != GCF_NO_ERROR) + //intentional fall through + } + case F_ENTRY: + if (_curRemoteTestNr != 403) break; + if (!TESTC(_propertySetB4.enable() == GCF_NO_ERROR)) { - failed(209); - TRAN(Application::test210); + FAIL_AND_DONE("Could not enable propset B4"); } - else + else if (!TESTC(_propertySetD1.enable() == GCF_NO_ERROR)) { - _counter = 1; - } + FAIL_AND_DONE("Could not enable propset D1"); + } + break; + + case F_MYPS_ENABLED: + { + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(pResponse->result == GCF_NO_ERROR); + } + if (_propertySetB4.isEnabled() && _propertySetD1.isEnabled()) + { + _counter = 0; + if (!TESTC(_ePropertySetAC.load() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not load propset A_C"); + } + else if (!TESTC(_ePropertySetAH.load() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not load propset A_H"); + } + else if (!TESTC(_ePropertySetAK.load() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not load propset A_K"); + } + } break; } - case F_APCLOADED: + + case F_EXTPS_LOADED: { - GCFAPCAnswerEvent* pResponse = static_cast<GCFAPCAnswerEvent*>(&e); - assert(pResponse); - switch (_counter) + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(pResponse->result == GCF_NO_ERROR); + } + if (_ePropertySetAC.isLoaded() && + _ePropertySetAH.isLoaded() && + _ePropertySetAK.isLoaded()) + { + if (!TESTC(_ePropertySetAC.unload() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not unload propset A_C"); + } + else if (!TESTC(_ePropertySetAH.unload() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not unload propset A_H"); + } + else if (!TESTC(_ePropertySetAK.unload() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not unload propset A_K"); + } + } + break; + } + case F_EXTPS_UNLOADED: + { + GCFPropSetAnswerEvent* pResponse = (GCFPropSetAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(pResponse->result == GCF_NO_ERROR); + } + if (!_ePropertySetAC.isLoaded() && + !_ePropertySetAH.isLoaded() && + !_ePropertySetAK.isLoaded()) { - case 1: - if ((strcmp(pResponse->pScope, "A_C") == 0) && - (strcmp(pResponse->pApcName, "ApcT3") == 0) && - (pResponse->result != GCF_NO_ERROR) && - (&p == &_supTask3.getPort())) + _counter++; + if (_counter < 100) + { + if (!TESTC(_ePropertySetAC.load() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not load propset A_C"); + } + else if (!TESTC(_ePropertySetAH.load() == GCF_NO_ERROR)) + { + FAIL_AND_DONE("Could not load propset A_H"); + } + else if (!TESTC(_ePropertySetAK.load() == GCF_NO_ERROR)) { - passed(209); + FAIL_AND_DONE("Could not load propset A_K"); } - else - failed(209); - TRAN(Application::test210); - break; + } + else + { + NEXT_TEST(5_3); + } } + break; + } + case F_EXIT: + { + TSTTestreadyEvent r; + r.testnr = 404; + if (_pSTPort1->isConnected()) + _pSTPort1->send(r); break; - } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -// Will be skipped due to combinations of other tests coverts this test -GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - break; - + } default: status = GCFEvent::NOT_HANDLED; break; @@ -999,50 +772,52 @@ GCFEvent::TResult Application::test210(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test301(GCFEvent& e, GCFPortInterface& /*p*/) +GCFEvent::TResult Application::test5_3(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; switch (e.signal) { - case F_ENTRY: - skipped(301); - TRAN(Application::test302); - break; - case TST_TESTREADY: { TSTTestreadyEvent indicationIn(e); _curRemoteTestNr = indicationIn.testnr; - break; + //intentional fall through } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& /*p*/) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { case F_ENTRY: - skipped(302); - TRAN(Application::test303); + if (_curRemoteTestNr != 501) break; + _ePropertySetAK.configure("e2"); break; - - case TST_TESTREADY: + case F_PS_CONFIGURED: { - TSTTestreadyEvent indicationIn(e); - _curRemoteTestNr = indicationIn.testnr; + GCFConfAnswerEvent* pResponse = (GCFConfAnswerEvent*)(&e); + if (TESTC(pResponse)) + { + TESTC(strcmp(pResponse->pScope, _ePropertySetAK.getScope().c_str()) == 0); + TESTC(strcmp(pResponse->pApcName, "e2") == 0); + if (!TESTC(pResponse->result != GCF_NO_ERROR)) + { + FAIL_AND_DONE("PA has not reported configure error: e2.apc does not exist"); + } + else + { + FINISHED; + } + } + else + { + FAIL_AND_DONE("Event problems"); + } break; - } - + } + case F_EXIT: + { + TSTTestreadyEvent r; + r.testnr = 503; + if (_pSTPort1->isConnected()) + _pSTPort1->send(r); + break; + } default: status = GCFEvent::NOT_HANDLED; break; @@ -1051,7 +826,7 @@ GCFEvent::TResult Application::test302(GCFEvent& e, GCFPortInterface& /*p*/) return status; } -GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) +/*GCFEvent::TResult Application::test303(GCFEvent& e, GCFPortInterface& p) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -1485,139 +1260,7 @@ GCFEvent::TResult Application::test306(GCFEvent& e, GCFPortInterface& p) return status; } - -GCFEvent::TResult Application::test401(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - switch (e.signal) - { - case F_ENTRY: - _supTask3.getPort().init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); - _supTask3.getPort().open(); - break; - - case F_TIMER: - _supTask3.getPort().open(); - break; - - case F_CONNECTED: - break; - - case F_DISCONNECTED: - if (&p == &_supTask3.getPort()) - _supTask3.getPort().setTimer(1.0); // try again after 1 second - break; - - case TST_TESTREQ: - { - TSTTestrespEvent r; - r.testnr = 401; - _supTask3.getPort().send(r); - passed(401); - TRAN(Application::test402); - break; - } - - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - -GCFEvent::TResult Application::test402(GCFEvent& e, GCFPortInterface& p) -{ - GCFEvent::TResult status = GCFEvent::HANDLED; - - - static bool closing = true; - - switch (e.signal) - { - case F_ENTRY: - closing = true; - _supTask3.getPort().close(); - break; - - case F_TIMER: - _port.open(); - break; - - case F_CONNECTED: - _counter = 0; - break; - - case F_ACCEPT_REQ: - if (_pSTPort1 == 0) - { - _pSTPort1 = new GCFTCPPort(); - _pSTPort1->init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); - _port.accept(*_pSTPort1); - } - else - { - _pSTPort2 = new GCFTCPPort(); - _pSTPort2->init(_supTask3, "server", GCFPortInterface::SPP, TST_PROTOCOL); - _port.accept(*_pSTPort2); - } - break; - - case F_DISCONNECTED: - if (closing) - { - _port.init(_supTask3, "server", GCFPortInterface::MSPP, TST_PROTOCOL); - _port.open(); - closing = false; - } - else - { - if (&p == &_port) - _port.setTimer(1.0); // try again after 1 second - } - break; - - case F_CLOSED: - _port.init(_supTask3, "server", GCFPortInterface::MSPP, TST_PROTOCOL); - _port.open(); - closing = false; - break; - - case TST_TESTREQ: - { - TSTTestrespEvent r; - r.testnr = 402; - _counter++; - if (_counter == 1) - { - assert(_pSTPort1); - _pSTPort1->send(r); - } - else if (_counter == 2) - { - assert(_pSTPort2); - _pSTPort2->send(r); - } - break; - } - case TST_TESTREADY: - { - TSTTestreadyEvent r(e); - assert(_pSTPort1); - _pSTPort1->send(r); - passed(402); - TRAN(Application::test101); - break; - } - default: - status = GCFEvent::NOT_HANDLED; - break; - } - - return status; -} - +*/ GCFEvent::TResult Application::finished(GCFEvent& e, GCFPortInterface& /*p*/) { GCFEvent::TResult status = GCFEvent::HANDLED; @@ -1631,11 +1274,15 @@ GCFEvent::TResult Application::finished(GCFEvent& e, GCFPortInterface& /*p*/) //intentional fall through } case F_ENTRY: - if (_curRemoteTestNr != 501) break; - fprintf(stderr, "Ready with tests: passed %d, failed %d\n", _passed, _failed); + { + //if (_curRemoteTestNr != 999) break; + TSTTestreadyEvent r; + r.testnr = 999; + if (_pSTPort1->isConnected()) + _pSTPort1->send(r); GCFTask::stop(); break; - + } default: status = GCFEvent::NOT_HANDLED; break; @@ -1644,15 +1291,21 @@ GCFEvent::TResult Application::finished(GCFEvent& e, GCFPortInterface& /*p*/) return status; } +void Application::run() +{ + start(); // make initial transition + GCFTask::run(); +} + int main(int argc, char* argv[]) { GCFTask::init(argc, argv); - Application a; - - a.start(); - - GCFTask::run(); + Suite s("GCF Test", &cerr); + s.addTest(new Application); + s.run(); + s.report(); + s.free(); return 0; } diff --git a/MAC/Test/GCF/src/Application2.h b/MAC/Test/GCF/src/Application2.h index cf12fff5345..8de1a7c8d13 100644 --- a/MAC/Test/GCF/src/Application2.h +++ b/MAC/Test/GCF/src/Application2.h @@ -1,77 +1,53 @@ #ifndef APPLICATION_H #define APPLICATION_H -#include <GCF/GCF_Task.h> +#include <GCF/TM/GCF_Task.h> #include "SupervisedTask.h" -#include <GCF/GCF_MyPropertySet.h> -#include <GCF/GCF_Apc.h> +#include <GCF/PAL/GCF_MyPropertySet.h> +#include <GCF/PAL/GCF_ExtPropertySet.h> +#include <Suite/test.h> class GCFEvent; class GCFPortInterface; -class Application : public GCFTask +class Application : public GCFTask , public Test { public: Application(); + void run(); private: GCFEvent::TResult initial(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test101(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test102(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test103(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test104(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test105(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test201(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test202(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test203(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test204(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test205(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test206(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test207(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test208(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test209(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test210(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test301(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test302(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test303(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test304(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test305(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test306(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test401(GCFEvent& e, GCFPortInterface& p); - GCFEvent::TResult test402(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test1_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test1_2(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test2_5(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test3_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test3_2(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test3_3(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test4_1(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test4_2(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test4_3(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test4_4(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult test5_3(GCFEvent& e, GCFPortInterface& p); + GCFEvent::TResult finished(GCFEvent& e, GCFPortInterface& p); - void passed(unsigned int passedTest) - { - cerr << "Test " << passedTest << " passed\n"; - _passed++; - } - void failed(unsigned int failedTest) - { - cerr << "Test " << failedTest << " failed\n"; - _failed++; - } - void skipped(unsigned int skippedTest) - { - cerr << "Nothing to do in test " << skippedTest << " => skipped\n"; - } - private: - SupervisedTask _supTask3; - unsigned char _passed; - unsigned char _failed; + Task _supTask3; unsigned int _counter; + GCFTCPPort _port; unsigned int _curRemoteTestNr; + GCFTCPPort* _pSTPort1; GCFTCPPort* _pSTPort2; + GCFMyPropertySet _propertySetC1; GCFMyPropertySet _propertySetD1; GCFMyPropertySet _propertySetB4; - GCFApc _apcT1; - GCFApc _apcT1K; - GCFApc _apcT1a; - GCFApc _apcT1b; - GCFApc _apcT3; + + GCFExtPropertySet _ePropertySetAC; + GCFExtPropertySet _ePropertySetAH; + GCFExtPropertySet _ePropertySetAK; }; #endif diff --git a/MAC/Test/GCF/src/Defines.h b/MAC/Test/GCF/src/Defines.h index aa43d34bc30..8a8eb3496cc 100644 --- a/MAC/Test/GCF/src/Defines.h +++ b/MAC/Test/GCF/src/Defines.h @@ -1,8 +1,44 @@ #include <GCF/GCF_Defines.h> -#include <GCF/GCF_PValue.h> //#define WAIT_FOR_INPUT +#ifdef WAIT_FOR_INPUT +#define CHECK_DB \ + { \ + string input; \ + cout << "Check SCADA DB content: "; \ + cin >> input; \ + } +#else +#define CHECK_DB {} +#endif + +#define NEXT_TEST(_test_) \ +{ \ + reportSubTest(); \ + setCurSubTest(#_test_); \ + TRAN(Application::test##_test_); \ +} + +#define FAIL_AND_NEXT_TEST(_txt_, _test_) \ +{ \ + FAIL(_txt_); \ + NEXT_TEST(_test_); \ +} + +#define FAIL_AND_DONE(_txt_) \ +{ \ + FAIL(_txt_); \ + reportSubTest(); \ + TRAN(Application::finished); \ +} + +#define FINISHED \ +{ \ + reportSubTest(); \ + TRAN(Application::finished); \ +} + #define GCF_READWRITE_PROP (GCF_READABLE_PROP | GCF_WRITABLE_PROP) // property sets @@ -10,15 +46,15 @@ const TProperty propertiesSA1[] = { - {"F_P4", GCFPValue::LPT_INTEGER, GCF_READWRITE_PROP, "10"}, - {"F_P5", GCFPValue::LPT_CHAR, GCF_READWRITE_PROP, "20"}, - {"G_P6", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "12.1"}, - {"G_P7", GCFPValue::LPT_STRING, GCF_READWRITE_PROP, "geit"}, + {"F_P4", LPT_INTEGER, GCF_READWRITE_PROP, "10"}, + {"F_P5", LPT_CHAR, GCF_READWRITE_PROP, "20"}, + {"G_P6", LPT_DOUBLE, GCF_READWRITE_PROP, "12.1"}, + {"G_P7", LPT_STRING, GCF_READWRITE_PROP, "geit"}, }; const TPropertySet propertySetA1 = { - 4, "A_B", propertiesSA1 + "TTypeA", true, 4, propertiesSA1 }; // PropertySetA1: end @@ -27,14 +63,14 @@ const TPropertySet propertySetA1 = const TProperty propertiesSB1[] = { - {"P1", GCFPValue::LPT_INTEGER, GCF_READWRITE_PROP, "11"}, - {"P2", GCFPValue::LPT_CHAR, GCF_READWRITE_PROP, "25"}, - {"P3", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "33.3"}, + {"P1", LPT_INTEGER, GCF_READWRITE_PROP, "11"}, + {"P2", LPT_CHAR, GCF_READWRITE_PROP, "25"}, + {"P3", LPT_DOUBLE, GCF_READWRITE_PROP, "33.3"}, }; const TPropertySet propertySetB1 = { - 3, "A_C", propertiesSB1 + "TTypeB", true, 3, propertiesSB1 }; // PropertySetB1: end @@ -43,14 +79,14 @@ const TPropertySet propertySetB1 = const TProperty propertiesSB2[] = { - {"P1", GCFPValue::LPT_INTEGER, GCF_READWRITE_PROP, "12"}, - {"P2", GCFPValue::LPT_CHAR, GCF_READWRITE_PROP, "26"}, - {"P3", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "34.3"}, + {"P1", LPT_INTEGER, GCF_READWRITE_PROP, "12"}, + {"P2", LPT_CHAR, GCF_READWRITE_PROP, "26"}, + {"P3", LPT_DOUBLE, GCF_READWRITE_PROP, "34.3"}, }; const TPropertySet propertySetB2 = { - 3, "A_D", propertiesSB2 + "TTypeB", true, 3, propertiesSB2 }; // PropertySetB2: end @@ -59,14 +95,14 @@ const TPropertySet propertySetB2 = const TProperty propertiesSB3[] = { - {"P1", GCFPValue::LPT_INTEGER, GCF_READWRITE_PROP, "13"}, - {"P2", GCFPValue::LPT_CHAR, GCF_READWRITE_PROP, "27"}, - {"P3", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "35.3"}, + {"P1", LPT_INTEGER, GCF_READWRITE_PROP, "13"}, + {"P2", LPT_CHAR, GCF_READWRITE_PROP, "27"}, + {"P3", LPT_DOUBLE, GCF_READWRITE_PROP, "35.3"}, }; const TPropertySet propertySetB3 = { - 3, "A_E", propertiesSB3 + "TTypeB", true, 3, propertiesSB3 }; // PropertySetB3: end @@ -76,14 +112,14 @@ const TPropertySet propertySetB3 = const TProperty propertiesSB4[] = { - {"P1", GCFPValue::LPT_INTEGER, GCF_READWRITE_PROP, "14"}, - {"P2", GCFPValue::LPT_CHAR, GCF_READWRITE_PROP, "28"}, - {"P3", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "36.3"}, + {"P1", LPT_INTEGER, GCF_READWRITE_PROP, "14"}, + {"P2", LPT_CHAR, GCF_READWRITE_PROP, "28"}, + {"P3", LPT_DOUBLE, GCF_READWRITE_PROP, "36.3"}, }; const TPropertySet propertySetB4 = { - 3, "A_K", propertiesSB4 + "TTypeB", false, 3, propertiesSB4 }; // PropertySetB4: end @@ -92,13 +128,13 @@ const TPropertySet propertySetB4 = const TProperty propertiesSC1[] = { - {"P8", GCFPValue::LPT_STRING, GCF_READWRITE_PROP, "aap"}, - {"P9", GCFPValue::LPT_STRING, GCF_READWRITE_PROP, "noot"}, + {"P8", LPT_STRING, GCF_READWRITE_PROP, "aap"}, + {"P9", LPT_STRING, GCF_READWRITE_PROP, "noot"}, }; const TPropertySet propertySetC1 = { - 2, "A_H_I", propertiesSC1 + "TTypeC", true, 2, propertiesSC1 }; // PropertySetC1: end @@ -107,111 +143,111 @@ const TPropertySet propertySetC1 = const TProperty propertiesSD1[] = { - {"J_P00", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.00"}, - {"J_P01", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.01"}, - {"J_P02", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.02"}, - {"J_P03", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.03"}, - {"J_P04", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.04"}, - {"J_P05", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.05"}, - {"J_P06", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.06"}, - {"J_P07", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.07"}, - {"J_P08", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.08"}, - {"J_P09", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.09"}, - {"J_P10", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.00"}, - {"J_P11", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.11"}, - {"J_P12", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.12"}, - {"J_P13", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.13"}, - {"J_P14", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.14"}, - {"J_P15", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.15"}, - {"J_P16", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.16"}, - {"J_P17", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.17"}, - {"J_P18", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.18"}, - {"J_P19", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.19"}, - {"J_P20", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.20"}, - {"J_P21", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.21"}, - {"J_P22", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.22"}, - {"J_P23", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.23"}, - {"J_P24", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.24"}, - {"J_P25", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.25"}, - {"J_P26", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.26"}, - {"J_P27", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.27"}, - {"J_P28", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.28"}, - {"J_P29", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.29"}, - {"J_P30", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.30"}, - {"J_P31", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.31"}, - {"J_P32", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.32"}, - {"J_P33", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.33"}, - {"J_P34", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.34"}, - {"J_P35", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.35"}, - {"J_P36", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.36"}, - {"J_P37", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.37"}, - {"J_P38", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.38"}, - {"J_P39", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.39"}, - {"J_P40", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.40"}, - {"J_P41", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.41"}, - {"J_P42", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.42"}, - {"J_P43", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.43"}, - {"J_P44", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.44"}, - {"J_P45", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.45"}, - {"J_P46", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.46"}, - {"J_P47", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.47"}, - {"J_P48", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.48"}, - {"J_P49", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.49"}, - {"J_P50", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.50"}, - {"J_P51", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.51"}, - {"J_P52", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.52"}, - {"J_P53", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.53"}, - {"J_P54", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.54"}, - {"J_P55", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.55"}, - {"J_P56", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.56"}, - {"J_P57", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.57"}, - {"J_P58", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.58"}, - {"J_P59", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.59"}, - {"J_P60", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.60"}, - {"J_P61", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.61"}, - {"J_P62", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.62"}, - {"J_P63", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.63"}, - {"J_P64", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.64"}, - {"J_P65", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.65"}, - {"J_P66", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.66"}, - {"J_P67", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.67"}, - {"J_P68", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.68"}, - {"J_P69", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.69"}, - {"J_P70", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.70"}, - {"J_P71", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.71"}, - {"J_P72", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.72"}, - {"J_P73", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.73"}, - {"J_P74", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.74"}, - {"J_P75", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.75"}, - {"J_P76", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.76"}, - {"J_P77", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.77"}, - {"J_P78", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.78"}, - {"J_P79", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.79"}, - {"J_P80", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.80"}, - {"J_P81", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.81"}, - {"J_P82", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.82"}, - {"J_P83", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.83"}, - {"J_P84", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.84"}, - {"J_P85", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.85"}, - {"J_P86", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.86"}, - {"J_P87", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.87"}, - {"J_P88", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.88"}, - {"J_P89", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.89"}, - {"J_P90", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.90"}, - {"J_P91", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.91"}, - {"J_P92", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.92"}, - {"J_P93", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.93"}, - {"J_P94", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.94"}, - {"J_P95", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.95"}, - {"J_P96", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.96"}, - {"J_P97", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.97"}, - {"J_P98", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.98"}, - {"J_P99", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "10.99"}, + {"J.P00", LPT_DOUBLE, GCF_READWRITE_PROP, "10.00"}, + {"J.P01", LPT_DOUBLE, GCF_READWRITE_PROP, "10.01"}, + {"J.P02", LPT_DOUBLE, GCF_READWRITE_PROP, "10.02"}, + {"J.P03", LPT_DOUBLE, GCF_READWRITE_PROP, "10.03"}, + {"J.P04", LPT_DOUBLE, GCF_READWRITE_PROP, "10.04"}, + {"J.P05", LPT_DOUBLE, GCF_READWRITE_PROP, "10.05"}, + {"J.P06", LPT_DOUBLE, GCF_READWRITE_PROP, "10.06"}, + {"J.P07", LPT_DOUBLE, GCF_READWRITE_PROP, "10.07"}, + {"J.P08", LPT_DOUBLE, GCF_READWRITE_PROP, "10.08"}, + {"J.P09", LPT_DOUBLE, GCF_READWRITE_PROP, "10.09"}, + {"J.P10", LPT_DOUBLE, GCF_READWRITE_PROP, "10.00"}, + {"J.P11", LPT_DOUBLE, GCF_READWRITE_PROP, "10.11"}, + {"J.P12", LPT_DOUBLE, GCF_READWRITE_PROP, "10.12"}, + {"J.P13", LPT_DOUBLE, GCF_READWRITE_PROP, "10.13"}, + {"J.P14", LPT_DOUBLE, GCF_READWRITE_PROP, "10.14"}, + {"J.P15", LPT_DOUBLE, GCF_READWRITE_PROP, "10.15"}, + {"J.P16", LPT_DOUBLE, GCF_READWRITE_PROP, "10.16"}, + {"J.P17", LPT_DOUBLE, GCF_READWRITE_PROP, "10.17"}, + {"J.P18", LPT_DOUBLE, GCF_READWRITE_PROP, "10.18"}, + {"J.P19", LPT_DOUBLE, GCF_READWRITE_PROP, "10.19"}, + {"J.P20", LPT_DOUBLE, GCF_READWRITE_PROP, "10.20"}, + {"J.P21", LPT_DOUBLE, GCF_READWRITE_PROP, "10.21"}, + {"J.P22", LPT_DOUBLE, GCF_READWRITE_PROP, "10.22"}, + {"J.P23", LPT_DOUBLE, GCF_READWRITE_PROP, "10.23"}, + {"J.P24", LPT_DOUBLE, GCF_READWRITE_PROP, "10.24"}, + {"J.P25", LPT_DOUBLE, GCF_READWRITE_PROP, "10.25"}, + {"J.P26", LPT_DOUBLE, GCF_READWRITE_PROP, "10.26"}, + {"J.P27", LPT_DOUBLE, GCF_READWRITE_PROP, "10.27"}, + {"J.P28", LPT_DOUBLE, GCF_READWRITE_PROP, "10.28"}, + {"J.P29", LPT_DOUBLE, GCF_READWRITE_PROP, "10.29"}, + {"J.P30", LPT_DOUBLE, GCF_READWRITE_PROP, "10.30"}, + {"J.P31", LPT_DOUBLE, GCF_READWRITE_PROP, "10.31"}, + {"J.P32", LPT_DOUBLE, GCF_READWRITE_PROP, "10.32"}, + {"J.P33", LPT_DOUBLE, GCF_READWRITE_PROP, "10.33"}, + {"J.P34", LPT_DOUBLE, GCF_READWRITE_PROP, "10.34"}, + {"J.P35", LPT_DOUBLE, GCF_READWRITE_PROP, "10.35"}, + {"J.P36", LPT_DOUBLE, GCF_READWRITE_PROP, "10.36"}, + {"J.P37", LPT_DOUBLE, GCF_READWRITE_PROP, "10.37"}, + {"J.P38", LPT_DOUBLE, GCF_READWRITE_PROP, "10.38"}, + {"J.P39", LPT_DOUBLE, GCF_READWRITE_PROP, "10.39"}, + {"J.P40", LPT_DOUBLE, GCF_READWRITE_PROP, "10.40"}, + {"J.P41", LPT_DOUBLE, GCF_READWRITE_PROP, "10.41"}, + {"J.P42", LPT_DOUBLE, GCF_READWRITE_PROP, "10.42"}, + {"J.P43", LPT_DOUBLE, GCF_READWRITE_PROP, "10.43"}, + {"J.P44", LPT_DOUBLE, GCF_READWRITE_PROP, "10.44"}, + {"J.P45", LPT_DOUBLE, GCF_READWRITE_PROP, "10.45"}, + {"J.P46", LPT_DOUBLE, GCF_READWRITE_PROP, "10.46"}, + {"J.P47", LPT_DOUBLE, GCF_READWRITE_PROP, "10.47"}, + {"J.P48", LPT_DOUBLE, GCF_READWRITE_PROP, "10.48"}, + {"J.P49", LPT_DOUBLE, GCF_READWRITE_PROP, "10.49"}, + {"J.P50", LPT_DOUBLE, GCF_READWRITE_PROP, "10.50"}, + {"J.P51", LPT_DOUBLE, GCF_READWRITE_PROP, "10.51"}, + {"J.P52", LPT_DOUBLE, GCF_READWRITE_PROP, "10.52"}, + {"J.P53", LPT_DOUBLE, GCF_READWRITE_PROP, "10.53"}, + {"J.P54", LPT_DOUBLE, GCF_READWRITE_PROP, "10.54"}, + {"J.P55", LPT_DOUBLE, GCF_READWRITE_PROP, "10.55"}, + {"J.P56", LPT_DOUBLE, GCF_READWRITE_PROP, "10.56"}, + {"J.P57", LPT_DOUBLE, GCF_READWRITE_PROP, "10.57"}, + {"J.P58", LPT_DOUBLE, GCF_READWRITE_PROP, "10.58"}, + {"J.P59", LPT_DOUBLE, GCF_READWRITE_PROP, "10.59"}, + {"J.P60", LPT_DOUBLE, GCF_READWRITE_PROP, "10.60"}, + {"J.P61", LPT_DOUBLE, GCF_READWRITE_PROP, "10.61"}, + {"J.P62", LPT_DOUBLE, GCF_READWRITE_PROP, "10.62"}, + {"J.P63", LPT_DOUBLE, GCF_READWRITE_PROP, "10.63"}, + {"J.P64", LPT_DOUBLE, GCF_READWRITE_PROP, "10.64"}, + {"J.P65", LPT_DOUBLE, GCF_READWRITE_PROP, "10.65"}, + {"J.P66", LPT_DOUBLE, GCF_READWRITE_PROP, "10.66"}, + {"J.P67", LPT_DOUBLE, GCF_READWRITE_PROP, "10.67"}, + {"J.P68", LPT_DOUBLE, GCF_READWRITE_PROP, "10.68"}, + {"J.P69", LPT_DOUBLE, GCF_READWRITE_PROP, "10.69"}, + {"J.P70", LPT_DOUBLE, GCF_READWRITE_PROP, "10.70"}, + {"J.P71", LPT_DOUBLE, GCF_READWRITE_PROP, "10.71"}, + {"J.P72", LPT_DOUBLE, GCF_READWRITE_PROP, "10.72"}, + {"J.P73", LPT_DOUBLE, GCF_READWRITE_PROP, "10.73"}, + {"J.P74", LPT_DOUBLE, GCF_READWRITE_PROP, "10.74"}, + {"J.P75", LPT_DOUBLE, GCF_READWRITE_PROP, "10.75"}, + {"J.P76", LPT_DOUBLE, GCF_READWRITE_PROP, "10.76"}, + {"J.P77", LPT_DOUBLE, GCF_READWRITE_PROP, "10.77"}, + {"J.P78", LPT_DOUBLE, GCF_READWRITE_PROP, "10.78"}, + {"J.P79", LPT_DOUBLE, GCF_READWRITE_PROP, "10.79"}, + {"J.P80", LPT_DOUBLE, GCF_READWRITE_PROP, "10.80"}, + {"J.P81", LPT_DOUBLE, GCF_READWRITE_PROP, "10.81"}, + {"J.P82", LPT_DOUBLE, GCF_READWRITE_PROP, "10.82"}, + {"J.P83", LPT_DOUBLE, GCF_READWRITE_PROP, "10.83"}, + {"J.P84", LPT_DOUBLE, GCF_READWRITE_PROP, "10.84"}, + {"J.P85", LPT_DOUBLE, GCF_READWRITE_PROP, "10.85"}, + {"J.P86", LPT_DOUBLE, GCF_READWRITE_PROP, "10.86"}, + {"J.P87", LPT_DOUBLE, GCF_READWRITE_PROP, "10.87"}, + {"J.P88", LPT_DOUBLE, GCF_READWRITE_PROP, "10.88"}, + {"J.P89", LPT_DOUBLE, GCF_READWRITE_PROP, "10.89"}, + {"J.P90", LPT_DOUBLE, GCF_READWRITE_PROP, "10.90"}, + {"J.P91", LPT_DOUBLE, GCF_READWRITE_PROP, "10.91"}, + {"J.P92", LPT_DOUBLE, GCF_READWRITE_PROP, "10.92"}, + {"J.P93", LPT_DOUBLE, GCF_READWRITE_PROP, "10.93"}, + {"J.P94", LPT_DOUBLE, GCF_READWRITE_PROP, "10.94"}, + {"J.P95", LPT_DOUBLE, GCF_READWRITE_PROP, "10.95"}, + {"J.P96", LPT_DOUBLE, GCF_READWRITE_PROP, "10.96"}, + {"J.P97", LPT_DOUBLE, GCF_READWRITE_PROP, "10.97"}, + {"J.P98", LPT_DOUBLE, GCF_READWRITE_PROP, "10.98"}, + {"J.P99", LPT_DOUBLE, GCF_READWRITE_PROP, "10.99"}, }; const TPropertySet propertySetD1 = { - 100, "A_H", propertiesSD1 + "TTypeD", true, 100, propertiesSD1 }; // PropertySetD1: end @@ -220,17 +256,17 @@ const TPropertySet propertySetD1 = const TProperty propertiesSE1[] = { - {"P1", GCFPValue::LPT_CHAR, GCF_READWRITE_PROP, "11"}, - {"P2", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "25"}, - {"P3", GCFPValue::LPT_STRING, GCF_READWRITE_PROP, "33.3"}, - {"P4", GCFPValue::LPT_DOUBLE, GCF_READWRITE_PROP, "11"}, - {"P5", GCFPValue::LPT_INTEGER, GCF_READWRITE_PROP, "25"}, - {"P6", GCFPValue::LPT_UNSIGNED, GCF_READWRITE_PROP, "33.3"}, + {"P1", LPT_CHAR, GCF_READWRITE_PROP, "11"}, + {"P2", LPT_DOUBLE, GCF_READWRITE_PROP, "25"}, + {"P3", LPT_STRING, GCF_READWRITE_PROP, "33.3"}, + {"P4", LPT_DOUBLE, GCF_READWRITE_PROP, "11"}, + {"P5", LPT_INTEGER, GCF_READWRITE_PROP, "25"}, + {"P6", LPT_UNSIGNED, GCF_READWRITE_PROP, "33.3"}, }; const TPropertySet propertySetE1 = { - 6, "A_L", propertiesSE1 + "TTypeE", false, 6, propertiesSE1 }; -// PropertySetA1: end +// PropertySetE1: end diff --git a/MAC/Test/GCF/src/Makefile.am b/MAC/Test/GCF/src/Makefile.am index e6259ab8612..43b6468832d 100644 --- a/MAC/Test/GCF/src/Makefile.am +++ b/MAC/Test/GCF/src/Makefile.am @@ -14,7 +14,7 @@ libgcfrttest_la_DOCHDRS = \ RTAnswer.h \ RTDefines.h -noinst_LTLIBRARIES = libgcftest.la libgcfrttest.la +noinst_LTLIBRARIES = libgcftest.la #libgcfrttest.la libgcftest_la_SOURCES= $(libgcftest_la_DOCHDRS) \ SupervisedTask.cc \ @@ -26,7 +26,7 @@ libgcfrttest_la_SOURCES= $(libgcfrttest_la_DOCHDRS) \ RTAnswer.cc \ Echo_Protocol.cc -bin_PROGRAMS = Application1 Application2 RTEcho RTPing +bin_PROGRAMS = Application1 Application2 #RTEcho RTPing Application1_SOURCES = Application1.cc Application1_LDADD = libgcftest.la @@ -62,8 +62,7 @@ EXTRA_DIST = \ configfilesdir=$(bindir) configfiles_DATA= \ test.ns \ - test.top \ - log4cplus.properties + test.top %.properties: $(MAC_CONFIG)/%.properties cp $< $@ diff --git a/MAC/Test/GCF/src/PropertyProxy.h b/MAC/Test/GCF/src/PropertyProxy.h index adadf1da85e..3558dcf0a28 100644 --- a/MAC/Test/GCF/src/PropertyProxy.h +++ b/MAC/Test/GCF/src/PropertyProxy.h @@ -23,14 +23,14 @@ #ifndef PROPERTYPROXY_H #define PROPERTYPROXY_H -#include <GCF/GCF_PropertyProxy.h> +#include <GCF/PAL/GCF_PropertyProxy.h> -class SupervisedTask; +class Task; class PropertyProxy : public GCFPropertyProxy { public: - PropertyProxy(SupervisedTask& task) : _task(task) {}; + PropertyProxy(Task& task) : _task(task) {}; virtual ~PropertyProxy() {}; protected: @@ -41,6 +41,6 @@ class PropertyProxy : public GCFPropertyProxy void propValueChanged(const string& propName, const GCFPValue& value); private: - SupervisedTask& _task; + Task& _task; }; #endif diff --git a/MAC/Test/GCF/src/RTAnswer.cc b/MAC/Test/GCF/src/RTAnswer.cc index 4ae14ddf7da..abf9a2c7c3c 100644 --- a/MAC/Test/GCF/src/RTAnswer.cc +++ b/MAC/Test/GCF/src/RTAnswer.cc @@ -1,5 +1,5 @@ #include "RTAnswer.h" -#include <GCF/GCF_Task.h> +#include <GCF/TM/GCF_Task.h> void Answer::handleAnswer(GCFEvent& answer) { diff --git a/MAC/Test/GCF/src/SupervisedTask.cc b/MAC/Test/GCF/src/SupervisedTask.cc index 4b449a8ed97..b37b4017110 100644 --- a/MAC/Test/GCF/src/SupervisedTask.cc +++ b/MAC/Test/GCF/src/SupervisedTask.cc @@ -1,9 +1,9 @@ #include "SupervisedTask.h" -#include <GCF/GCF_Answer.h> +#include <GCF/PAL/GCF_Answer.h> #include "TST_Protocol.ph" -SupervisedTask::SupervisedTask(GCFTask& a, string taskName) : - GCFTask((State)&SupervisedTask::initial, taskName), +Task::Task(GCFTask& a, string taskName) : + GCFTask((State)&Task::initial, taskName), _application(a), _proxy(*this), _answer(*this) @@ -14,30 +14,30 @@ SupervisedTask::SupervisedTask(GCFTask& a, string taskName) : registerProtocol(TST_PROTOCOL, TST_PROTOCOL_signalnames); } -SupervisedTask::~SupervisedTask() +Task::~Task() { } -int SupervisedTask::initial(GCFEvent& e, GCFPortInterface& p) +int Task::initial(GCFEvent& e, GCFPortInterface& p) { return _application.dispatch(e, p); } -void SupervisedTask::propSubscribed(const string& propName) +void Task::propSubscribed(const string& propName) { GCFPropAnswerEvent e(F_SUBSCRIBED); e.pPropName = propName.c_str(); _application.dispatch(e, _port); } -void SupervisedTask::propUnsubscribed(const string& propName) +void Task::propUnsubscribed(const string& propName) { GCFPropAnswerEvent e(F_UNSUBSCRIBED); e.pPropName = propName.c_str(); _application.dispatch(e, _port); } -void SupervisedTask::propValueChanged(const string& propName, const GCFPValue& value) +void Task::propValueChanged(const string& propName, const GCFPValue& value) { GCFPropValueEvent e(F_VCHANGEMSG); e.pValue = &value; @@ -46,7 +46,7 @@ void SupervisedTask::propValueChanged(const string& propName, const GCFPValue& v _application.dispatch(e, _port); } -void SupervisedTask::valueGet(const string& propName, const GCFPValue& value) +void Task::valueGet(const string& propName, const GCFPValue& value) { GCFPropValueEvent e(F_VGETRESP); e.pValue = &value; diff --git a/MAC/Test/GCF/src/SupervisedTask.h b/MAC/Test/GCF/src/SupervisedTask.h index 8f0cb1b4962..57decc86837 100644 --- a/MAC/Test/GCF/src/SupervisedTask.h +++ b/MAC/Test/GCF/src/SupervisedTask.h @@ -1,19 +1,19 @@ -#ifndef SUPERVISEDTASK_H -#define SUPERVISEDTASK_H +#ifndef TASK_H +#define TASK_H -#include <GCF/GCF_Task.h> -#include <GCF/GCF_TCPPort.h> -#include <GCF/GCF_TMProtocols.h> +#include <GCF/TM/GCF_Task.h> +#include <GCF/TM/GCF_TCPPort.h> +#include <GCF/TM/GCF_Protocols.h> #include <GCF/GCF_Defines.h> #include "PropertyProxy.h" #include "Answer.h" #include <Common/lofar_iostream.h> -class SupervisedTask : public GCFTask +class Task : public GCFTask { public: - SupervisedTask(GCFTask& a, string taskName); - ~SupervisedTask(); + Task(GCFTask& a, string taskName); + ~Task(); inline GCFTCPPort& getPort() {return _port;} inline PropertyProxy& getProxy() {return _proxy;} -- GitLab