GoWebScan API
GoWebScanProcess.h
Go to the documentation of this file.
1 /**
2 * @file GoWebScanProcess.h
3 * @brief Declares a GoWebScanProcess object.
4 *
5 * @internal
6 * Copyright (C) 2017-2026 by LMI Technologies Inc.
7 * Licensed under the MIT License.
8 * Redistributed files must retain the above copyright notice.
9 */
10 
11 #ifndef GO_WEB_SCAN_PROCESS_H
12 #define GO_WEB_SCAN_PROCESS_H
13 
19 
20 typedef enum
21 {
22  GO_WEB_SCAN_PROCESS_RECORD_STATUS_OK,
23  GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MAX_BOARD_COUNT,
24  GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MEMORY_LIMIT
25 
26 } GoWebScanProcessRecordStatus;
27 
28 /**
29 * @class GoWebScanProcess
30 * @extends kObject
31 * @ingroup GoWebScanSdk-Control
32 * @brief Represents a task for processing raw sensor data to produce system web tiles (Web
33 * mode) or detected objects (Detection mode).
34 * The GoWebScanProcess class accepts configuration via a GoWebScanConfig instance, and
35 * provides a simple API to initialize the processor, pass sensor data to the processor,
36 * retrieve completed system messages, and clear the processor. Internally, the
37 * processor delegates processing responsibilities to the Task classes in the Control
38 * group. A GoWebScanProcess object can optionally run processing tasks concurrently.
39 * Tasks are run when they receive messages, and messages are passed from task to task
40 * as processing steps execute. Task execution and message exchange are supported by
41 * the classes in the Pipe group.
42 *
43 * A GoWebScanProcess object has a GoWebScanPipe object, and each GoWebScanProcess Task
44 * object (e.g. GoWebScanProfileSampleTask) has an associated GoWebScanPipeTask.
45 * Individual processor tasks are passed references to downstream tasks (receivers) at
46 * initialization time (e.g a GoWebScanProfileSampleTask has a reference to the
47 * GoWebScanSyncTask to which it sends messages).
48 *
49 * Following initialization, the user application should pass inbound sensor messages
50 * to the GoWebScanProcess. The GoWebScanProcess handles the initial dispatch to various
51 * data sampling tasks. From there, messages flow from task to task, eventually
52 * resulting in outbound messages sent back to the GoWebScanProcess. Outbound messages
53 * are queued by the GoWebScanProcess object and can be accepted by the user application
54 * at any time.
55 
56 */
58 
59 /**
60 * Constructs a GoWebScanProcess object.
61 *
62 * @public @memberof GoWebScanProcess
63 * @param process Receives the constructed GoWebScanProcess object.
64 * @param config System configuration.
65 * @param allocator Memory allocator (or kNULL for default).
66 * @return Operation status.
67 */
68 GoWebScanFx(kStatus) GoWebScanProcess_Construct(GoWebScanProcess* process, GoWebScanConfig config, kAlloc allocator);
69 
70 /**
71  * Accepts inbound sensor message sets and dispatches the messages to data processing tasks. The
72  * messages are cloned into internal message objects. As such, the GoDataSet object is still
73  * owned by the calling function and must be destroyed by it. If recording is enabled, GoWebScanProcess
74  * will record copies of all the GoDataSet objects, in the order they are processed.
75  *
76  * @public @memberof GoWebScanProcess
77  * @param process GoWebScanProcess object.
78  * @param dataSet Set of sensor messages. Must have one of type GO_DATA_MESSAGE_TYPE_STAMP with
79  * remaining messages of type GO_DATA_MESSAGE_TYPE_PROFILE for profile,
80  * GO_DATA_MESSAGE_TYPE_TRACHEID for tracheid, or GO_DATA_MESSAGE_TYPE_VIDEO for
81  * vision.
82  * @return Operation status.
83  */
84 GoWebScanFx(kStatus) GoWebScanProcess_Process(GoWebScanProcess process, GoDataSet dataSet);
85 
86 /**
87  * Returns outbound processed results if any are available. The function will return an error if
88  * the outbound queue is empty (no new result available), and so the function can be run in a
89  * loop until it fails to receive all results in the queue. Ownership of the result is passed
90  * to the calling function. The result will be of type GoWebScanSystemMsg and will contain tiles
91  * for all data types (profile, tracheid, or vision) and planes (top or bottom) in the system.
92  * GoWebScanSystemMsg_TileAt() can be used to retrieve the system tiles for a specific data type
93  * and plane.
94  *
95  * @public @memberof GoWebScanProcess
96  * @param process GoWebScanProcess object.
97  * @param msg Receives the outbound processed result. Should be cast into a GoWebScanSystemMsg.
98  * @param timeout Timeout for receiving result (in microseconds). kINFINITE to wait indefinitely.
99  * @return Operation status.
100  */
101 GoWebScanFx(kStatus) GoWebScanProcess_Receive(GoWebScanProcess process, GoWebScanPipeMsg* msg, k64s timeout);
102 
103 /**
104  * Initializes the processing tasks. Should be called prior to GoWebScanProcess_Process().
105  *
106  * @public @memberof GoWebScanProcess
107  * @param process GoWebScanProcess object.
108  * @return Operation status.
109  */
110 GoWebScanFx(kStatus) GoWebScanProcess_Start(GoWebScanProcess process);
111 
112 /**
113  * Aborts all outstanding processing and resets the state.
114  *
115  * @public @memberof GoWebScanProcess
116  * @param process GoWebScanProcess object.
117  * @return Operation status.
118  */
119 GoWebScanFx(kStatus) GoWebScanProcess_Clear(GoWebScanProcess process);
120 
121 /**
122  * Gets the current count of errors in the processor.
123  *
124  * @public @memberof GoWebScanProcess
125  * @param process GoWebScanProcess object.
126  * @return Error count.
127  */
129 
130 /**
131  * Return whether or not recording is enabled. If recording is enabled, GoWebScanProcess
132  * will record copies of all the GoDataSet objects, in the order they are processed.
133  *
134  * @public @memberof GoWebScanProcess
135  * @param process GoWebScanProcess object.
136  * @return Recording enabled.
137  */
139 
140 /**
141  * Enable or disable recording. If recording is enabled, GoWebScanProcess will record copies
142  * of all the GoDataSet objects, in the order they are processed.
143  *
144  * @public @memberof GoWebScanProcess
145  * @param process GoWebScanProcess object.
146  * @param recordingEnabled kTRUE to enable recording, or kFALSE to disable recording.
147  * @return Operation status.
148  */
149 GoWebScanFx(kStatus) GoWebScanProcess_EnableRecording(GoWebScanProcess process, kBool recordingEnabled);
150 
151 /**
152  * Return the number of GoDataSet objects that have been recorded.
153  *
154  * @public @memberof GoWebScanProcess
155  * @param process GoWebScanProcess object.
156  * @return Number of recorded GoDataSet objects.
157  */
159 
160 /**
161  * Save a file containing the recorded GoDataSet objects to the specified file path.
162  *
163  * @public @memberof GoWebScanProcess
164  * @param process GoWebScanProcess object.
165  * @param filePath Path to save to.
166  * @return Operation status.
167  */
168 GoWebScanFx(kStatus) GoWebScanProcess_SaveRecording(GoWebScanProcess process, const kChar* filePath);
169 
170 /**
171  * Clear the recorded GoDataSet objects. As such, the number of processed boards corresponding to the recorded
172  * data will become zero.
173  *
174  * @public @memberof GoWebScanProcess
175  * @param process GoWebScanProcess object.
176  * @return Operation status.
177  */
179 
180 /**
181  * Access a recorded GoDataSet object by index.
182  *
183  * @public @memberof GoWebScanProcess
184  * @param process GoWebScanProcess object.
185  * @param index Recorded GoDataSet index.
186  * @return Pointer to the recorded GoDataSet.
187  */
188 GoWebScanFx(const GoDataSet*) GoWebScanProcess_DataSetAt(GoWebScanProcess process, kSize index);
189 
190 /**
191  * Return the number of boards processed from GoDataSet objects that were recorded.
192  *
193  * @public @memberof GoWebScanProcess
194  * @param process GoWebScanProcess object.
195  * @return Number of boards processed with recorded data.
196  */
198 
199 /**
200  * Return the max number of boards that may result from the recorded GoDataSet objects. Once this
201  * value is reached, additional GoDataSet objects are no longer recorded.
202  *
203  * @public @memberof GoWebScanProcess
204  * @param process GoWebScanProcess object.
205  * @return Number of boards processed with recorded data.
206  */
208 
209 /**
210  * Set the max number of boards that may result from the recorded GoDataSet objects. Once this value
211  * is reached, additional GoDataSet objects are no longer recorded. This function may not be called
212  * if any GoDataSet object has been recorded, and will return kERROR_STATE in such a case. The recording
213  * must first be cleared by calling GoWebScanProcess_ClearRecording.
214  *
215  * @public @memberof GoWebScanProcess
216  * @param process GoWebScanProcess object.
217  * @param maxRecordBoardCount Number of boards to record data for.
218  * @return Operation status.
219  */
220 GoWebScanFx(kStatus) GoWebScanProcess_SetMaxRecordBoardCount(GoWebScanProcess process, kSize maxRecordBoardCount);
221 
222 /**
223  * Return the approximate total size in bytes of the recorded GoDataSet objects.
224  *
225  * @public @memberof GoWebScanProcess
226  * @param process GoWebScanProcess object.
227  * @return Size in bytes of recorded GoDataSet objects.
228  */
230 
231 /**
232  * Return the max allowed size in bytes of the recorded GoDataSet objects. Once this value is reached,
233  * additional GoDataSet objects are no longer recorded.
234  *
235  * @public @memberof GoWebScanProcess
236  * @param process GoWebScanProcess object.
237  * @return Max size in bytes of recorded GoDataSet objects.
238  */
240 
241 /**
242  * Set the max allowed size in bytes of the recorded GoDataSet objects. Once this value
243  * is reached, additional GoDataSet objects are no longer recorded. This function may not be called
244  * if any GoDataSet object has been recorded, and will return kERROR_STATE in such a case. The recording
245  * must first be cleared by calling GoWebScanProcess_ClearRecording.
246  *
247  * @public @memberof GoWebScanProcess
248  * @param process GoWebScanProcess object.
249  * @param maxRecordSize Max size in bytes of recorded GoDataSet objects.
250  * @return Operation status.
251  */
252 GoWebScanFx(kStatus) GoWebScanProcess_SetMaxRecordSize(GoWebScanProcess process, k64u maxRecordSize);
253 
254 /**
255  * Get the recording of processed sensor message sets.
256  *
257  * @public @memberof GoWebScanProcess
258  * @param process GoWebScanProcess object.
259  * @return The recording.
260  */
262 
263 /**
264  * Return the status of the GoDataSet object recording functionality. A status of
265  * GO_WEB_SCAN_PROCESS_RECORD_STATUS_OK indicates there are no issues. A status of
266  * GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MAX_BOARD_COUNT indicates that recording has
267  * stopped, despite being enabled, since the max number of boards resulting from recorded data
268  * has been reached. A status of GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MEMORY_LIMIT
269  * indicates that recording has stopped, despite being enabled, since the max specified recording size
270  * in bytes has been reached.
271  *
272  * @public @memberof GoWebScanProcess
273  * @param process GoWebScanProcess object.
274  * @return Recording status.
275  */
276 GoWebScanFx(GoWebScanProcessRecordStatus) GoWebScanProcess_ProcessRecordStatus(GoWebScanProcess process);
277 
278 /**
279  * Sets a callback function that can be used to receive output board data asynchronously.
280  *
281  * Sensor data messages can be received synchronously using the GoWebScanProcess_Receive function
282  * or asynchronously by registering a callback function. If a callback function is registered,
283  * a background thread will be created to perform notifications.
284  *
285  * To unregister a previously-registered data handler, call this function using kNULL in place
286  * of the callback function argument.
287  *
288  * @public @memberof GoWebScanProcess
289  * @param process GoWebScanProcess object.
290  * @param function Data callback function (or kNULL to unregister).
291  * @param receiver Receiver argument for callback.
292  * @return Operation status.
293  */
294 GoWebScanFx(kStatus) GoWebScanProcess_SetDataHandler(GoWebScanProcess process, GoDataFx function, kPointer receiver);
295 
296 /**
297  * Refresh the process. This must be called prior to starting if there are any changes to the config.
298  *
299  * @public @memberof GoWebScanProcess
300  * @param process GoWebScanProcess object.
301  * @return Operation status.
302  */
304 
305 /**
306 * Set handler for when sync task disables a camera lane. Function calls for disabling or enabling a lane enter an asynchronous queue.
307 updated
308 *
309 * @public @memberof GoWebScanProcess
310 * @param process GoWebScanProcess object.
311 * @param function Callback function.
312 * @param receiver Receiver argument for callback.
313 * @return Operation status.
314 */
316 
317 /**
318 * Set handler for when sync task re-enables a camera lane. Function calls for disabling or enabling a lane enter an asynchronous queue.
319 *
320 * @public @memberof GoWebScanProcess
321 * @param process GoWebScanProcess object.
322 * @param function Callback function.
323 * @param receiver Receiver argument for callback.
324 * @return Operation status.
325 */
327 
328 #include <GoWebScanSdk/GoWebScanProcess.x.h>
329 
330 #endif
GoWebScanProcessRecordStatus GoWebScanProcess_ProcessRecordStatus(GoWebScanProcess process)
Return the status of the GoDataSet object recording functionality.
Represents a task for processing raw sensor data to produce system web tiles (Web mode) or detected o...
kStatus GoWebScanProcess_ClearRecording(GoWebScanProcess process)
Clear the recorded GoDataSet objects.
kStatus GoWebScanProcess_SetDataHandler(GoWebScanProcess process, GoDataFx function, kPointer receiver)
Sets a callback function that can be used to receive output board data asynchronously.
const GoDataSet * GoWebScanProcess_DataSetAt(GoWebScanProcess process, kSize index)
Access a recorded GoDataSet object by index.
kStatus GoWebScanProcess_Receive(GoWebScanProcess process, GoWebScanPipeMsg *msg, k64s timeout)
Returns outbound processed results if any are available.
kStatus GoWebScanProcess_Clear(GoWebScanProcess process)
Aborts all outstanding processing and resets the state.
kStatus GoWebScanProcess_SaveRecording(GoWebScanProcess process, const kChar *filePath)
Save a file containing the recorded GoDataSet objects to the specified file path. ...
Declares a GoWebScanRecording object.
kSize GoWebScanProcess_RecordBoardCount(GoWebScanProcess process)
Return the number of boards processed from GoDataSet objects that were recorded.
kStatus GoWebScanProcess_Start(GoWebScanProcess process)
Initializes the processing tasks.
k64u GoWebScanProcess_MaxRecordSize(GoWebScanProcess process)
Return the max allowed size in bytes of the recorded GoDataSet objects.
kBool GoWebScanProcess_RecordingEnabled(GoWebScanProcess process)
Return whether or not recording is enabled.
Declares the GoWebScanPipeMsg class.
Essential GoWebScan declarations.
kStatus GoWebScanProcess_EnableRecording(GoWebScanProcess process, kBool recordingEnabled)
Enable or disable recording.
kSSize GoWebScanProcess_ErrorCount(GoWebScanProcess process)
Gets the current count of errors in the processor.
kStatus(kCall * GoWebScanTileCombinerLaneChangeFx)(kPointer context, const k32s *id, kSize length)
Defines the signature for the handler for a lane being enabled or disabled.
Definition: GoWebScanTileCombiner.h:54
GoWebScanRecording GoWebScanProcess_Recording(GoWebScanProcess process)
Get the recording of processed sensor message sets.
k64u GoWebScanProcess_RecordSize(GoWebScanProcess process)
Return the approximate total size in bytes of the recorded GoDataSet objects.
kStatus GoWebScanProcess_SetLaneEnabledHandler(GoWebScanProcess process, GoWebScanTileCombinerLaneChangeFx function, kPointer receiver)
Set handler for when sync task re-enables a camera lane.
kStatus GoWebScanProcess_Construct(GoWebScanProcess *process, GoWebScanConfig config, kAlloc allocator)
Constructs a GoWebScanProcess object.
kSize GoWebScanProcess_MaxRecordBoardCount(GoWebScanProcess process)
Return the max number of boards that may result from the recorded GoDataSet objects.
kStatus GoWebScanProcess_SetLaneDisabledHandler(GoWebScanProcess process, GoWebScanTileCombinerLaneChangeFx function, kPointer receiver)
Set handler for when sync task disables a camera lane.
kSize GoWebScanProcess_DataSetCount(GoWebScanProcess process)
Return the number of GoDataSet objects that have been recorded.
kStatus GoWebScanProcess_SetMaxRecordSize(GoWebScanProcess process, k64u maxRecordSize)
Set the max allowed size in bytes of the recorded GoDataSet objects.
kStatus GoWebScanProcess_Refresh(GoWebScanProcess process)
Refresh the process.
Declares a GoWebScanTileCombiner object.
kStatus GoWebScanProcess_SetMaxRecordBoardCount(GoWebScanProcess process, kSize maxRecordBoardCount)
Set the max number of boards that may result from the recorded GoDataSet objects. ...
Base class for a msg that can be processed with a GoWebScanPipeTask and submitted to the GoWebScanPip...
kStatus GoWebScanProcess_Process(GoWebScanProcess process, GoDataSet dataSet)
Accepts inbound sensor message sets and dispatches the messages to data processing tasks...
A class for storing sensor messages, which can be reused, or saved to and loaded from disk...
Represents a container for system-level parameters which are translated from user parameters set in G...
Declares a GoWebScanConfig object.