Each device class implements a list of commands. Commands are very important because they are the client's dials and knobs for controlling a device. Commands are like special methods. They difference being they cannot be inherited by subclasses and they have a fixed calling syntax - consisting of one input argument and on output argument. Arguments can be any C type varying from simple types to complicated structures. Commands can execute any sequence of actions. However because all commands are executed synchronously commands timing can become critical.
Commands are executed across the network using the application programmers interface function dev_putget(). dev_putget() calls a special method implemented in the root class - the command_handler method. The command_handler calls the state_handler method implemented in the device class before calling the command itself. The state_handler implements the state machine for all devices belonging to that device class. The state machine checks to see wether the command to be executed is compatible with the present state. The command function is only executed if the state handler returns DS_OK. The control flow at command execution is represented in figure 2.
Figure 2: Flow of command execution