本文整理汇总了Python中Command.Command.bToS方法的典型用法代码示例。如果您正苦于以下问题:Python Command.bToS方法的具体用法?Python Command.bToS怎么用?Python Command.bToS使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Command.Command
的用法示例。
在下文中一共展示了Command.bToS方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: traverseAldb
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import bToS [as 别名]
def traverseAldb(self, startAddress):
while startAddress > 0x00:
print("Checking: 0x%0.2x" % startAddress)
SerialInstance().ser.flushInput()
SerialInstance().ser.flushOutput()
Command.queryMemory(self.deviceId, bytes([0x0F, startAddress]))
i = SerialInstance().ser.readline()
sleep(.3)
#Keep reading the address until we don't get a NACK
if re.search(r'(\w)+(15)\b', Command.bToS(i)):
print('Received NACK')
continue #This makes it stop here and try again
elif re.search(r'(\w)+(06)\b', Command.bToS(i)):
for _ in range(50):
SerialInstance().ser.flushInput()
SerialInstance().ser.flushOutput()
i = SerialInstance().ser.readline()
cmdStr = Command.bToS(i)
if len(i) > 0:
print("06: %s" % cmdStr)
if (len(i) > 0 and len(cmdStr) == 50):
self.addToAldb(i)
startAddress = startAddress - 0x08
print("address Decremented")
break
if re.search(r'(\w)+0(0|1)0000000000000000(\w\w){0,1}\b', Command.bToS(i)):
print("Found blank address: %02x" % startAddress)
return bytearray([i[13], i[14]])
示例2: __init__
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import bToS [as 别名]
def __init__(self, fromDev, toDev, devType, group):
self.fromDev = fromDev
self.toDev = toDev
self.group = group
self.devType = devType
if devType == Link.CONTROLLER:
self.name = fromDev.name +" is controller for "+ Command.bToS(toDev)
else:
self.name = fromDev.name +" is a responder to "+ Command.bToS(toDev) +" Group: "+ group
示例3: addLinkToAldb
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import bToS [as 别名]
def addLinkToAldb(self, deviceTolink, groupNum):
msg = bytearray([0x02, 0x62])
msg.extend(self.deviceId)
msg.extend([0x1F, 0x2f, 0x00, 0x00, 0x00, 0x02])
msg.extend(self.confirmFreeMem())
msg.append(0x08)
if True: #self.isController:
msg.append(0xE2)
else:
msg.append(0xA2)
msg.append(groupNum)
msg.extend(deviceTolink.deviceId)
#Device Data - based on other aldb data
msg.append(self.data1)
msg.append(self.data2)
if self.data3 == 0xbad: #Code used for same as groupNum
msg.append(groupNum)
else:
msg.append(self.data3)
if self.data4 == 0xbad: #Must be a checksum
msg.append(Util.getChecksum(msg))
else:
msg.append(self.data4)
print('ALDB Add: %s' % Command.spaceOut(Command.bToS(msg)))
示例4: printAldb
# 需要导入模块: from Command import Command [as 别名]
# 或者: from Command.Command import bToS [as 别名]
def printAldb(self):
print('Device: %s' % self.name)
for x in range(len(self.aldb)):
print('%d: %s' % (x, Command.spaceOut(Command.bToS(self.aldb[x]))))