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


Python Command.bToS方法代码示例

本文整理汇总了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]])
开发者ID:,项目名称:,代码行数:32,代码来源:

示例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
开发者ID:,项目名称:,代码行数:11,代码来源:

示例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)))
开发者ID:,项目名称:,代码行数:26,代码来源:

示例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]))))
开发者ID:,项目名称:,代码行数:6,代码来源:


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