GoWebScan API
 All Classes Files Functions Variables Typedefs Macros Modules Pages
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-2022 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 
17 
18 typedef enum
19 {
20  GO_WEB_SCAN_PROCESS_RECORD_STATUS_OK,
21  GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MAX_BOARD_COUNT,
22  GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MEMORY_LIMIT
23 
24 } GoWebScanProcessRecordStatus;
25 
26 /**
27 * @class GoWebScanProcess
28 * @extends kObject
29 * @ingroup GoWebScanSdk-Control
30 * @brief Represents a task for processing raw sensor data to produce system web tiles (Web
31 * mode) or detected objects (Detection mode).
32 * The GoWebScanProcess class accepts configuration via a GoWebScanConfig instance, and
33 * provides a simple API to initialize the processor, pass sensor data to the processor,
34 * retrieve completed system messages, and clear the processor. Internally, the
35 * processor delegates processing responsibilities to the Task classes in the Control
36 * group. A GoWebScanProcess object can optionally run processing tasks concurrently.
37 * Tasks are run when they receive messages, and messages are passed from task to task
38 * as processing steps execute. Task execution and message exchange are supported by
39 * the classes in the Pipe group.
40 *
41 * A GoWebScanProcess object has a GoWebScanPipe object, and each GoWebScanProcess Task
42 * object (e.g. GoWebScanProfileSampleTask) has an associated GoWebScanPipeTask.
43 * Individual processor tasks are passed references to downstream tasks (receivers) at
44 * initialization time (e.g a GoWebScanProfileSampleTask has a reference to the
45 * GoWebScanSyncTask to which it sends messages).
46 *
47 * Following initialization, the user application should pass inbound sensor messages
48 * to the GoWebScanProcess. The GoWebScanProcess handles the initial dispatch to various
49 * data sampling tasks. From there, messages flow from task to task, eventually
50 * resulting in outbound messages sent back to the GoWebScanProcess. Outbound messages
51 * are queued by the GoWebScanProcess object and can be accepted by the user application
52 * at any time.
53 
54 */
56 
57 /**
58 * Constructs a GoWebScanProcess object.
59 *
60 * @public @memberof GoWebScanProcess
61 * @param process Receives the constructed GoWebScanProcess object.
62 * @param config System configuration.
63 * @param allocator Memory allocator (or kNULL for default).
64 * @return Operation status.
65 */
66 GoWebScanFx(kStatus) GoWebScanProcess_Construct(GoWebScanProcess* process, GoWebScanConfig config, kAlloc allocator);
67 
68 /**
69  * Accepts inbound sensor messages and dispatches these messages to data processing tasks. The
70  * messages are cloned into internal message objects. As such, the GoDataSet object is still
71  * owned by the calling function and must be destroyed by it. If recording is enabled, GoWebScanProcess
72  * will record copies of all the GoDataSet objects, in the order they are processed.
73  *
74  * @public @memberof GoWebScanProcess
75  * @param process GoWebScanProcess object.
76  * @param dataSet Sensor message. Must be of type GO_DATA_MESSAGE_TYPE_PROFILE for profile,
77  * GO_DATA_MESSAGE_TYPE_TRACHEID for tracheid, or GO_DATA_MESSAGE_TYPE_VIDEO for
78  * vision.
79  * @return Operation status.
80  */
81 GoWebScanFx(kStatus) GoWebScanProcess_Process(GoWebScanProcess process, GoDataSet dataSet);
82 
83 /**
84  * Returns outbound processed results if any are available. The function will return an error if
85  * the outbound queue is empty (no new result available), and so the function can be run in a
86  * loop until it fails to receive all results in the queue. Ownership of the result is passed
87  * to the calling function. The result will be of type GoWebScanSystemMsg and will contain tiles
88  * for all data types (profile, tracheid, or vision) and planes (top or bottom) in the system.
89  * GoWebScanSystemMsg_TileAt() can be used to retrieve the system tiles for a specific data type
90  * and plane.
91  *
92  * @public @memberof GoWebScanProcess
93  * @param process GoWebScanProcess object.
94  * @param msg Receives the outbound processed result. Should be cast into a GoWebScanSystemMsg.
95  * @param timeout Timeout for receiving result.
96  * @return Operation status.
97  */
98 GoWebScanFx(kStatus) GoWebScanProcess_Receive(GoWebScanProcess process, GoWebScanPipeMsg* msg, k64s timeout);
99 
100 /**
101  * Initializes the processing tasks. Should be called prior to GoWebScanProcess_Process().
102  *
103  * @public @memberof GoWebScanProcess
104  * @param process GoWebScanProcess object.
105  * @return Operation status.
106  */
107 GoWebScanFx(kStatus) GoWebScanProcess_Start(GoWebScanProcess process);
108 
109 /**
110  * Aborts all outstanding processing and resets the state.
111  *
112  * @public @memberof GoWebScanProcess
113  * @param process GoWebScanProcess object.
114  * @return Operation status.
115  */
116 GoWebScanFx(kStatus) GoWebScanProcess_Clear(GoWebScanProcess process);
117 
118 /**
119  * Gets the current count of errors in the processor.
120  *
121  * @public @memberof GoWebScanProcess
122  * @param process GoWebScanProcess object.
123  * @return Error count.
124  */
126 
127 /**
128  * Return whether or not recording is enabled. If recording is enabled, GoWebScanProcess
129  * will record copies of all the GoDataSet objects, in the order they are processed.
130  *
131  * @public @memberof GoWebScanProcess
132  * @param process GoWebScanProcess object.
133  * @return Recording enabled.
134  */
136 
137 /**
138  * Enable or disable recording. If recording is enabled, GoWebScanProcess will record copies
139  * of all the GoDataSet objects, in the order they are processed.
140  *
141  * @public @memberof GoWebScanProcess
142  * @param process GoWebScanProcess object.
143  * @param recordingEnabled kTRUE to enable recording, or kFALSE to disable recording.
144  * @return Operation status.
145  */
146 GoWebScanFx(kStatus) GoWebScanProcess_EnableRecording(GoWebScanProcess process, kBool recordingEnabled);
147 
148 /**
149  * Return the number of GoDataSet objects that have been recorded.
150  *
151  * @public @memberof GoWebScanProcess
152  * @param process GoWebScanProcess object.
153  * @return Number of recorded GoDataSet objects.
154  */
156 
157 /**
158  * Save a file containing the recorded GoDataSet objects to the specified file path.
159  *
160  * @public @memberof GoWebScanProcess
161  * @param process GoWebScanProcess object.
162  * @param filePath Path to save to.
163  * @return Operation status.
164  */
165 GoWebScanFx(kStatus) GoWebScanProcess_SaveRecording(GoWebScanProcess process, const kChar* filePath);
166 
167 /**
168  * Clear the recorded GoDataSet objects. As such, the number of processed boards corresponding to the recorded
169  * data will become zero.
170  *
171  * @public @memberof GoWebScanProcess
172  * @param process GoWebScanProcess object.
173  * @return Operation status.
174  */
176 
177 /**
178  * Access a recorded GoDataSet object by index.
179  *
180  * @public @memberof GoWebScanProcess
181  * @param process GoWebScanProcess object.
182  * @param index Recorded GoDataSet index.
183  * @return Pointer to the recorded GoDataSet.
184  */
185 GoWebScanFx(const GoDataSet*) GoWebScanProcess_DataSetAt(GoWebScanProcess process, kSize index);
186 
187 /**
188  * Return the number of boards processed from GoDataSet objects that were recorded.
189  *
190  * @public @memberof GoWebScanProcess
191  * @param process GoWebScanProcess object.
192  * @return Number of boards processed with recorded data.
193  */
195 
196 /**
197  * Return the max number of boards that may result from the recorded GoDataSet objects. Once this
198  * value is reached, additional GoDataSet objects are no longer recorded.
199  *
200  * @public @memberof GoWebScanProcess
201  * @param process GoWebScanProcess object.
202  * @return Number of boards processed with recorded data.
203  */
205 
206 /**
207  * Set the max number of boards that may result from the recorded GoDataSet objects. Once this value
208  * is reached, additional GoDataSet objects are no longer recorded. This function may not be called
209  * if any GoDataSet object has been recorded, and will return kERROR_STATE in such a case. The recording
210  * must first be cleared by calling GoWebScanProcess_ClearRecording.
211  *
212  * @public @memberof GoWebScanProcess
213  * @param process GoWebScanProcess object.
214  * @param maxRecordBoardCount Number of boards to record data for.
215  * @return Operation status.
216  */
217 GoWebScanFx(kStatus) GoWebScanProcess_SetMaxRecordBoardCount(GoWebScanProcess process, kSize maxRecordBoardCount);
218 
219 /**
220  * Return the approximate total size in bytes of the recorded GoDataSet objects.
221  *
222  * @public @memberof GoWebScanProcess
223  * @param process GoWebScanProcess object.
224  * @return Size in bytes of recorded GoDataSet objects.
225  */
227 
228 /**
229  * Return the max allowed size in bytes of the recorded GoDataSet objects. Once this value is reached,
230  * additional GoDataSet objects are no longer recorded.
231  *
232  * @public @memberof GoWebScanProcess
233  * @param process GoWebScanProcess object.
234  * @return Max size in bytes of recorded GoDataSet objects.
235  */
237 
238 /**
239  * Set the max allowed size in bytes of the recorded GoDataSet objects. Once this value
240  * is reached, additional GoDataSet objects are no longer recorded. This function may not be called
241  * if any GoDataSet object has been recorded, and will return kERROR_STATE in such a case. The recording
242  * must first be cleared by calling GoWebScanProcess_ClearRecording.
243  *
244  * @public @memberof GoWebScanProcess
245  * @param process GoWebScanProcess object.
246  * @param maxRecordSize Max size in bytes of recorded GoDataSet objects.
247  * @return Operation status.
248  */
249 GoWebScanFx(kStatus) GoWebScanProcess_SetMaxRecordSize(GoWebScanProcess process, k64u maxRecordSize);
250 
251 /**
252  * Return the status of the GoDataSet object recording functionality. A status of
253  * GO_WEB_SCAN_PROCESS_RECORD_STATUS_OK indicates there are no issues. A status of
254  * GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MAX_BOARD_COUNT indicates that recording has
255  * stopped, despite being enabled, since the max number of boards resulting from recorded data
256  * has been reached. A status of GO_WEB_SCAN_PROCESS_RECORD_STATUS_STOPPED_AT_MEMORY_LIMIT
257  * indicates that recording has stopped, despite being enabled, since the max specified recording size
258  * in bytes has been reached.
259  *
260  * @public @memberof GoWebScanProcess
261  * @param process GoWebScanProcess object.
262  * @return Recording status.
263  */
264 GoWebScanFx(GoWebScanProcessRecordStatus) GoWebScanProcess_ProcessRecordStatus(GoWebScanProcess process);
265 
266 #include <GoWebScanSdk/GoWebScanProcess.x.h>
267 
268 #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.
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. ...
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.
k64u GoWebScanProcess_RecordSize(GoWebScanProcess process)
Return the approximate total size in bytes of the recorded GoDataSet objects.
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.
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_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 messages and dispatches these messages to data processing tasks.
Represents a container for system-level parameters which are translated from user parameters set in G...
Declares a GoWebScanConfig object.