diff options
author | daniel <danieruru@gmail.com> | 2013-01-09 14:45:33 +0900 |
---|---|---|
committer | daniel <danieruru@gmail.com> | 2013-01-09 14:45:33 +0900 |
commit | 57bec4c29edc96491328c8f60fe76055ab2f4008 (patch) | |
tree | 4b4f5adf6015e3bde96975601992df44a7a574eb /libvxi11client/libvxi11client.c | |
parent | 2c93550a5394c632ae6b820e38ca75ab5df5aae7 (diff) |
add a waitlock parameter to all of the calls that care about it
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r-- | libvxi11client/libvxi11client.c | 42 |
1 files changed, 22 insertions, 20 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c index 4e3efd0..6234c0f 100644 --- a/libvxi11client/libvxi11client.c +++ b/libvxi11client/libvxi11client.c @@ -59,12 +59,12 @@ int vxi11_open(char* address, char* device) { * read the status byte of the connected server */ -int vxi11_readstatusbyte() { +int vxi11_readstatusbyte(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = - VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = + VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_ReadStbResp* resp = device_readstb_1(¶ms, clnt); if (resp != NULL && resp->error == 0) @@ -122,12 +122,13 @@ int vxi11_read(char* buffer, unsigned int bufferlen, bool waitlock, bool termchr * */ -int vxi11_docmd(unsigned long cmd) { +int vxi11_docmd(unsigned long cmd, bool waitforlock) { if (clnt == NULL) return 0; - Device_DocmdParms params = { .lid = link, .flags = 0x0, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = - VXI11_DEFAULT_TIMEOUT, .cmd = cmd, .network_order = 0, .datasize = 0 }; + Device_DocmdParms params = + { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .io_timeout = VXI11_DEFAULT_TIMEOUT, + .lock_timeout = VXI11_DEFAULT_TIMEOUT, .cmd = cmd, .network_order = 0, .datasize = 0 }; params.data_in.data_in_len = 0; params.data_in.data_in_val = NULL; @@ -145,12 +146,12 @@ int vxi11_docmd(unsigned long cmd) { * trigger the connected device */ -int vxi11_trigger() { +int vxi11_trigger(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = - VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = + VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_trigger_1(¶ms, clnt); if (error->error == 0) @@ -163,11 +164,11 @@ int vxi11_trigger() { * clear the connected device */ -int vxi11_clear() { +int vxi11_clear(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = - VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = + VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_clear_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -181,11 +182,11 @@ int vxi11_clear() { * remote the connected device */ -int vxi11_remote() { +int vxi11_remote(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = - VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = + VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_remote_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -199,11 +200,11 @@ int vxi11_remote() { * local the connected device */ -int vxi11_local() { +int vxi11_local(bool waitforlock) { if (clnt == NULL) return 0; - Device_GenericParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = - VXI11_DEFAULT_TIMEOUT }; + Device_GenericParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = + VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_local_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; @@ -217,10 +218,11 @@ int vxi11_local() { * lock the connected device */ -int vxi11_lock() { +int vxi11_lock(bool waitforlock) { if (clnt == NULL) return 0; - Device_LockParms params = { .lid = link, .flags = 0x0, .lock_timeout = VXI11_DEFAULT_TIMEOUT }; + Device_LockParms params = { .lid = link, .flags = vxi11_generateflags(waitforlock, false, false), .lock_timeout = + VXI11_DEFAULT_TIMEOUT }; Device_Error* error = device_lock_1(¶ms, clnt); if (error != NULL && error->error == 0) return 1; |