summaryrefslogtreecommitdiff
path: root/libvxi11client/libvxi11client.c
diff options
context:
space:
mode:
authorMichael J. Chudobiak <mjc@avtechpulse.com>2013-02-26 09:35:56 -0500
committerMichael J. Chudobiak <mjc@avtechpulse.com>2013-02-26 09:35:56 -0500
commit54101b8119b91052a6f8a2d0e884280e85ea1d51 (patch)
treeeafe00a7891a70affc72619beecf1d0e72a2af83 /libvxi11client/libvxi11client.c
parent772b187618db9ebc8f9bd68041369db8f9f00db5 (diff)
longer default vxi IO timeouts
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r--libvxi11client/libvxi11client.c31
1 files changed, 17 insertions, 14 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c
index cb013ff..88fa6cb 100644
--- a/libvxi11client/libvxi11client.c
+++ b/libvxi11client/libvxi11client.c
@@ -23,7 +23,10 @@
#define FLAG_END (1 << 3)
#define FLAG_WAITLOCK 1
-#define VXI11_DEFAULT_TIMEOUT 1000
+// in milliseconds
+#define LOCK_TIMEOUT 1000
+#define IO_TIMEOUT 5000
+#define POLL_TIMEOUT 1000
static GThread* interruptthread;
static void (*interruptcallback)(char*) = NULL;
@@ -113,7 +116,7 @@ int vxi11_open(VXI11Context* context, char* address, char* device) {
Create_LinkParms link_parms;
link_parms.clientId = (long) context->clnt;
link_parms.lockDevice = 0;
- link_parms.lock_timeout = VXI11_DEFAULT_TIMEOUT;
+ link_parms.lock_timeout = LOCK_TIMEOUT;
link_parms.device = device != NULL ? device : "device0";
Create_LinkResp* linkresp = create_link_1(&link_parms, context->clnt);
@@ -169,7 +172,7 @@ int vxi11_readstatusbyte(VXI11Context* context, bool waitforlock) {
}
Device_GenericParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT };
+ .lock_timeout = LOCK_TIMEOUT, .io_timeout = IO_TIMEOUT };
Device_ReadStbResp* resp = device_readstb_1(&params, context->clnt);
if (resp != NULL && resp->error == 0)
@@ -194,8 +197,8 @@ int vxi11_write(VXI11Context* context, char* data, int len, bool waitlock, bool
return 0;
}
- Device_WriteParms params = { .lid = context->devicelink, .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout =
- VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, end, false) };
+ Device_WriteParms params = { .lid = context->devicelink, .io_timeout = IO_TIMEOUT, .lock_timeout =
+ LOCK_TIMEOUT, .flags = vxi11_generateflags(waitlock, end, false) };
params.data.data_len = len < 0 ? strlen(data) : len;
params.data.data_val = data;
@@ -223,8 +226,8 @@ int vxi11_read(VXI11Context* context, char* buffer, unsigned int bufferlen, bool
return 0;
}
- Device_ReadParms params = { .lid = context->devicelink, .requestSize = 256, .io_timeout = VXI11_DEFAULT_TIMEOUT,
- .lock_timeout = VXI11_DEFAULT_TIMEOUT, .flags = vxi11_generateflags(waitlock, false, termchrset),
+ Device_ReadParms params = { .lid = context->devicelink, .requestSize = 256, .io_timeout = IO_TIMEOUT,
+ .lock_timeout = LOCK_TIMEOUT, .flags = vxi11_generateflags(waitlock, false, termchrset),
.termChar = termchrset ? termchr : 0 };
Device_ReadResp* resp = device_read_1(&params, context->clnt);
@@ -266,7 +269,7 @@ int vxi11_docmd(VXI11Context* context, char* datain, int datainlen, char* dataou
}
Device_DocmdParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .io_timeout = VXI11_DEFAULT_TIMEOUT, .lock_timeout = VXI11_DEFAULT_TIMEOUT, .cmd = cmd, .network_order = 0,
+ .io_timeout = IO_TIMEOUT, .lock_timeout = LOCK_TIMEOUT, .cmd = cmd, .network_order = 0,
.datasize = 0 };
if (datain == NULL )
@@ -304,7 +307,7 @@ int vxi11_trigger(VXI11Context* context, bool waitforlock) {
}
Device_GenericParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT };
+ .lock_timeout = LOCK_TIMEOUT, .io_timeout = IO_TIMEOUT };
Device_Error* error = device_trigger_1(&params, context->clnt);
if (error->error == 0)
@@ -327,7 +330,7 @@ int vxi11_clear(VXI11Context* context, bool waitforlock) {
return 0;
}
Device_GenericParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT };
+ .lock_timeout = LOCK_TIMEOUT, .io_timeout = IO_TIMEOUT };
Device_Error* error = device_clear_1(&params, context->clnt);
if (error != NULL && error->error == 0)
return 1;
@@ -349,7 +352,7 @@ int vxi11_remote(VXI11Context* context, bool waitforlock) {
return 0;
}
Device_GenericParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT };
+ .lock_timeout = LOCK_TIMEOUT, .io_timeout = IO_TIMEOUT };
Device_Error* error = device_remote_1(&params, context->clnt);
if (error != NULL && error->error == 0)
return 1;
@@ -371,7 +374,7 @@ int vxi11_local(VXI11Context* context, bool waitforlock) {
return 0;
}
Device_GenericParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .lock_timeout = VXI11_DEFAULT_TIMEOUT, .io_timeout = VXI11_DEFAULT_TIMEOUT };
+ .lock_timeout = LOCK_TIMEOUT, .io_timeout = IO_TIMEOUT };
Device_Error* error = device_local_1(&params, context->clnt);
if (error != NULL && error->error == 0)
return 1;
@@ -393,7 +396,7 @@ int vxi11_lock(VXI11Context* context, bool waitforlock) {
return 0;
}
Device_LockParms params = { .lid = context->devicelink, .flags = vxi11_generateflags(waitforlock, false, false),
- .lock_timeout = VXI11_DEFAULT_TIMEOUT };
+ .lock_timeout = LOCK_TIMEOUT };
Device_Error* error = device_lock_1(&params, context->clnt);
if (error != NULL && error->error == 0)
return 1;
@@ -477,7 +480,7 @@ static gpointer interruptthreadfunc(gpointer data) {
my_pollfd[i].revents = 0;
}
- switch (i = poll(my_pollfd, max_pollfd, VXI11_DEFAULT_TIMEOUT)) {
+ switch (i = poll(my_pollfd, max_pollfd, POLL_TIMEOUT)) {
case -1:
break;
case 0: