当前位置: 首页>>代码示例>>Python>>正文


Python OpenIPMI.get_event_support_string方法代码示例

本文整理汇总了Python中OpenIPMI.get_event_support_string方法的典型用法代码示例。如果您正苦于以下问题:Python OpenIPMI.get_event_support_string方法的具体用法?Python OpenIPMI.get_event_support_string怎么用?Python OpenIPMI.get_event_support_string使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在OpenIPMI的用法示例。


在下文中一共展示了OpenIPMI.get_event_support_string方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: __init__

# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import get_event_support_string [as 别名]
    def __init__(self, e, sensor):
        if (e.ui.in_destroy):
            return
        self.e = e
        self.name = sensor.get_name()
        e.sensors[self.name] = self
        self.sensor_id = sensor.get_id()
        self.ui = e.ui
        ui = self.ui
        self.destroyed = False
        self.updater = SensorRefreshData(self)
        ui.add_sensor(self.e, self)
        self.in_warning = False
        self.in_severe = False
        self.in_critical = False
        self.ui.append_item(self, "Sensor Type",
                            sensor.get_sensor_type_string())
        self.ui.append_item(self, "Event Reading Type",
                            sensor.get_event_reading_type_string())
        m = sensor.get_mc()
        self.ui.append_item(self, "Msg Routing Info",
                            "MC: " + m.get_name()
                            + "  LUN:" + str(sensor.get_lun())
                            + "  Num:" + str(sensor.get_num()))
                            
        self.event_support = sensor.get_event_support()
        es = self.event_support
        self.ui.append_item(self, "Event Support",
                            OpenIPMI.get_event_support_string(es))
        if ((es == OpenIPMI.EVENT_SUPPORT_PER_STATE)
            or (es == OpenIPMI.EVENT_SUPPORT_ENTIRE_SENSOR)):
            self.event_enables = self.ui.append_item(self, "Event Enables",
                                      None,
                                      data = SensorInfoGetter(self,
                                                       "get_event_enables"))
            pass

        sensor.add_event_handler(self)
        if (sensor.is_readable()):
            sensor.get_value(self)
            pass
        else:
            self.ui.set_item_text(self.treeroot, "(not readable)")
            pass

        self.auto_rearm = sensor.get_supports_auto_rearm()

        self.is_threshold = (sensor.get_event_reading_type()
                             == OpenIPMI.EVENT_READING_TYPE_THRESHOLD)
        if (self.is_threshold):
            self.threshold_sensor_units = sensor.get_base_unit_string()
            modifier = sensor.get_modifier_unit_use();
            if (modifier == OpenIPMI.MODIFIER_UNIT_BASE_DIV_MOD):
               self.threshold_sensor_units += "/"
               pass
            elif (modifier == OpenIPMI.MODIFIER_UNIT_BASE_MULT_MOD):
               self.threshold_sensor_units += "*"
               pass
            modifier = sensor.get_modifier_unit_string()
            if (modifier != "unspecified"):
                self.threshold_sensor_units += modifier
                pass
            self.threshold_sensor_units += sensor.get_rate_unit_string()
            if (sensor.get_percentage()):
                self.threshold_sensor_units += '%'
                pass

            self.events_supported = [ ]
            if (es != OpenIPMI.EVENT_SUPPORT_NONE):
                for i in threshold_event_strings:
                    ival = [ 0 ]
                    rv = sensor.threshold_event_supported(i, ival)
                    if (rv == 0) and (ival[0] != 0):
                        self.events_supported.append(i)
                        pass
                    pass
                self.ui.append_item(self, "Threshold Events Supported",
                                    ' '.join(self.events_supported))

                pass
            sval = ""
            fval = [ 0.0 ]
            rv = sensor.get_nominal_reading(fval)
            if (rv == 0):
                sval += "  Nominal:" + str(fval[0])
                pass
            rv = sensor.get_sensor_min(fval)
            if (rv == 0):
                sval += "  Min:" + str(fval[0])
                pass
            rv = sensor.get_sensor_max(fval)
            if (rv == 0):
                sval += "  Max:" + str(fval[0])
                pass
            rv = sensor.get_normal_min(fval)
            if (rv == 0):
                sval += "  NormalMin:" + str(fval[0])
                pass
            rv = sensor.get_normal_max(fval)
            if (rv == 0):
#.........这里部分代码省略.........
开发者ID:sharkconi,项目名称:openipmi,代码行数:103,代码来源:_sensor.py


注:本文中的OpenIPMI.get_event_support_string方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。