karabo.bound 2.21.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. karabo/__init__.py +1 -0
  2. karabo/_version.py +1 -0
  3. karabo/bound/__init__.py +109 -0
  4. karabo/bound/base_fsm.py +104 -0
  5. karabo/bound/camera_fsm.py +231 -0
  6. karabo/bound/configurator.py +259 -0
  7. karabo/bound/decorators.py +147 -0
  8. karabo/bound/device.py +1933 -0
  9. karabo/bound/device_client.py +43 -0
  10. karabo/bound/device_runner.py +88 -0
  11. karabo/bound/device_server.py +816 -0
  12. karabo/bound/fsm.py +469 -0
  13. karabo/bound/launcher.py +121 -0
  14. karabo/bound/no_fsm.py +54 -0
  15. karabo/bound/ok_error_fsm.py +106 -0
  16. karabo/bound/plugin_loader.py +70 -0
  17. karabo/bound/runner.py +196 -0
  18. karabo/bound/server_entry_point.py +36 -0
  19. karabo/bound/start_stop_fsm.py +155 -0
  20. karabo/bound/start_stop_fsm_periodic.py +169 -0
  21. karabo/bound/testing/__init__.py +4 -0
  22. karabo/bound/testing/eventloop.py +19 -0
  23. karabo/bound/testing/server_context.py +81 -0
  24. karabo/bound/testing/utils.py +216 -0
  25. karabo/bound/tests/__init__.py +15 -0
  26. karabo/bound/tests/api_module_test.py +42 -0
  27. karabo/bound/tests/binding/__init__.py +15 -0
  28. karabo/bound/tests/binding/test_attributes.py +245 -0
  29. karabo/bound/tests/binding/test_eventloop.py +106 -0
  30. karabo/bound/tests/binding/test_hash.py +979 -0
  31. karabo/bound/tests/binding/test_hash_attributes.py +156 -0
  32. karabo/bound/tests/binding/test_hash_attributes_node.py +335 -0
  33. karabo/bound/tests/binding/test_hash_node.py +200 -0
  34. karabo/bound/tests/binding/test_hashfilter.py +429 -0
  35. karabo/bound/tests/binding/test_imagedata.py +192 -0
  36. karabo/bound/tests/binding/test_json_parsing_for_init_string.py +43 -0
  37. karabo/bound/tests/binding/test_karabo_io.py +148 -0
  38. karabo/bound/tests/binding/test_logging_api.py +131 -0
  39. karabo/bound/tests/binding/test_ndarray_io.py +56 -0
  40. karabo/bound/tests/binding/test_pipeline_api.py +741 -0
  41. karabo/bound/tests/binding/test_pipeline_utils.py +72 -0
  42. karabo/bound/tests/binding/test_schema_api.py +1224 -0
  43. karabo/bound/tests/binding/test_schema_elements.py +2016 -0
  44. karabo/bound/tests/binding/test_schema_nodeelement.py +145 -0
  45. karabo/bound/tests/binding/test_sigslot.py +921 -0
  46. karabo/bound/tests/binding/test_tcp.py +679 -0
  47. karabo/bound/tests/binding/test_zcore_device_client.py +256 -0
  48. karabo/bound/tests/binding/test_zcore_device_client2.py +416 -0
  49. karabo/bound/tests/boundDevice.py +350 -0
  50. karabo/bound/tests/brokenBoundDevice.py +30 -0
  51. karabo/bound/tests/camera_fsm_test.py +126 -0
  52. karabo/bound/tests/configuration_example_classes.py +923 -0
  53. karabo/bound/tests/context_test.py +29 -0
  54. karabo/bound/tests/decorators_test.py +168 -0
  55. karabo/bound/tests/hash_test.py +1286 -0
  56. karabo/bound/tests/hashfilter_test.py +226 -0
  57. karabo/bound/tests/hvmachine_test.py +211 -0
  58. karabo/bound/tests/imagedata_test.py +207 -0
  59. karabo/bound/tests/io_test.py +95 -0
  60. karabo/bound/tests/metadata_test.py +55 -0
  61. karabo/bound/tests/ok_error_fsm_test.py +81 -0
  62. karabo/bound/tests/old/__init__.py +15 -0
  63. karabo/bound/tests/old/test_attributes.py +70 -0
  64. karabo/bound/tests/old/test_constructors.py +83 -0
  65. karabo/bound/tests/old/test_find.py +40 -0
  66. karabo/bound/tests/old/test_getAs.py +67 -0
  67. karabo/bound/tests/old/test_getSet.py +115 -0
  68. karabo/bound/tests/old/test_iteration.py +165 -0
  69. karabo/bound/tests/old/test_merge.py +49 -0
  70. karabo/bound/tests/pluginloader_test.py +33 -0
  71. karabo/bound/tests/resources/european-xfel-logo-greyscales.tif +0 -0
  72. karabo/bound/tests/resources/image_0001.raw +0 -0
  73. karabo/bound/tests/resources/image_0001A.png +0 -0
  74. karabo/bound/tests/resources/image_0001B.png +0 -0
  75. karabo/bound/tests/resources/in-3-3-3.asc +12 -0
  76. karabo/bound/tests/runner_test.py +145 -0
  77. karabo/bound/tests/schema_adler_test.py +48 -0
  78. karabo/bound/tests/schema_test.py +1177 -0
  79. karabo/bound/tests/serializer_test.py +116 -0
  80. karabo/bound/tests/signal_slotable_test.py +121 -0
  81. karabo/bound/tests/start_stop_fsm_test.py +99 -0
  82. karabo/bound/tests/statistical_evaluator_test.py +78 -0
  83. karabo/bound/tests/timestamp_test.py +386 -0
  84. karabo/bound/worker.py +188 -0
  85. karabo/bound_devices/__init__.py +15 -0
  86. karabo/bound_devices/property_test.py +696 -0
  87. karabo/bound_devices/tests/__init__.py +15 -0
  88. karabo/version.py +1 -0
  89. karabo_bound-2.21.3.dist-info/METADATA +71 -0
  90. karabo_bound-2.21.3.dist-info/RECORD +94 -0
  91. karabo_bound-2.21.3.dist-info/WHEEL +5 -0
  92. karabo_bound-2.21.3.dist-info/entry_points.txt +5 -0
  93. karabo_bound-2.21.3.dist-info/licenses/LICENSE.md +355 -0
  94. karabo_bound-2.21.3.dist-info/top_level.txt +1 -0
