Device servers were first developed at the European Synchrotron Radiation Facility (ESRF) for controlling the 6 GeV synchrotron radiation source. This document is a Programmer's Manual on how to write device servers. It will not go into the details of the ESRF, nor its Control System nor any of the specific device servers in the Control System. Various papers describe these topics already. Readers are referred to Laclare (1983) for a description of the ESRF, to Götz et al (1991) for the Control System and the Device Server User Guides (or DSUGs) for specific device servers. The role of this document is to help programmers faced with the task of writing device servers.
Device servers have been developed at the ESRF in order to solve the main task of the Control System viz. provide read and write access to all devices in a distributed system. The problem of distributed device access is only part of the problem however. The other part of the problem is providing a programming framework for a large number of devices programmed by a large number of programmers each having different levels of experience and style.
Device servers have been written at the ESRF for a large variety of different devices. Devices vary from serial line devices to devices interfaced by field-bus to memory mapped VME cards to entire VME/VXI data acquisition systems. The definition of a device depends very much on the user's requirements. In the simple case a device server can be used to hide the serial line protocol required to communicate with a device. For more complicated devices the device server can be used to hide the entire complexity of the device timing, configuration and acquisition cycle behind a set of high level commands.
A model (referred to as the Device Server Model or DSM) has been developed to satisfy the main two requirements. In order to do this the DSM has a number of parts to it. It defines the concept of a generic device which is created and managed in a server -- a device server. The device is accessed by an application programmers interface (api) which is network transparent. Device specific details get treated in the device servers thereby freeing applications to do application-oriented work. Multiple access is implemented by queuing requests -- the queuing is handled automatically by the network software.
In this manual the process of how to write device servers will be treated. The manual has been organised as follows -- chapter 2 presents an historical account of device servers. The device server model (DSM) is treated in chapter 3. This is followed by a chapter on Objects in C (the Object Oriented Programming methodology used to implement the device servers). Chapter 5 describes how to write a device server. Chapter 6 is devoted to techniques in using classes. Chapter 7 is reserved for Frequently Asked Questions. Finally there is a discussion of limitations in the present device server model and what improvements are planned.
Throughout this manual examples of source code will be given in order to illustrate what is meant. The examples have been taken from the AGPowerSupplyClass - a simulation of a powersupply which illustrates how a typical device server for a powersupply at the ESRF functions. The simulation runs under OS9 and Unix operating systems and requires no hardware in order to run.