diff options
Diffstat (limited to 'libvxi11client')
-rw-r--r-- | libvxi11client/client.c | 3 | ||||
-rw-r--r-- | libvxi11client/libvxi11client.c | 14 | ||||
-rw-r--r-- | libvxi11client/libvxi11client.h | 3 |
3 files changed, 14 insertions, 6 deletions
diff --git a/libvxi11client/client.c b/libvxi11client/client.c index f0d9629..d9bb107 100644 --- a/libvxi11client/client.c +++ b/libvxi11client/client.c @@ -172,7 +172,8 @@ int main(int argc, char *argv[]) { printf("\n"); // docmd - if ((err = vxi11_docmd(&ctx, 0x00, false)) > 0) + int dataoutlen; + if ((err = vxi11_docmd(&ctx, NULL, 0, NULL, 0, &dataoutlen, 0x00, false)) > 0) printf("did command, should fail!\n"); else printf("Error calling docmd; %s\n", geterrorstring(err)); 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(¶ms, 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 diff --git a/libvxi11client/libvxi11client.h b/libvxi11client/libvxi11client.h index 740e3d3..ff301d3 100644 --- a/libvxi11client/libvxi11client.h +++ b/libvxi11client/libvxi11client.h @@ -41,5 +41,6 @@ int vxi11_destroy_intr_chan(VXI11Context* context); int vxi11_enable_srq(VXI11Context* context, bool enable, char* handle); int vxi11_start_interrupt_server(void (*callback)(char* handle)); int vxi11_stop_interrupt_server(); -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); int vxi11_close(VXI11Context* context); |