suppress empty reply and print nodepath

This commit is contained in:
Douglas Clowes
2012-11-29 12:57:35 +11:00
parent 933c7157cd
commit f57fe9262e

View File

@@ -426,22 +426,23 @@ static char *SctActionHandler(void *actionData, char *lastReply,
* property result to the data from the device. Read this now and * property result to the data from the device. Read this now and
* print it if diagnostics is required. * print it if diagnostics is required.
*/ */
SetProp(node, controller->node, "result", lastReply);
script = NULL; script = NULL;
if (!commError && controller->verbose && lastReply != NULL if (lastReply != NULL) {
&& *lastReply != '\0') { SetProp(node, controller->node, "result", lastReply);
if (*lastReply != '\0') {
if (!commError && controller->verbose) {
SCPrintf(con, eLog, "%6.3f reply : %s\n", secondsOfMinute(), lastReply); SCPrintf(con, eLog, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
} }
if(!commError && controller->fd != NULL && lastReply != NULL && *lastReply != '\0'){ if(!commError && controller->fd != NULL) {
fprintf(controller->fd, "%6.3f reply : %s\n", secondsOfMinute(), lastReply); fprintf(controller->fd, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
} }
if(lastReply != NULL && *lastReply != '\0'){ if(data != NULL && data->controller != NULL) {
if(data != NULL && data->controller != NULL){
traceIO(data->controller->node->name, "reply:%s", lastReply); traceIO(data->controller->node->name, "reply:%s", lastReply);
} else { } else {
traceIO("sctunknown", "reply:%s", lastReply); traceIO("sctunknown", "reply:%s", lastReply);
} }
} }
}
/* /*
* When this is a followup, we use the content of the * When this is a followup, we use the content of the
@@ -930,12 +931,15 @@ int SctAddPollNode(SctController * controller, Hdb * node, double interval,
{ {
SctData *data; SctData *data;
hdbCallback *cb; hdbCallback *cb;
char nodePath[512], info[1024];
if (!FindHdbCallbackData(node, controller)) { if (!FindHdbCallbackData(node, controller)) {
cb = MakeHipadabaCallback(SctMainCallback, controller, NULL); cb = MakeHipadabaCallback(SctMainCallback, controller, NULL);
assert(cb); assert(cb);
AppendHipadabaCallback(node, cb); AppendHipadabaCallback(node, cb);
SetHdbProperty(node, "geterror", "Not read yet"); GetHdbPath(node, nodePath, sizeof nodePath);
snprintf(info, 1023, "%s: Not read yet", nodePath);
SetHdbProperty(node, "geterror", info);
} }
data = calloc(1, sizeof(*data)); data = calloc(1, sizeof(*data));