# CommandHandler

CommandHandler is an automatically generated script that can be found in the folder Scripting\User Scripts\Misc. It is the command call center in program. For almost all applications, it is expected that this file would not modified, It has been documented for completeness.

CommandHandler performs the following functions:

1. Check the command format and send back a suitable acknowledgement string to either CommandsFromPLC or ResultsToPLC device.

The CommandHandler script attempts to decode the command. If the format of the command is incorrect, it returns a suitable error code back to the PLC.

2. When the format is correct, it generates a suitably initialized CommandArgs object and send it to Task Scheduler.

In CommandHandler, information like task's StepID, task name, the behavior of task(Acquire, Process or both), as well as other information such as position index, x, y, theta of stage are extracted and decoded from command string and stored in one or more CommandArgs object(s) as a list. The list is sent to Task Scheduler that executes the appropriate task.