summaryrefslogtreecommitdiff
path: root/libvxi11client/libvxi11client.c
diff options
context:
space:
mode:
Diffstat (limited to 'libvxi11client/libvxi11client.c')
-rw-r--r--libvxi11client/libvxi11client.c14
1 files changed, 10 insertions, 4 deletions
diff --git a/libvxi11client/libvxi11client.c b/libvxi11client/libvxi11client.c
index 66bb020..f504def 100644
--- a/libvxi11client/libvxi11client.c
+++ b/libvxi11client/libvxi11client.c
@@ -234,7 +234,8 @@ int vxi11_read(VXI11Context* context, char* buffer, unsigned int bufferlen, bool
* call docmd with the specified command
*/
-int vxi11_docmd(VXI11Context* context, unsigned long cmd, bool waitforlock) {
+int vxi11_docmd(VXI11Context* context, char* datain, int datainlen, char* dataout, int outbufferlen, int* dataoutlen,
+ unsigned long cmd, bool waitforlock) {
if (context->clnt == NULL)
return 0;
@@ -242,12 +243,17 @@ int vxi11_docmd(VXI11Context* context, unsigned long cmd, bool waitforlock) {
.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;
+ params.data_in.data_in_len = datainlen;
+ params.data_in.data_in_val = datain;
Device_DocmdResp* resp = device_docmd_1(&params, context->clnt);
- if (resp != NULL && resp->error == 0)
+ if (resp != NULL && resp->error == 0) {
+ if (dataout != NULL)
+ strncpy(dataout, resp->data_out.data_out_val,
+ (resp->data_out.data_out_len > outbufferlen ? outbufferlen : resp->data_out.data_out_len));
+ *dataoutlen = resp->data_out.data_out_len;
return 1;
+ }
else if (resp == NULL)
return 0;
else