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


Python OpenIPMI.get_hysteresis_support_string方法代码示例

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


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

示例1: __init__

# 需要导入模块: import OpenIPMI [as 别名]
# 或者: from OpenIPMI import get_hysteresis_support_string [as 别名]

#.........这里部分代码省略.........
            self.ui.append_item(self, "Threshold Support",
                              OpenIPMI.get_threshold_access_support_string(ts))
            sval = ""
            rval = ""
            if (ts != OpenIPMI.THRESHOLD_ACCESS_SUPPORT_NONE):
                wval = ""
                ival = [ 0 ]
                for th in threshold_strings:
                    rv = sensor.threshold_settable(th, ival)
                    if (rv == 0) and (ival[0] == 1):
                        sval += " " + th
                        pass
                    rv = sensor.threshold_readable(th, ival)
                    if (rv == 0) and (ival[0] == 1):
                        rval += " " + th
                        pass
                    rv = sensor.threshold_reading_supported(th, ival)
                    if (rv == 0) and (ival[0] == 1):
                        wval += " " + th
                        pass
                    pass
                if (wval != ""):
                    wval = wval.strip()
                    self.ui.append_item(self, "Thresholds Reported", wval)
                    pass

            if ((ts == OpenIPMI.THRESHOLD_ACCESS_SUPPORT_READABLE)
                or (ts == OpenIPMI.THRESHOLD_ACCESS_SUPPORT_SETTABLE)):
                if (sval != ""):
                    sval = sval.strip()
                    self.ui.append_item(self, "Settable Thresholds", sval)
                    pass
                if (rval != ""):
                    rval = rval.strip()
                    self.ui.append_item(self, "Readable Thresholds", rval)
                    pass
                        
                self.thresholds = self.ui.append_item(self, "Thresholds",
                                      None,
                                      data = SensorInfoGetter(self,
                                                       "get_thresholds"))
                pass
            else:
                sval = ""
                pass

            self.settable_thresholds = sval

            self.hysteresis_support = sensor.get_hysteresis_support()
            hs = self.hysteresis_support
            self.ui.append_item(self, "Hysteresis Support",
                                OpenIPMI.get_hysteresis_support_string(hs))
            if ((hs == OpenIPMI.HYSTERESIS_SUPPORT_READABLE)
                or (hs == OpenIPMI.HYSTERESIS_SUPPORT_SETTABLE)):
                self.hysteresis =  self.ui.append_item(self, "Hysteresis",
                                     None,
                                     data = SensorInfoGetter(self,
                                                             "get_hysteresis"))
                pass
            pass
        else:
            self.hysteresis_support = OpenIPMI.HYSTERESIS_SUPPORT_NONE
            self.threshold_support = OpenIPMI.THRESHOLD_ACCESS_SUPPORT_NONE

            self.events_supported = [ ]
            self.events_supported_name = { }
            self.states_supported = [ ]
            self.states_supported_name = { }
            if (es != OpenIPMI.EVENT_SUPPORT_NONE):
                for i in range(0, 15):
                    ival = [ 0 ]
                    rv = sensor.discrete_event_readable(i, ival)
                    if (rv == 0) and (ival[0] != 0):
                        self.states_supported.append(str(i))
                    name = sensor.reading_name_string(i)
                    self.states_supported_name[str(i)] = name
                    for j in ['a', 'd']:
                        ival = [ 0 ]
                        sval = str(i) + j
                        rv = sensor.discrete_event_supported(sval, ival)
                        if (rv == 0) and (ival[0] != 0):
                            self.events_supported.append(sval)
                            self.events_supported_name[sval] = name
                            pass
                        pass
                    pass
                            
                self.ui.append_item(self, "Events Supported",
                                    ' '.join(self.events_supported))
                self.ui.append_item(self, "States Reported",
                                    ' '.join(self.states_supported))
                names = self.ui.append_item(self, "State Names", "")
                for i in self.states_supported:
                    self.ui.append_item(None, str(i),
                                        self.states_supported_name[str(i)],
                                        parent=names)
                    pass
                pass
            pass
        return
开发者ID:sharkconi,项目名称:openipmi,代码行数:104,代码来源:_sensor.py


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