CODE EXAMPLE 2-1 Sample envmond Application Program (Continued)
*resulth = childh; return (PICL_SUCCESS);
}
if (get_child_by_name(childh, name, resulth) == PICL_SUCCESS) { return (PICL_SUCCESS);
}
/* get next child node */
rc = picl_get_propval_by_name(childh, PICL_PROP_PEER, &nexth, sizeof (picl_nodehdl_t));
if (rc != PICL_SUCCESS) { return (rc);
}
childh = nexth;
}
return (rc);
}
void
get_sensor_thresholds(picl_nodehdl_t nodeh)
{
int8_t threshold;
if (picl_get_propval_by_name(nodeh, HI_POWEROFF_THRESHOLD, &threshold, sizeof (threshold)) != PICL_SUCCESS) { fprintf(stderr, "Failed to read high
} else
fprintf(stdout, "High
if (picl_get_propval_by_name(nodeh, HI_SHUTDOWN_THRESHOLD, &threshold, sizeof (threshold)) != PICL_SUCCESS) { fprintf(stderr, "Failed to read high shutdown threshold.");
} else
fprintf(stdout, "High shutdown threshold = %d\n", threshold);
if (picl_get_propval_by_name(nodeh, HI_WARNING_THRESHOLD, &threshold, sizeof (threshold)) != PICL_SUCCESS) { fprintf(stderr, "Failed to read high warning threshold.");
} else
fprintf(stdout, "High warning threshold = %d\n", threshold);
if (picl_get_propval_by_name(nodeh, LO_POWEROFF_THRESHOLD, &threshold, sizeof (threshold)) != PICL_SUCCESS) { fprintf(stderr, "Failed to read low
} else
fprintf(stdout, "Low shutdown threshold = %d\n", threshold);