本文整理汇总了Python中WbDefs类的典型用法代码示例。如果您正苦于以下问题:Python WbDefs类的具体用法?Python WbDefs怎么用?Python WbDefs使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了WbDefs类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getDwell
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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