From 047fcb18ded8438d5763ad537c64a2c110052a11 Mon Sep 17 00:00:00 2001 From: "Michael J. Chudobiak" Date: Mon, 15 Oct 2012 12:48:09 -0400 Subject: first attempt at gpib query responses --- gpib.c | 9 ++++++++- instr-daemon.c | 2 +- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/gpib.c b/gpib.c index c1c097b..9ebefa1 100644 --- a/gpib.c +++ b/gpib.c @@ -3,6 +3,7 @@ #include "flash.h" #include "error_utils.h" #include "bus.h" +#include /* TNT Configuration --------------------------------------------------------*/ @@ -770,12 +771,18 @@ static void TNT_Holdoff_off() } -int GPIB_send_query_response(char *out_buffer) +int GPIB_send_query_response(char *in_string) { if (!globals.HWDetect.gpib) { return OK; } + if (GPIB_response_already_pending()) { /* if MAV already, data will be lost. Set QYE bit in STB. */ + queue_error_for_gpib_only(query_error_interrupted); + } + + gchar *out_buffer = g_strdup_printf ("%s\n", in_string); + /* message must be available if this function has been called */ unsigned long int out_cnt; diff --git a/instr-daemon.c b/instr-daemon.c index e1e29fb..2534d73 100644 --- a/instr-daemon.c +++ b/instr-daemon.c @@ -345,7 +345,7 @@ static gboolean periodic_poll (void) GPIB_check_for_device_clear_signal(); if (GPIB_check_for_messages(globals.Registers.gpib_buffer)) { if (GPIB_handle_new_input(globals.Registers.gpib_buffer)) { - Parser_main(globals.Registers.gpib_buffer, 0, NULL, NULL); + Parser_main(globals.Registers.gpib_buffer, 1, GPIB_send_query_response, NULL); } } GPIB_check_for_device_clear_signal(); -- cgit