Handshake
The handshake is for an operation that can take longer than about 1 s, or that a client must start
without waiting for it. Client and module take turns on two nodes, ready and request. Nobody
waits inside a call: the client polls, and the module answers through nodes.
The Cam Driver, AI Object Matching and Calibration offer handshakes.
Addresses
| Address | Type | Meaning |
|---|---|---|
|
bool, read-only |
set by the module: |
|
bool, writable |
set by the client to start the function |
|
int32, read-only |
the module’s status, one for all its functions. See Status Codes and Results |
|
string, read-only |
the same as text, for people - use the code in program logic |
|
writable |
the function’s inputs, written before the request |
|
read-only |
its results |
|
read-only |
counts finished operations: a new value means new outputs |
<module> is hdvisionsystems/<app>/<module name>, for example
hdvisionsystems/lumiscan-calibration/plane1/control/transform/request.
The sequence
-
Wait until
control/<function>/readyistrue. -
Write the function’s inputs.
-
Set
control/<function>/requesttotrue. -
Wait until
readyisfalse: the module has seen the request. -
Set
requesttofalse. -
Wait until
readyistrueagain: the function has finished. -
Read
control/status/codeand the results underoutput/.output/package-identifierhas grown by one.
Poll at 50 to 100 ms.
What the module shows
As Calibration runs it:
| Step | ready |
request |
status/code |
|---|---|---|---|
Idle |
|
|
|
The client requests |
|
|
|
The module acknowledges |
|
|
|
The client confirms; the function runs |
|
|
|
Done |
|
|
|
Rules
-
Only one program writes a
requestnode. Two programs writing it independently can lose a request. A program that cannot coordinate with others uses the execute method, which refuses a second call while one runs. -
The module waits for
requestto fall, for as long as it takes. There is no timeout: arequeststilltrueafterwards would be read as a new request. -
A handshake and an execute method of the same module share one lock. While a handshake runs, an execute call of the same module answers that it is busy.
How the apps differ
Calibration follows the sequence exactly. The Cam Driver and AI Object Matching differ in ways a PLC program must know:
| App | Difference |
|---|---|
Cam Driver |
|
AI Object Matching |
|
To read the outcome of a Cam Driver capture or an AI inference directly, use its execute method:
the status then keeps the operation’s own code.