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,21 +426,22 @@ 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);
SCPrintf(con, eLog, "%6.3f reply : %s\n", secondsOfMinute(), lastReply); if (*lastReply != '\0') {
} if (!commError && controller->verbose) {
if(!commError && controller->fd != NULL && lastReply != NULL && *lastReply != '\0'){ SCPrintf(con, eLog, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
fprintf(controller->fd, "%6.3f reply : %s\n", secondsOfMinute(), lastReply); }
} if(!commError && controller->fd != NULL) {
if(lastReply != NULL && *lastReply != '\0'){ fprintf(controller->fd, "%6.3f reply : %s\n", secondsOfMinute(), lastReply);
if(data != NULL && data->controller != NULL){ }
traceIO(data->controller->node->name, "reply:%s", lastReply); if(data != NULL && data->controller != NULL) {
} else { traceIO(data->controller->node->name, "reply:%s", lastReply);
traceIO("sctunknown", "reply:%s", lastReply); } else {
} traceIO("sctunknown", "reply:%s", lastReply);
}
}
} }
/* /*
@@ -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));