當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。