28 #ifndef __ONLP_FAN_H__ 29 #define __ONLP_FAN_H__ 32 #include <onlp/onlp.h> 34 #include <BigList/biglist.h> 39 ONLP_FAN_CAPS_SET_DIR = (1 << 0),
40 ONLP_FAN_CAPS_GET_DIR = (1 << 1),
41 ONLP_FAN_CAPS_SET_RPM = (1 << 2),
42 ONLP_FAN_CAPS_SET_PERCENTAGE = (1 << 3),
43 ONLP_FAN_CAPS_GET_RPM = (1 << 4),
44 ONLP_FAN_CAPS_GET_PERCENTAGE = (1 << 5),
52 ONLP_FAN_DIR_LAST = ONLP_FAN_DIR_F2B,
54 ONLP_FAN_DIR_INVALID = -1,
88 #define ONLP_FAN_INFO_CAP_IS_SET(_pinfo, _name) \ 89 ((_pinfo)->caps & ONLP_FAN_CAPS_##_name) 181 #define ONLP_FAN_STATUS_PRESENT(_fi) ((_fi).hdr.status & ONLP_OID_STATUS.PRESENT) 184 #define ONLP_FAN_STATUS_MISSING(_fi) (!ONLP_FAN_INFO_PRESENT(_fi)) 187 #define ONLP_FAN_STATUS_FAILED(_fi) ( (_fi).hdr.status & ONLP_OID_STATUS.FAILED) 190 #define ONLP_FAN_STATUS_NORMAL(_fi) ( ONLP_FAN_STATUS_PRESENT(_fi) && !ONLP_FAN_STATUS_FAILED(_fi) ) 214 #define ONLP_FAN_CAPS_VALID(_e) \ 215 (onlp_fan_caps_valid((_e))) 223 #define ONLP_FAN_DIR_STRINGS \ 239 #define ONLP_FAN_DIR_VALID(_e) \ 240 ( (0 <= (_e)) && ((_e) <= ONLP_FAN_DIR_F2B)) char serial[ONLP_CONFIG_INFO_STR_MAX]
Definition: fan.h:81
struct onlp_fan_info_s onlp_fan_info_t
enum onlp_fan_caps_e onlp_fan_caps_t
int onlp_fan_rpm_set(onlp_oid_t oid, int rpm)
Set the fan speed in RPMs.
int onlp_fan_info_get(onlp_oid_t oid, onlp_fan_info_t *rv)
Retrieve fan information.
onlp_oid_hdr_t hdr
Definition: fan.h:63
int onlp_fan_info_from_json(cJSON *cj, onlp_fan_info_t *info)
Convert a JSON object to a fan info structure.
onlp_fan_dir_t dir
Definition: fan.h:66
int percentage
Definition: fan.h:75
uint32_t onlp_oid_t
Definition: oids.h:52
const char * onlp_fan_caps_name(onlp_fan_caps_t e)
aim_map_si_t onlp_fan_caps_map[]
onlp_fan_dir_e
Definition: fan.h:48
int onlp_fan_dir_value(const char *str, onlp_fan_dir_t *e, int substr)
int onlp_fan_info_to_json(onlp_fan_info_t *info, cJSON **cj, uint32_t flags)
Convert a fan info structure to JSON.
int onlp_fan_info_to_user_json(onlp_fan_info_t *info, cJSON **cj, uint32_t flags)
Convert a fan info structure to user JSON.
int onlp_fan_sw_denit(void)
Deinitialize the fan software module.
int onlp_fan_caps_get(onlp_oid_t oid, uint32_t *caps)
Retrieve the fan capabilities.
#define ONLP_CONFIG_INFO_STR_MAX
Definition: onlp_config.h:218
int onlp_fan_sw_init(void)
Software Initialization of the Fan module.
onlp_fan_caps_e
Definition: fan.h:38
int onlp_fan_dir_set(onlp_oid_t oid, onlp_fan_dir_t dir)
Set the fan direction.
const char * onlp_fan_dir_desc(onlp_fan_dir_t e)
aim_map_si_t onlp_fan_dir_map[]
int onlp_fan_percentage_set(onlp_oid_t oid, int p)
Set the fan speed in percentage.
char model[ONLP_CONFIG_INFO_STR_MAX]
Definition: fan.h:78
enum onlp_fan_dir_e onlp_fan_dir_t
const char * onlp_fan_caps_desc(onlp_fan_caps_t e)
int onlp_fan_caps_value(const char *str, onlp_fan_caps_t *e, int substr)
uint32_t caps
Definition: fan.h:69
int onlp_fan_hdr_get(onlp_oid_t oid, onlp_oid_hdr_t *hdr)
Retrieve the fan's OID hdr.
int onlp_fan_hw_init(uint32_t flags)
Hardware Initialization of the Fan module.
aim_map_si_t onlp_fan_dir_desc_map[]
const char * onlp_fan_dir_name(onlp_fan_dir_t e)
aim_map_si_t onlp_fan_caps_desc_map[]
int rpm
Definition: fan.h:72
int onlp_fan_caps_valid(onlp_fan_caps_t e)