Each device has a list of commands which can be executed by the Application across the network or locally. These commands are the Application Programmer's network knobs and dials for interacting with the device.
The list of commands to be implemented depends on the capabilities of the hardware, the list of sensible functions which can be executed at a distance and of course the functionality required by the application. This implies a close collaboration between the Equipment Responsible, Device Server Programmer and the Application Programmer.
When drawing up the list of commands particular attention should be paid to the following points -
The command names should be drawn up by the Device Server Programmer and the Device Server Source Custodian. All commands are presently stored in a single header file ( DevCmds.h) and therefore the names have to be chosen so that there is no name clash and that they fit in with the naming convention used. It is often possible to reuse existing commands for new devices. The argument types which need to be passed for the commands should also be discussed with the Device Server Source Custodian. He can give advice where necessary on what types can be used how.
The list of device commands should be written and discussed with the Equipment Responsible and the Applications Programmer before any coding is started. The commands list should be used as the basis for the Device Servers User Guide, a document which has to exist for each device server. Don't forget documentation is part of the design and as such should be finished before the program.
The commands and the types they use are defined in the header of the class .c file. Here is an example of the commands defined for the AGPowerSupplyClass -
static DevCommandListEntry commands_list[] = { {DevOff, dev_off, D_VOID_TYPE, D_VOID_TYPE}, {DevOn, dev_on, D_VOID_TYPE, D_VOID_TYPE}, {DevState, dev_state, D_VOID_TYPE, D_SHORT_TYPE}, {DevSetValue, dev_setvalue, D_FLOAT_TYPE, D_VOID_TYPE}, {DevReadValue, dev_readvalue, D_VOID_TYPE, D_FLOAT_READPOINT}, {DevReset, dev_reset, D_VOID_TYPE, D_VOID_TYPE}, {DevStatus, dev_status, D_VOID_TYPE, D_STRING_TYPE}, {DevError, dev_error, D_VOID_TYPE, D_VOID_TYPE}, {DevLocal, dev_local, D_VOID_TYPE, D_VOID_TYPE}, {DevRemote, dev_remote, D_VOID_TYPE, D_VOID_TYPE}, {DevUpdate, dev_update, D_VOID_TYPE, D_STATE_FLOAT_READPOINT}, }; static long n_commands = sizeof(commands_list)/sizeof(DevCommandListEntry);