AuboCaps  0.6.0
wait_node.h
Go to the documentation of this file.
1 #ifndef AUBO_SCOPE_WAIT_NODE_H
2 #define AUBO_SCOPE_WAIT_NODE_H
3 
11 
12 namespace arcs {
13 namespace aubo_scope {
14 ARCS_CLASS_FORWARD(WaitNode);
15 
17 {
18 public:
19  /**
20  * The configuration type used to determine which type of configuration this
21  * instance is.
22  */
23  enum ConfigType : int
24  {
25 
27 
28  /**
29  * <p>
30  * Nothing to wait.
31  * </p>
32  *
33  *
34  */
36 
37  /**
38  * <p>
39  * Wait type is time.
40  * </p>
41  *
42  * The config instance can be cast to {@link TimeWaitNodeConfig}.
43  */
45 
46  /**
47  * <p>
48  * Wait type is digital_input.
49  * </p>
50  *
51  * The config instance can be cast to {@link
52  * DigitalInputWaitNodeConfig}.
53  */
55 
56  /**
57  * <p>
58  * Wait type is analog_input_current.
59  * </p>
60  *
61  * The config instance can be cast to {@link
62  * AnalogInputCurrentWaitNodeConfig}.
63  */
65 
66  /**
67  * <p>
68  * Wait type is analog_input_voltage.
69  * </p>
70  *
71  * The config instance can be cast to {@link
72  * AnalogInputVoltageWaitNodeConfig}.
73  */
75 
76  /**
77  * <p>
78  * Wait type is float_register_input.
79  * </p>
80  *
81  * The config instance can be cast to {@link
82  * FloatRegisterInputWaitNodeConfig}.
83  */
85 
86  /**
87  * <p>
88  * Wait type is expression_input.
89  * </p>
90  *
91  * The config instance can be cast to {@link
92  * ExpressionInputWaitNodeConfig}.
93  */
94  EXPRESSION_INPUT
95  };
96 
97  /**
98  * Compare operator types LESS_THAN and GREATER_THAN used when waiting for
99  * an analog input to go lower or higher, respectively, than a threshold
100  */
101  enum CompareOperator : int
102  {
104  GREATER_THAN
105  };
106 
107  WaitNode(WaitNode &f);
108  WaitNode(WaitNode &&f);
109  virtual ~WaitNode();
110 
111  /**
112  * This method returns the type of configuration. Cast this instance
113  * appropriately to have access to specific getters.
114  *
115  * @return the type of this config.
116  */
117  ConfigType getConfigType();
118  void setConfigType(ConfigType type);
119 
120  /**
121  *
122  * @return the time to wait for. second
123  */
124  double getWaitTime();
125  void setWaitTime(double time);
126 
127  /**
128  * Depending on the type of input this is interpreted in different ways.
129  * For digital inputs and MODBUS inputs, <code>true</code> means the input
130  * to wait for must be HIGH, <code>false</code> means the input to wait for
131  * must be LOW. For boolean registers the value is interpreted literally.
132  *
133  * @return the input value to wait for.
134  */
135  bool getBoolValueToWaitFor();
136  void setBoolValueToWaitFor(bool value);
137 
138  float getFloatValueToWaitFor();
139  void setFloatValueToWaitFor(float value);
140 
141  /**
142  * Creates a configuration for waiting for a digital input to go high or
143  * low.
144  *
145  * @param input the digital input on which to wait, not <code>null</code>.
146  * @param value_to_wait_for <code>true</code>, if waiting for the input
147  * signal value/level to go HIGH, <code>false</code> otherwise (waiting for
148  * LOW signal value/level).
149  * @return the configuration.
150  * @throws IllegalArgumentException if <code>input</code> is an output (does
151  * not support reading of values). See {@link IO#isInput()}.
152  */
153  void setDigitalInput(DigitalIoPtr input);
154  DigitalIoPtr getDigitalInput();
155 
156  /**
157  * Creates a configuration for waiting for a digital MODBUS input to go high
158  * or low.
159  *
160  * @param input the digital MODBUS input on which to wait, not
161  * <code>null</code>.
162  * @param value_to_wait_for <code>true</code>, if waiting for the input
163  * signal value/level to go HIGH, <code>false</code> otherwise (waiting for
164  * LOW signal value/level).
165  * @return the configuration.
166  * @throws IllegalArgumentException if <code>input</code> is an output (does
167  * not support reading of values) or if <code>output</code> is not a digital
168  * output. See {@link IO#isInput()} and {@link IO#getType()}.
169  */
170  void setModbusInput(ModbusIoPtr input);
171  ModbusIoPtr getModbusInput();
172 
173  /**
174  * Creates a configuration for waiting for a boolean register to go
175  * <code>true</code> or <code>false</code>.
176  *
177  * @param input the boolean register input on which to wait, not
178  * <code>null</code>.
179  * @param value_to_wait_for <code>true</code>, if waiting for the register
180  * to be <code>true}, <code>false} otherwise.
181  * @return the configuration.
182  * @throws IllegalArgumentException if <code>input</code> is an output (does
183  * not support reading of values). See {@link IO#isInput()}.
184  */
185  void setBoolRegister(BoolRegisterPtr input);
186  BoolRegisterPtr getBoolRegister();
187 
188  void setCompareOperator(CompareOperator compareOperator);
189  CompareOperator getCompareOperator();
190 
191  /**
192  * Creates a configuration for waiting for an analog input to go past an
193  * electric current threshold.
194  *
195  * @param input on which to wait, not <code>null</code>.
196  * @param compareOperator the operator to use when comparing input to value,
197  * not <code>null</code>. Available options are "less than" ({@literal <})
198  * or "greater than" ({@literal >}).
199  * @param current the electric current threshold to wait for, not
200  * <code>null</code>.
201  * @param errorHandler the error handler for validation errors. If using
202  * {@link ErrorHandler#AUTO_CORRECT} this will clamp the value to the
203  * nearest valid current value.
204  * @return the configuration.
205  * @throws IllegalArgumentException if <code>input</code> is an output (does
206  * not support reading of values). See {@link IO#isInput()}.
207  */
208  void setAnalogInput(AnalogIoPtr input);
209  AnalogIoPtr getAnalogInput();
210 
211  /**
212  * Creates a configuration for waiting for a register to go past a float
213  * threshold.
214  *
215  * @param input the float register input on which to wait, not
216  * <code>null</code>.
217  * @param compareOperator the operator to use when comparing register to
218  * value, not <code>null</code>. Available options are "less than"
219  * ({@literal <}) or "greater than" ({@literal >}).
220  * @param value_to_wait_for the float threshold to wait for.
221  * @return the configuration.
222  * @throws IllegalArgumentException if <code>input</code> is an output (does
223  * not support reading of values). See {@link IO#isInput()}.
224  */
225  void setDoubleRegisterInput(DoubleRegisterPtr input);
226  DoubleRegisterPtr getDoubleRegisterInput();
227 
228  /**
229  * Create a configuration for waiting for an expression to be evaluated to
230  * true.
231  *
232  * @param expression the expression to evaluate, not <code>null</code>.
233  * @return the configuration.
234  */
235  void setExpressionInputConfig(ExpressionPtr expression);
236  ExpressionPtr getExpressionInputConfig();
237 
238 private:
239  friend class DataSwitch;
240  WaitNode();
241  void *d_{ nullptr };
242 };
243 
244 } // namespace aubo_scope
245 } // namespace arcs
246 #endif // AUBO_SCOPE_WAIT_NODE_H
ARCS_CLASS_FORWARD(GripForceCapability)
CompareOperator
Compare operator types LESS_THAN and GREATER_THAN used when waiting for an analog input to go lower o...
Definition: wait_node.h:101
#define ARCS_ABI_EXPORT
Definition: class_forward.h:16
ConfigType
The configuration type used to determine which type of configuration this instance is...
Definition: wait_node.h:23