From f1cd7de018b623d19a8f42ac47f0271a28eedcce Mon Sep 17 00:00:00 2001
From: Jan Breuer <jan.breuer@jaybee.cz>
Date: 周日, 19 4月 2015 06:43:16 +0800
Subject: [PATCH] Implement Traversal of the Header Tree. Solve #22

---
 examples/common/scpi-def.c |   20 +++++++++++++++++---
 1 files changed, 17 insertions(+), 3 deletions(-)

diff --git a/examples/common/scpi-def.c b/examples/common/scpi-def.c
index 562b67b..699a803 100644
--- a/examples/common/scpi-def.c
+++ b/examples/common/scpi-def.c
@@ -149,7 +149,7 @@
     }
     
     SCPI_ChoiceToName(trigger_source, param, &name);
-    fprintf(stderr, "\tP1=%s (%d)\r\n", name, param);
+    fprintf(stderr, "\tP1=%s (%ld)\r\n", name, (long int)param);
     
     SCPI_ResultInt(context, param);
 
@@ -186,6 +186,21 @@
     return SCPI_RES_OK;
 }
 
+/**
+ * Reimplement IEEE488.2 *TST?
+ *
+ * Result should be 0 if everything is ok
+ * Result should be 1 if something goes wrong
+ *
+ * Return SCPI_RES_OK
+ */
+scpi_result_t My_CoreTstQ(scpi_t * context) {
+
+    SCPI_ResultInt(context, 0);
+
+    return SCPI_RES_OK;
+}
+
 static const scpi_command_t scpi_commands[] = {
     /* IEEE Mandated Commands (SCPI std V1999.0 4.1.1) */
     { .pattern = "*CLS", .callback = SCPI_CoreCls,},
@@ -199,7 +214,7 @@
     { .pattern = "*SRE", .callback = SCPI_CoreSre,},
     { .pattern = "*SRE?", .callback = SCPI_CoreSreQ,},
     { .pattern = "*STB?", .callback = SCPI_CoreStbQ,},
-    { .pattern = "*TST?", .callback = SCPI_CoreTstQ,},
+    { .pattern = "*TST?", .callback = My_CoreTstQ,},
     { .pattern = "*WAI", .callback = SCPI_CoreWai,},
 
     /* Required SCPI commands (SCPI std V1999.0 4.2.1) */
@@ -249,7 +264,6 @@
     .control = SCPI_Control,
     .flush = SCPI_Flush,
     .reset = SCPI_Reset,
-    .test = SCPI_Test,
 };
 
 #define SCPI_INPUT_BUFFER_LENGTH 256

--
Gitblit v1.9.1