/** tdslib.c k.furukawa, mar.19.2003. k.f, mar.20.2003. check return value k.f, mar.30.2003. use strlen instead of sizeof k.f, mar.30.2003. shorter timeout (this did not work) k.f, mar.30.2003. intercept signal to clean up communication k.f, apr.5.2003. separate library routines (tdstest4 v1.6) k.f, apr.6.2003. allocate structure locally (v1.6.1) k.f, apr.7.2003. return string (v1.6.2) k.f, apr.10.2003. library for tcltds (tdslib v1.7) k.f, apr.11.2003. use tcltds.h (tdslib v1.7.1) k.f, sep.5.2003. use clnt_control(timeout), device_lock/unlock (v1.8) k.f, sep.6.2003. check magic, add tds_timeout k.f, dec.10.2003. remove device_abort from tds_open (v1.8.5) k.f, sep.3.2007. ignore error at device_async for dso5054a (v1.9.0) k.f, sep.4.2007. 'gpib0' for tektronix, 'inst0' for agilent (v1.9.1) k.f, dec.9.2007. larger buffer size (v1.9.2) k.f, aug.27.2008. made 'inst0' the default (v2.0) **/ /** This file defines 3 local functions and 7 global functions Local functions: tds_malloc -- wrapper for malloc tds_free -- wrapper for free tds_signalhandle -- possible signal handler (does not work ?) Global functions: int tds_init( tds_struct **to_st, char *to_devip ) -- initialize local rpc data structures int tds_open( tds_struct *to_st ) -- open rpc connection to a tds device int tds_timeout( tds_struct *to_st, int millisec ) -- specify processing time-out in milli-seconds int tds_write( tds_struct *to_st, char *to_writestring ) -- write to a tds device int tds_read( tds_struct *to_st, char *to_print ) -- read from a tds device int tds_lock( tds_struct *to_st ) -- lock a tds device int tds_unlock( tds_struct *to_st ) -- unlock a tds device int tds_close( tds_struct *to_st ) -- close rpc connection This library works at least with following devices. Tektronix TDS3xxxB Tektronix DPO3xxx Tektronix DPO4xxx Tektronix DPO7xxx Tektronix DSA8xxx Agilent DSO5xxx **/ /** * int tds_init( tds_struct **to_st, char *to_devip ) * -- initialize local rpc data structures **/ /** * int tds_open( tds_struct *to_st ) * -- open rpc connection to a tds device **/ /** * int tds_timeout( tds_struct *to_st, int millisec ) * -- specify timeout in milli-seconds **/ /** * int tds_write( tds_struct *to_st, char *to_writestring ) * -- write to a tds device **/ /** * int tds_read( tds_struct *to_st, char *to_print ) * -- read from a tds device **/ /** * int tds_lock( tds_struct *to_st ) * -- lock a tds device **/ /** * int tds_unlock( tds_struct *to_st ) * -- unlock a tds device **/ /** * int tds_close( tds_struct *to_st ) * -- close rpc connection **/ /** Sample main routine Shell command usage: tdstest -- please specify arguments usage: tdstest {ip} {command} [{debug}] ex.: tdstest 172.19.68.21 '*idn?' ex.: tdstest 172.19.68.21 '*idn?' debug **/ Other examples are; tdstest osc1 \ 'ch1:pos?;vol?;:dat:sou ch1;enc asci;star 16400;stop 66600;:curve?' > d1.dat tdstest 172.19.73.170 'FETCH?' inst0