2007/07/05

Bridge pattern

Giving a change to what I have written until now, I think I can go deep in my daily work. In the synchrotron I have some projects in control software development. One of this projects is one Tango device server development to do a remote control of Oscilloscopes. I said something a couple of days a go, here, but only superficially now is a moment to explain a little bit deeper.

The problem:
In the instrumentation remote control there are much protocols to do this control. This protocols will do the same but in different ways, and some of them have different layer levels of abstraction. For example, GPIB or VXI-11 are in the lowest layer level and some times you will depends to the current instrument. Upper layer I like to use a library with the VISA specifications, but this could be not easy.

There are one general specification, but the manufacturers creates control implementations close to it, but not exactly compliant with in it. That is to say, the basic functions should be work in the same way between manufacturers (this is the reason for being of this specs), but some instruments can implement some special functions (or not implement, some others). Then some manufacturers have theirs special libraries.

One possible pattern solution:
To solve my problem about the control of an instrument connected to the Tango control system by an agent of this distributed system, one possibility is separate the abstraction to the several possible implementations. The bridge pattern should be my solution. The agent knows about the problem abstraction with a class that have the need methods, and have a reference to the real environment that knows how to talk with the real instrument.

In the construction on the instrument abstraction, also is created an object of control.

This idea allows the agent to call the abstraction class methods where implemented functions are. In the contruction time the concrete control environment will be decided, but this is not mandatory. By now the abstraction works forever of its existence with the same ControlEnvirinment object, but anything forbids to do the open with VISA and after some methods moves it to one specific manufacturer VISA library.


Right now, there is implemented (and it works) the identification with the VXI-11 protocol and also with VISA. But the capture presents some challenges... After a non productive try to capture with vxi-11, I dedicate my efforts to the ni-VISA library. It presents some advantages, specially a callback subscription executed when new data are available. Any suggestion to 'move' this data from the VISA object to the Tek_DPO7254 without movement?

No comments: