本文整理汇总了Python中WbDefs.checkRange方法的典型用法代码示例。如果您正苦于以下问题:Python WbDefs.checkRange方法的具体用法?Python WbDefs.checkRange怎么用?Python WbDefs.checkRange使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WbDefs
的用法示例。
在下文中一共展示了WbDefs.checkRange方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getDwell
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getDwell(self, idx):
"""
Retrieve one of the dwell values. These are measured in seconds.
"""
WbDefs.checkRange(idx, 0, WbDefs.DWELLCOUNT)
nodeList = self.dom.getElementsByTagName("CW")
return int(getElemText(nodeList[idx]))
示例2: getScene
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getScene(self, idx):
"""
Retrieve a dictionary defining the configuration of a scene.
"""
WbDefs.checkRange(idx, 0, WbDefs.SCENECOUNT)
result = dict() # empty dictionary
nodeList = self.dom.getElementsByTagName("CC")
node = nodeList[idx]
Dm = int(node.attributes["Dm"].value)
Ds = int(node.attributes["Ds"].value)
Am = int(node.attributes["Am"].value)
Av = int(node.attributes["Av"].value)
for i in range(8):
if ( ( Dm & ( 1 << i) ) != 0 ):
if ( ( Ds & ( 1 << i) ) != 0 ):
result["Digital"+str(i)] = "On"
else:
result["Digital"+str(i)] = "Off"
else:
result["Digital"+str(i)] = "Ignore"
for i in range(4):
if ( ( Am & ( 1 << i) ) != 0 ):
result["Analogue"+str(i)] = "SetPoint"+str(Av & 0x0F)
else:
result["Analogue"+str(i)] = "Ignore"
Av >>= 4
return result
示例3: getSetPoint
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getSetPoint(self,idx):
"""
Retrieve one of the set points, these are a number between 0 and 100 (%)
"""
WbDefs.checkRange(idx, 0, WbDefs.SPCOUNT)
nodeList = self.dom.getElementsByTagName("CS")
return int(getElemText(nodeList[idx]))
示例4: getRotary
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getRotary(self, idx):
"""
Retrieve a rotary encoder step value.
The current webbrick only supports a single encoder that connects to analog output zero.
"""
WbDefs.checkRange(idx, 0, WbDefs.ROTARYCOUNT)
return self.RotaryStep[idx]
示例5: getAnalogOutMimic
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getAnalogOutMimic(self, idx):
"""
Retrieve the mimic output channel number for an analog output channel,
or -1 if no mimic is defined for the specified channel.
"""
WbDefs.checkRange(idx, 0, WbDefs.AOCOUNT)
return self.MimicMapAnalog[idx]
示例6: setDigOutMimic
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def setDigOutMimic(self, idx, val):
"""
Set the mimic output channel number for an analog output channel,
or -1 if no mimic is defined for the specified channel.
"""
WbDefs.checkRange(idx, 0, WbDefs.DOCOUNT)
self.MimicMapDigital[idx] = val
示例7: ConfigTemp
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def ConfigTemp(self, iChn, thType, thVal, tgtType, tgtIdx, action, sp, dwell, udpType, associatedValue, reserved = None ):
"""
"""
WbDefs.checkRange(iChn, 0, WbDefs.TEMPCOUNT)
WbDefs.checkRange(thVal, -50, 125)
# CTchn;[L|H]Val;Trigger
cmd = "CT%i;%s%1.1f%s" % ( iChn, thType, thVal, self._CreateTriggerString(tgtType, tgtIdx, action, sp, dwell, udpType, associatedValue, reserved ) )
self.Send( cmd )
示例8: getRotary
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getRotary(self, idx):
"""
Retrieve a rotary encoder step value, the current webbrick only supports a single encoder
that connects to analog output zero.
"""
WbDefs.checkRange(idx, 0, WbDefs.ROTARYCOUNT)
nodeList = self.dom.getElementsByTagName("SR")
s = nodeList[idx].attributes["Value"].value
return int(s)
示例9: setSceneAlt
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def setSceneAlt(self, idx, val):
"""
Set a scene configuration using an alternative interface:
Dictionary entries are of the form:
["Digital"] = List of 8 values, each "On", "Off" or None
["Analog"] = List of 4 values, each None or an integer set point number
"""
WbDefs.checkRange(idx, 0, WbDefs.SCENECOUNT)
self.Scene[idx] = val
示例10: getSceneAlt
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getSceneAlt(self, idx):
"""
Alternative scene configuration.
Dictionary entries are of the form:
["Digital"] = List of 8 values, each "On", "Off" or None
["Analog"] = List of 4 values, each None or an integer set point number
"""
WbDefs.checkRange(idx, 0, WbDefs.SCENECOUNT)
return self.Scene[idx]
示例11: getDwellStr
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getDwellStr(self,idx):
"""
Retrieve one of the dwell values as a user displayable string
"""
WbDefs.checkRange(idx, 0, WbDefs.DWELLCOUNT)
dw = self.getDwell(idx)
if (dw<=60):
return u'%s Secs' % dw
if (dw<=3600):
return u'%i Mins' % round(dw/60)
return u'%i Hours' % round(dw/3600)
示例12: setScene
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def setScene(self, idx, val):
"""
Set a dictionary defining the configuration of a scene.
Dictionary entries are of the form:
["Digital<n>"] = ("On"|"Off"|"Ignore")
["Analogue<n>"] = ("SetPoint<m>"|"Ignore")
"""
### Currently broke -- consider removing this method ###
WbDefs.checkRange(idx, 0, WbDefs.SCENECOUNT)
self.Scene[idx] = val
示例13: ConfigTempThreshold
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def ConfigTempThreshold(self, iChn, thType, thVal ):
"""
Configure the threshold for a temperature sensor. This only sets the active value.
iChn - channel number
thType - a single character identiying the threshold hight or low
thVal - The threshold value
"""
WbDefs.checkRange(iChn, 0, WbDefs.TEMPCOUNT)
WbDefs.checkRange(thVal, -50, 125)
cmd = "TT%i;%s%1.1f" % ( iChn, thType, thVal )
self.Send( cmd )
示例14: getDigOutMimic
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getDigOutMimic(self, idx):
"""
Retrieve the mimic output channel number for an analog output channel,
or -1 if no mimic is defined for the specified channel.
"""
WbDefs.checkRange(idx, 0, WbDefs.DOCOUNT)
dms = getNamedNodeAttrText(self.dom, "MM", "dig")
if dms:
dm = int(dms)
dv = dm >> (idx*4) & 0xF
if dv < 8: return dv
return -1
示例15: getAnalogOutMimic
# 需要导入模块: import WbDefs [as 别名]
# 或者: from WbDefs import checkRange [as 别名]
def getAnalogOutMimic(self, idx):
"""
Retrieve the mimic output channel number for an analog output channel,
or -1 if no mimic is defined for the specified channel.
"""
WbDefs.checkRange(idx, 0, WbDefs.AOCOUNT)
ams = getNamedNodeAttrText(self.dom, "MM", "an")
if ams:
am = int(ams)
av = am >> (idx*4) & 0xF
if av < 8: return av
return -1