EPICS StreamDevice

What is StreamDevice?

StreamDevice is a generic EPICS device support for devices with a "byte stream" based communication interface. That means devices that can be controlled by sending and receiving strings (in the broadest sense, including non-printable characters and even null-bytes). Examples for this type of communication interface are serial line (RS-232, RS-485, ...), IEEE-488 (also known as GPIB or HP-IB), and telnet-like TCP/IP.

StreamDevice is not limited to a specific device type or manufacturer nor is it necessary to re-compile anything to support a new device type. Instead, it can be configured for any device type with protocol files in plain ASCII text which describes the commands a device understands and the replies it sends. If the device can be controlled with strings like "RF:FREQ 499.655 MHZ" StreamDevice can be used. Formatting and parsing of values is done with format converters similar to those known from the C functions printf() and scanf(). To support other formats, it is possible to write your own converters.

Each record with StreamDevice support runs one protocol from the protocol file to read or write its value. Protocols can be as simple as just one output string or can consist of many strings sent to and read from the device. However, a protocol is linear. That means it runs from start to end each time the record is processed. It does not provide loops or branches.

StreamDevice comes with an interface to asynDriver but can be extended to support other bus drivers. Note that StreamDevice is not an alternative or replacement but a supplement for asynDriver. StreamDevice converts record values to and from strings but leaves it to asynDriver (or other bus interfaces) to exchange these strings with the device. Thus any bus type supported by asynDriver (to be exact by asynOctet) can automatically be used with StreamDevice.

StreamDevice supports all standard records of EPICS base which can have device support. It is also possible to write support for new record types.

What is StreamDevice not?

It is not a programming language for a high-level application. It is, for example, not possible to write a complete scanning program in a protocol. Use other tools for that and use StreamDevice only for the primitive commands.

It is not a block oriented device support. It is not possible to send or receive huge blocks of data that contain many process variables distributed over many records.

Recommended Readings

IOC Application Developer's Guide

EPICS Record Reference Manual

Color and Style Conventions

In this document, code is witten in green fixed width font. This marks text you typically type in configuration files etc.

Longer code segments are often set in a box.

Important modifications and new features are highlighted with a yellow background. Obsolete features are highlighted and crossed out.

Next: Setup

Dirk Zimoch, 2011