beautypg.com

Sun Microsystems Netra CP2500 User Manual

Page 52

background image

38

Netra CP2500 Board Programming Guide • March 2007

*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 power-off threshold.");

} else

fprintf(stdout, "High power-off threshold = %d\n", threshold);

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 power-off threshold.");

} else

fprintf(stdout, "Low shutdown threshold = %d\n", threshold);

CODE EXAMPLE 2-1

Sample envmond Application Program (Continued)