next up previous contents
Next: Objects In C Up: The Device Server Previous: Executing commands over

The application programmers interface

Device server clients access devices using the application programmer's interface (API). For performance reasons the device server API is based on the file paradigm. The file paradigm is the open-read-write-close paradigm. The device server API paradigm uses the import-put-get-free paradigm.

The three fundamental API calls are --

  1. A call to import a device :
       dev_import (name,ds_handle,access,error)
       char       *name;
       devserver  *ds_handle;
       long       access;
       long       *error;
    
  2. A call to execute a command on a device :
       dev_putget (ds_handle,cmd,argin_ptr,in_type,argout_ptr,out_type,error)
       devserver   ds_handle;
       short       cmd;
       DevArgument *argin_ptr;
       DevType     in_type;
       DevArgument *argout_ptr;
       DevType     out_type;
       long        *error;
    
  3. A call to free a device :
       dev_free (ds_handle,error)
       devserver ds_handle;
       long      *error;
    

Using these three calls clients can execute all commands implemented in the device class on an imported device. All calls are synchronous calls. This means that the clients waits for the call to complete before continuing. If the device server does not respond or the remote machine is down a timeout will occur. If the client continues to try executing dev_putget() calls and in the meantime the device server is running again the device will be automatically reimported. This last feature assumes that the device has been imported correctly before the connection was lost.



Andy Goetz
Tue Jan 28 13:58:13 MET 1997