diff -r 2645ef311424 -r 62d7957b3aa8 doc/developer_manual.rst --- a/doc/developer_manual.rst Fri Aug 22 08:59:03 2008 +0200 +++ b/doc/developer_manual.rst Tue Aug 26 21:12:01 2008 +0200 @@ -29,9 +29,59 @@ if cnx.check_srq(): print "A Service Request has been sent" -Hight level -=========== +But that's basically it. You can send commands to devices, wait for an +answer, check SRQ line. + +High level +========== + +The high level API is organized around a GPIB controller class +(``pygpibtoolkit.gpibcontroller.GPIBController``) which is responsible +for managing every connection stuff. It will run a thread responsible +for communication processes, will regularly check SRQ line (and +respond accordingly, with ability to register callbacks), etc. + +It will also provide a ``send_command`` method, but this latter will +have a much higher means: the operation can be done synchronously or +asynchronously (with a callback to call upon completion), etc. + +It will also hold device managers for found devices on the GPIB bus. + +Each device manager is a class responsible for communication +specifically with a specified device. It will provide (if the device +manager has been written) simple ways to send GPIB commands of the +device; every GPIB command will be presented as a method of the +manager. + +Talking with a device can then be as simple as:: + + from pygpibtoolkit.gpibcontroller import GPIBController + c = GPIBController() + devices = c.detect_devices() + # devices is a dict which keys are the GPIB addresses + # and values, the managers for each device + hp3562 = devices[3] + + # ok, let's tell the HP3562 to put channel 1 in AC couplig mode, + hp3562.C1AC("AC") + # and put it in linear measure mode + hp3562.LNRS() #EMEAS("LINEAR RES") + # and Freq response mode + hp3562.FRQR() + # set span freq and center freq + hp3562.FRS("10khz") + hp3562.CF("7212hz") + # then get the resulting trace data block + trace = hp3562.DDBN() + # which we can easily display + header, data = hp3562.decode_trace(trace) + import pylab + pylab.plot(data) + pylab.show() + + # ok, let's stop gracefully our cession + c.stop() + -