karabo/__init__.py ADDED
@@ -0,0 +1 @@
1
+ __version__ = '2.21.3'
karabo/_version.py ADDED
@@ -0,0 +1 @@
1
+ version = '2.21.3'
@@ -0,0 +1,109 @@
1
+ # This file is part of Karabo.
2
+ #
3
+ # http://www.karabo.eu
4
+ #
5
+ # Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
6
+ #
7
+ # Karabo is free software: you can redistribute it and/or modify it under
8
+ # the terms of the MPL-2 Mozilla Public License.
9
+ #
10
+ # You should have received a copy of the MPL-2 Public License along with
11
+ # Karabo. If not, see <https://www.mozilla.org/en-US/MPL/2.0/>.
12
+ #
13
+ # Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
14
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
+ # FITNESS FOR A PARTICULAR PURPOSE.
16
+ # flake8: noqa: F401
17
+ from karabind import (
18
+ ADMIN, ALARM_ELEMENT, AMPERE, AMPERE_PER_SECOND, ATTO, ATTOSEC, BAR, BAYER,
19
+ BECQUEREL, BGR, BGRA, BIT, BMP, BOOL_ELEMENT, BYTE, BYTEARRAY_ELEMENT,
20
+ CANDELA, CENTI, CHOICE_ELEMENT, CHOICE_OF_NODES, CMYK, COMMAND, COULOMB,
21
+ COUNT, DAY, DECA, DECI, DEGREE, DEGREE_CELSIUS, DOUBLE_ELEMENT,
22
+ ELECTRONVOLT, EVERY_1MIN, EVERY_1S, EVERY_5S, EVERY_10MIN, EVERY_10S,
23
+ EVERY_100MS, EVERY_EVENT, EXA, EXPERT, FARAD, FEMTO, FEMTOSEC,
24
+ FLOAT_ELEMENT, GIGA, GRAM, GRAY, HECTO, HENRY, HERTZ, HOUR,
25
+ IMAGEDATA_ELEMENT, INIT, INPUT_CHANNEL, INPUT_ELEMENT, INT32_ELEMENT,
26
+ INT64_ELEMENT, INTERNAL, JOULE, JPEG, KATAL, KELVIN, KILO, LEAF,
27
+ LIST_ELEMENT, LIST_OF_NODES, LUMEN, LUX, MANDATORY, MEGA, METER,
28
+ METER_PER_SECOND, MICRO, MICROSEC, MILLI, MILLISEC, MINUTE, MOLE, NANO,
29
+ NANOSEC, NDARRAY_ELEMENT, NEWTON, NO_ARCHIVING, NODE, NODE_ELEMENT, NONE,
30
+ NOT_ASSIGNED, NUMBER, OBSERVER, OHM, ONESECOND, OPERATOR, OPTIONAL,
31
+ OUTPUT_CHANNEL, OUTPUT_ELEMENT, OVERWRITE_ELEMENT, PASCAL, PATH_ELEMENT,
32
+ PERCENT, PETA, PICO, PICOSEC, PIXEL, PNG, PROPERTY, RADIAN, READ, RGB,
33
+ RGBA, SECOND, SIEMENS, SIEVERT, SLOT_ELEMENT, STATE_ELEMENT, STERADIAN,
34
+ STRING_ELEMENT, TABLE_ELEMENT, TERA, TESLA, TIFF, TIME_UNITS,
35
+ UINT32_ELEMENT, UINT64_ELEMENT, UNDEFINED, USER, VECTOR_BOOL_ELEMENT,
36
+ VECTOR_CHAR_ELEMENT, VECTOR_DOUBLE_ELEMENT, VECTOR_FLOAT_ELEMENT,
37
+ VECTOR_INT32_ELEMENT, VECTOR_INT64_ELEMENT, VECTOR_STRING,
38
+ VECTOR_STRING_ELEMENT, VECTOR_UINT32_ELEMENT, VECTOR_UINT64_ELEMENT, VOLT,
39
+ VOLT_PER_SECOND, WATT, WEBER, WRITE, YEAR, YOCTO, YOTTA, YUV, ZEPTO, ZETTA,
40
+ AccessLevel, AccessType, ArchivePolicy, AssemblyRules, AssignmentType,
41
+ BinarySerializerHash, BinarySerializerSchema, Broker, Category, Channel,
42
+ ChannelMetaData, ClassInfo, Connection, ConnectionStatus, DaqDataType,
43
+ DAQPolicy, DateTimeString, DeviceClient as BoundDeviceClient,
44
+ DimensionType, Dims, Encoding, Epochstamp, ErrorCode, EventLoop, Hash,
45
+ HashAttributes, HashAttributesNode, HashFilter, HashMergePolicy, HashNode,
46
+ ImageData, InputChannel, InputHash, InputSchema, LeafType, Logger,
47
+ MetricPrefix, NodeType, OutputChannel, OutputHash, OutputSchema,
48
+ PriorityLevel, Requestor, RollingWindowStatistics, Rotation, Schema,
49
+ SignalSlotable, SignalSlotableIntern, Slot, SlotElementBase,
50
+ TextSerializerHash, TextSerializerSchema, TimeDuration, Timestamp,
51
+ Trainstamp, Types, TypesClass, Unit, Validator, ValidatorValidationRules,
52
+ VectorHash, VectorHashPointer, _DimsIntern, cppNDArray, cppNDArrayCopy,
53
+ fullyEqual, generateAutoStartHash, jsonToHash, loadFromFile,
54
+ loadHashFromFile, loadSchemaFromFile, saveHashToFile, saveSchemaToFile,
55
+ saveToFile, setDims, similar, startDeviceServer, stopDeviceServer)
56
+
57
+ from ..common.alarm_conditions import AlarmCondition
58
+ from ..common.states import State, StateSignifier
59
+ from .base_fsm import BaseFsm
60
+ from .camera_fsm import CameraFsm
61
+ from .configurator import Configurator
62
+ from .decorators import KARABO_CLASSINFO, KARABO_CONFIGURATION_BASE_CLASS
63
+ from .device import PythonDevice, launchPythonDevice
64
+ from .device_client import DeviceClient
65
+ from .device_server import DeviceServer, Launcher
66
+ from .fsm import (
67
+ KARABO_FSM_ACTION, KARABO_FSM_ACTION0, KARABO_FSM_ACTION1,
68
+ KARABO_FSM_ACTION2, KARABO_FSM_ACTION3, KARABO_FSM_ACTION4,
69
+ KARABO_FSM_CREATE_MACHINE, KARABO_FSM_EVENT0, KARABO_FSM_EVENT1,
70
+ KARABO_FSM_EVENT2, KARABO_FSM_EVENT3, KARABO_FSM_EVENT4, KARABO_FSM_GUARD,
71
+ KARABO_FSM_GUARD0, KARABO_FSM_GUARD1, KARABO_FSM_GUARD2, KARABO_FSM_GUARD3,
72
+ KARABO_FSM_GUARD4, KARABO_FSM_INTERRUPT_STATE,
73
+ KARABO_FSM_INTERRUPT_STATE_A, KARABO_FSM_INTERRUPT_STATE_AE,
74
+ KARABO_FSM_INTERRUPT_STATE_AEE, KARABO_FSM_INTERRUPT_STATE_E,
75
+ KARABO_FSM_INTERRUPT_STATE_EE, KARABO_FSM_NO_TRANSITION_ACTION,
76
+ KARABO_FSM_PERIODIC_ACTION, KARABO_FSM_STATE, KARABO_FSM_STATE_A,
77
+ KARABO_FSM_STATE_AE, KARABO_FSM_STATE_AEE, KARABO_FSM_STATE_E,
78
+ KARABO_FSM_STATE_EE, KARABO_FSM_STATE_MACHINE, KARABO_FSM_STATE_MACHINE_E,
79
+ KARABO_FSM_STATE_MACHINE_EE)
80
+ from .no_fsm import NoFsm
81
+ from .ok_error_fsm import OkErrorFsm
82
+ from .plugin_loader import PluginLoader
83
+ from .runner import Runner
84
+ from .server_entry_point import runSingleDeviceServer
85
+ from .start_stop_fsm import StartStopFsm
86
+ from .start_stop_fsm_periodic import StartStopFsmPeriodic
87
+ from .worker import QueueWorker, Worker
88
+
89
+ # For comptibility with old karathon bindings, take care that e.g.
90
+ # str(Types.INT32) is 'INT32' and not 'Types.INT32'
91
+
92
+ def __typesToString(self):
93
+ repStr = repr(self) # i.e. '<Types.{this we want}: {enum value}>'
94
+ return repStr[7:repStr.find(':')]
95
+
96
+
97
+ setattr(Types, "__str__", __typesToString)
98
+
99
+
100
+ class AbstractInput:
101
+ pass
102
+
103
+
104
+ def isStdVectorDefaultConversion():
105
+ return True
106
+
107
+
108
+ def setStdVectorDefaultConversion():
109
+ pass
@@ -0,0 +1,104 @@
1
+ # This file is part of Karabo.
2
+ #
3
+ # http://www.karabo.eu
4
+ #
5
+ # Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
6
+ #
7
+ # Karabo is free software: you can redistribute it and/or modify it under
8
+ # the terms of the MPL-2 Mozilla Public License.
9
+ #
10
+ # You should have received a copy of the MPL-2 Public License along with
11
+ # Karabo. If not, see <https://www.mozilla.org/en-US/MPL/2.0/>.
12
+ #
13
+ # Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
14
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
+ # FITNESS FOR A PARTICULAR PURPOSE.
16
+ # To change this template, choose Tools | Templates
17
+ # and open the template in the editor.
18
+
19
+ __author__ = "Sergey Esenov <serguei.essenov at xfel.eu>"
20
+ __date__ = "$May 10, 2013 2:17:13 PM$"
21
+
22
+ import threading
23
+
24
+ from karabo.common.states import State
25
+
26
+ from .decorators import KARABO_CLASSINFO, KARABO_CONFIGURATION_BASE_CLASS
27
+ from .fsm import KARABO_FSM_NO_TRANSITION_ACTION
28
+ from .no_fsm import NoFsm
29
+
30
+
31
+ @KARABO_CONFIGURATION_BASE_CLASS
32
+ @KARABO_CLASSINFO("BaseFsm", "1.0")
33
+ class BaseFsm(NoFsm):
34
+ """The BaseFSM class is the basis of all finite state machines.
35
+
36
+ It provides methods for starting and retrieving the derived specific
37
+ state machines, and for processing events occurring in the state machine.
38
+ """
39
+
40
+ @staticmethod
41
+ def expectedParameters(expected):
42
+ """Expected parameters of the FSM.
43
+
44
+ Derived state machines will usually implement slots in their
45
+ expected parameters.
46
+
47
+ :param expected: schema to insert parameters into
48
+ """
49
+
50
+ pass
51
+
52
+ def __init__(self, configuration):
53
+ """Initialize the state machine according to the configuration Hash.
54
+
55
+ :param configuration:
56
+ """
57
+ super().__init__(configuration)
58
+ self.fsm = None
59
+ self.processEventLock = threading.RLock()
60
+ KARABO_FSM_NO_TRANSITION_ACTION(self.noStateTransition)
61
+
62
+ def getFsm(self):
63
+ """
64
+ Return the concrete FSM implementation that inherits from BaseFsm
65
+ """
66
+ return self.fsm
67
+
68
+ def startFsm(self):
69
+ """Start state machine"""
70
+ fsm = self.getFsm()
71
+ if fsm is not None:
72
+ try:
73
+ fsm.start()
74
+ except Exception as e:
75
+ raise RuntimeError(f"startFsm -- Exception: {str(e)}")
76
+
77
+ state = fsm.get_state()
78
+ self.updateState(state)
79
+
80
+ def processEvent(self, event):
81
+ """Process input event, i.e. drive state machine to the next state."""
82
+ with self.processEventLock:
83
+ fsm = self.getFsm()
84
+ if fsm is not None:
85
+ self.updateState(State.CHANGING)
86
+ try:
87
+ fsm.process_event(event)
88
+ except Exception as e:
89
+ name = event.__class__.__name__
90
+ self.exceptionFound(
91
+ f"Exception while processing event '{name}': {e}")
92
+ finally:
93
+ state = fsm.get_state()
94
+ self.updateState(state)
95
+
96
+ def exceptionFound(self, userFriendlyMessage, detailedMessage):
97
+ """Hook for when an exception is encountered.
98
+
99
+ Catch exceptions where they can occur instead, e.g.
100
+ when calling a slot or requesting a value!
101
+
102
+ :param shortMessage: exception message
103
+ :param detailedMessage: detailed exception message
104
+ """
@@ -0,0 +1,231 @@
1
+ # This file is part of Karabo.
2
+ #
3
+ # http://www.karabo.eu
4
+ #
5
+ # Copyright (C) European XFEL GmbH Schenefeld. All rights reserved.
6
+ #
7
+ # Karabo is free software: you can redistribute it and/or modify it under
8
+ # the terms of the MPL-2 Mozilla Public License.
9
+ #
10
+ # You should have received a copy of the MPL-2 Public License along with
11
+ # Karabo. If not, see <https://www.mozilla.org/en-US/MPL/2.0/>.
12
+ #
13
+ # Karabo is distributed in the hope that it will be useful, but WITHOUT ANY
14
+ # WARRANTY; without even the implied warranty of MERCHANTABILITY or
15
+ # FITNESS FOR A PARTICULAR PURPOSE.
16
+ __author__ = "andrea.parenti@xfel.eu"
17
+ __date__ = "August 7, 2013"
18
+
19
+ import karabo.bound.base_fsm as base
20
+ from karabind import SLOT_ELEMENT, VECTOR_STRING_ELEMENT
21
+ from karabo.common.states import State
22
+
23
+ from .decorators import KARABO_CLASSINFO
24
+ from .fsm import (
25
+ KARABO_FSM_ACTION0, KARABO_FSM_ACTION2, KARABO_FSM_CREATE_MACHINE,
26
+ KARABO_FSM_EVENT0, KARABO_FSM_EVENT2, KARABO_FSM_GUARD0,
27
+ KARABO_FSM_STATE_EE, KARABO_FSM_STATE_MACHINE)
28
+
29
+
30
+ @KARABO_CLASSINFO("CameraFsm", "1.0")
31
+ class CameraFsm(base.BaseFsm):
32
+ """The CameraFSM is a state machine suited for camera devices.
33
+
34
+ This finite state machine implements actions for acquiring, triggering
35
+ stopping and resetting camera type devices.
36
+
37
+ Here acquire sends the camera into the acquisition state, i.e. it is ready
38
+ to receive and react on trigger signals. The trigger command will send
39
+ such a trigger. Stop will stop acquisition, i.e. the camera will not
40
+ respond to triggers anymore. Finally, reset is used to bring the camera
41
+ back into an active state after hardware errors have occured.
42
+ """
43
+
44
+ @staticmethod
45
+ def expectedParameters(expected):
46
+ (
47
+ SLOT_ELEMENT(expected).key("connectCamera")
48
+ .displayedName("Connect")
49
+ .description("Connects to the hardware")
50
+ .allowedStates(State.UNKNOWN)
51
+ .commit(),
52
+
53
+ SLOT_ELEMENT(expected).key("acquire")
54
+ .displayedName("Acquire")
55
+ .description("Instructs camera to go into acquisition state")
56
+ .allowedStates(State.ON)
57
+ .commit(),
58
+
59
+ SLOT_ELEMENT(expected).key("trigger")
60
+ .displayedName("Trigger")
61
+ .description("Sends a software trigger to the camera")
62
+ .allowedStates(State.ACQUIRING)
63
+ .commit(),
64
+
65
+ SLOT_ELEMENT(expected).key("stop")
66
+ .displayedName("Stop")
67
+ .description("Instructs camera to stop current acquisition")
68
+ .allowedStates(State.ACQUIRING)
69
+ .commit(),
70
+
71
+ SLOT_ELEMENT(expected).key("reset")
72
+ .displayedName("Reset")
73
+ .description("Resets the camera in case of an error")
74
+ .allowedStates(State.ERROR)
75
+ .commit(),
76
+
77
+ VECTOR_STRING_ELEMENT(expected).key("interfaces")
78
+ .displayedName("Interfaces")
79
+ .description("Describes the interfaces of this device")
80
+ .readOnly()
81
+ .initialValue(["Camera"])
82
+ .commit(),
83
+ )
84
+
85
+ def __init__(self, configuration):
86
+ super().__init__(configuration)
87
+
88
+ # **************************************************************
89
+ # * Events *
90
+ # **************************************************************
91
+ KARABO_FSM_EVENT2(self, 'ErrorFoundEvent', 'errorFound')
92
+ KARABO_FSM_EVENT0(self, 'ConnectEvent', 'connectCamera')
93
+ KARABO_FSM_EVENT0(self, 'DisconnectEvent', 'disconnectCamera')
94
+ KARABO_FSM_EVENT0(self, 'ResetEvent', 'reset')
95
+ KARABO_FSM_EVENT0(self, 'AcquireEvent', 'acquire')
96
+ KARABO_FSM_EVENT0(self, 'StopEvent', 'stop')
97
+ KARABO_FSM_EVENT0(self, 'TriggerEvent', 'trigger')
98
+
99
+ # **************************************************************
100
+ # * States *
101
+ # **************************************************************
102
+ KARABO_FSM_STATE_EE(State.ERROR, self.errorStateOnEntry,
103
+ self.errorStateOnExit)
104
+ KARABO_FSM_STATE_EE(State.INIT, self.initializationStateOnEntry,
105
+ self.initializationStateOnExit)
106
+ KARABO_FSM_STATE_EE(State.UNKNOWN, self.unknownStateOnEntry,
107
+ self.unknownStateOnExit)
108
+ KARABO_FSM_STATE_EE(State.ACQUIRING, self.acquisitionStateOnEntry,
109
+ self.acquisitionStateOnExit)
110
+ KARABO_FSM_STATE_EE(State.ON, self.readyStateOnEntry,
111
+ self.readyStateOnExit)
112
+
113
+ # **************************************************************
114
+ # * Transition Actions *
115
+ # **************************************************************
116
+ # KARABO_FSM_NO_TRANSITION_ACTION(self.noStateTransition)
117
+ KARABO_FSM_ACTION2('ErrorFoundAction', self.errorFoundAction, str, str)
118
+ KARABO_FSM_ACTION0('ConnectAction', self.connectAction)
119
+ KARABO_FSM_ACTION0('DisconnectAction', self.disconnectAction)
120
+ KARABO_FSM_ACTION0('ResetAction', self.resetAction)
121
+ KARABO_FSM_ACTION0('AcquireAction', self.acquireAction)
122
+ KARABO_FSM_ACTION0('StopAction', self.stopAction)
123
+ KARABO_FSM_ACTION0('TriggerAction', self.triggerAction)
124
+
125
+ KARABO_FSM_GUARD0('ConnectGuard', self.connectGuard)
126
+
127
+ # **************************************************************
128
+ # * Ok State Machine *
129
+ # **************************************************************
130
+ okStt = [
131
+ # Source-State Event Target-State Action Guard
132
+ (
133
+ State.ON, 'AcquireEvent', State.ACQUIRING, 'AcquireAction',
134
+ 'none'),
135
+ (State.ACQUIRING, 'StopEvent', State.ON, 'StopAction', 'none'),
136
+ (State.ACQUIRING, 'TriggerEvent', None, 'TriggerAction', 'none')
137
+ ]
138
+ # Name Transition-Table Initial-State
139
+ KARABO_FSM_STATE_MACHINE(State.NORMAL, okStt, State.ON)
140
+
141
+ # **************************************************************
142
+ # * Known Machine *
143
+ # **************************************************************
144
+ knownStt = [
145
+ # Source-State Event Target-State Action Guard
146
+ (State.NORMAL, 'ErrorFoundEvent', State.ERROR, 'ErrorFoundAction',
147
+ 'none'),
148
+ (State.ERROR, 'ResetEvent', State.NORMAL, 'ResetAction', 'none')
149
+ ]
150
+ # Name Transition-Table Initial-State
151
+ KARABO_FSM_STATE_MACHINE(State.KNOWN, knownStt, State.NORMAL)
152
+
153
+ # **************************************************************
154
+ # * Top Machine *
155
+ # **************************************************************
156
+ cameraStt = [
157
+ # Source-State Event Target-State Action Guard
158
+ (State.INIT, 'none', State.UNKNOWN, 'none', 'none'),
159
+ (State.UNKNOWN, 'ConnectEvent', State.KNOWN, 'ConnectAction',
160
+ 'ConnectGuard'),
161
+ (State.KNOWN, 'DisconnectEvent', State.UNKNOWN, 'DisconnectAction',
162
+ 'none')
163
+ ]
164
+ # Name Transition-Table Initial-State
165
+ KARABO_FSM_STATE_MACHINE('CameraMachine', cameraStt, State.INIT)
166
+ self.fsm = KARABO_FSM_CREATE_MACHINE('CameraMachine')
167
+
168
+ def getFsm(self):
169
+ return self.fsm
170
+
171
+ def initFsmSlots(self, sigslot):
172
+ sigslot.registerSlot(self.connectCamera)
173
+ sigslot.registerSlot(self.acquire)
174
+ sigslot.registerSlot(self.trigger)
175
+ sigslot.registerSlot(self.stop)
176
+ sigslot.registerSlot(self.reset)
177
+ sigslot.registerSlot(self.errorFound)
178
+
179
+ def initializationStateOnEntry(self):
180
+ """Actions executed on entry to 'Initialization' state"""
181
+
182
+ def initializationStateOnExit(self):
183
+ """Actions executed on exit from 'Initialization' state"""
184
+
185
+ def unknownStateOnEntry(self):
186
+ """Actions executed on entry to 'Initialization' state"""
187
+
188
+ def unknownStateOnExit(self):
189
+ """Actions executed on exit from 'Initialization' state"""
190
+
191
+ def errorStateOnEntry(self):
192
+ """Actions executed on entry to 'Error' state"""
193
+
194
+ def errorStateOnExit(self):
195
+ """Actions executed on exit from 'Error' state"""
196
+
197
+ def acquisitionStateOnEntry(self):
198
+ """Actions executed on entry to 'Acquisition' state"""
199
+
200
+ def acquisitionStateOnExit(self):
201
+ """Actions executed on exit from 'Acquisition' state"""
202
+
203
+ def readyStateOnEntry(self):
204
+ """Actions executed on entry to 'Ready' state"""
205
+
206
+ def readyStateOnExit(self):
207
+ """Actions executed on exit from 'Ready' state"""
208
+
209
+ def errorFoundAction(self, shortMessage, detailedMessage):
210
+ """Action executed when an error is found """
211
+
212
+ def connectAction(self):
213
+ """Actions executed at 'connect' event"""
214
+
215
+ def disconnectAction(self):
216
+ """Actions executed at 'disconnect' event"""
217
+
218
+ def acquireAction(self):
219
+ """Actions executed at 'acquire' event"""
220
+
221
+ def stopAction(self):
222
+ """Actions executed at 'stop' event"""
223
+
224
+ def triggerAction(self):
225
+ """Actions executed at 'trigger' event"""
226
+
227
+ def resetAction(self):
228
+ """Action to execute upon reset event"""
229
+
230
+ def connectGuard(self):
231
+ """Guard for UNKNOWN -> KNOWN transition"""