def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # Mode; commandValue.append(0x60 if ( self._choiceMode.GetSelection() == 0) else 0x61) # Sector number; commandValue.append(self._choiceBlockNumber.GetSelection()) # Key data; keyData = [0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF] try: keyData = Util.s2vl(self._textctrlKey.GetValue()) except: pass for kd in keyData: commandValue.append(kd) # UID; UID = [0x65, 0xE0, 0x5E, 0x1E] try: UID = Util.s2vl(self._textctrlUID.GetValue()) except: pass for id in UID: commandValue.append(id) # self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # PCD byte; PCD = 0b00000010 if self._checkboxChaining.IsChecked(): PCD |= 0b00010000 if self._checkboxCIDFollowing.IsChecked(): PCD |= 0b00001000 if self._checkboxNADFollowing.IsChecked(): PCD |= 0b00000100 if self._checkboxBlockNumber.IsChecked(): PCD |= 0b00000001 commandValue.append(PCD) # CID byte; if self._checkboxCIDFollowing.IsChecked(): CID = self._choiceCID.GetSelection() commandValue.append(CID) # NAD byte; if self._checkboxNADFollowing.IsChecked(): NAD = 0x00 try: NAD = Util.s2vl(self._textctrlNAD.GetValue())[0] except: pass commandValue.append(NAD) # INF field; try: INF = Util.s2vl(self._textctrlINF.GetValue()) for infByte in INF: commandValue.append(infByte) except: pass # # EDC bytes; # EDC = [ 0x00, 0x00 ] # try: # EDC = Util.s2vl(self._textctrlEDC.GetValue())[ : 2] # except: # pass # try: # commandValue.append(EDC[0]) # except: # commandValue.append(0) # try: # commandValue.append(EDC[1]) # except: # commandValue.append(0) self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING try: commandValueString = self._textctrlCommandValue.GetValue() commandValue = Util.s2vl(commandValueString) # SEL; SEL = commandValue[0] if SEL == 0x93: self._choiceLevel.SetSelection(0) elif SEL == 0x95: self._choiceLevel.SetSelection(1) elif SEL == 0x97: self._choiceLevel.SetSelection(2) else: self._choiceLevel.SetSelection(0) # NVB; NVB = commandValue[1] self._choiceByteCount.SetSelection(((NVB >> 4) & 0x07) - 2) self._choiceBitCount.SetSelection(NVB & 0x07) # UID; if len(commandValue) > 2: self._textctrlUID.SetValue(Util.vl2s(commandValue[2:], '')) except: pass self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING try: commandValue = [] # SEL; SELIndex = self._choiceLevel.GetSelection() commandValue.append(0x93 + 2 * SELIndex) # NVB; commandValue.append(( ((self._choiceByteCount.GetSelection() + 2) << 4) & 0xF0) | (self._choiceBitCount.GetSelection() & 0x0F)) # UID; uidString = self._textctrlUID.GetValue() commandValue += Util.s2vl(uidString) self._textctrlCommandValue.SetValue(Util.vl2s( commandValue, '')) except: pass self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValueString = self._textctrlCommandValue.GetValue() try: commandValue = Util.s2vl(commandValueString) except: return commandValueIndex = 0 # Parse PCD byte; PCD = commandValue[commandValueIndex] # commandTypeIndex = ((PCD >> 6) & 0x03) # if commandTypeIndex == 0: # pass self._checkboxChaining.SetValue(True if (PCD & 0b00010000) else False) commandValueIndex += 1 # Parse CID byte; if PCD & 0b00001000: self._checkboxCIDFollowing.SetValue(True) CID = commandValue[commandValueIndex] self._choiceCID.SetSelection(CID & 0x0F) commandValueIndex += 1 else: self._checkboxCIDFollowing.SetValue(False) # Parse NAD byte; if PCD & 0b00000100: self._checkboxNADFollowing.SetValue(True) NAD = commandValue[commandValueIndex] self._textctrlNAD.SetValue('%02X' % (NAD)) commandValueIndex += 1 else: self._checkboxNADFollowing.SetValue(False) # Block Number Flag; self._checkboxBlockNumber.SetValue(True if ( PCD & 0b00000001) else False) # Parse INF byte; INF = commandValue[commandValueIndex:] self._textctrlINF.SetValue(Util.vl2s(INF, '')) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValue= Util.s2vl(self._textctrlCommandValue.GetValue()) # # Check command type; # if commandValue[0] != 0xA0: # pass self._choiceBlockNumber.SetSelection(commandValue[1]) self._textctrlData.SetValue(Util.vl2s(commandValue[2 :], '')) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValue = Util.s2vl(self._textctrlCommandValue.GetValue()) # # Check command type; # if commandValue[0] != 0xC1: # pass self._choiceBlockNumber.SetSelection(commandValue[1]) self._textctrlValue.SetValue(Util.vl2s(commandValue[2:], '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING try: commandValue = [] commandValue.append(Util.s2vl(self._textctrlHeader.GetValue())[0]) commandValue.append((self._choiceFSDI.GetSelection() << 4) | self._choiceCID.GetSelection()) self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) except: pass self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValue = Util.s2vl(self._textctrlCommandValue.GetValue()) self._choiceMode.SetSelection(0 if commandValue[0] == 0x60 else 1) self._choiceBlockNumber.SetSelection(commandValue[1]) self._textctrlKey.SetValue(Util.vl2s(commandValue[2:8], '')) if len(commandValue) >= 12: self._textctrlUID.SetValue(Util.vl2s(commandValue[8:], '')) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValueString = self._textctrlCommandValue.GetValue() try: commandValue = Util.s2vl(commandValueString) except: return commandValueIndex = 0 # Parse PCD byte; PCD = commandValue[commandValueIndex] # commandTypeIndex = ((PCD >> 6) & 0x03) # if commandTypeIndex == 0: # pass self._checkboxChaining.SetValue(True if (PCD & 0b00010000) else False) commandValueIndex += 1 # Parse CID byte; if PCD & 0b00001000: self._checkboxCIDFollowing.SetValue(True) CID = commandValue[commandValueIndex] self._choiceCID.SetSelection(CID & 0x0F) commandValueIndex += 1 else: self._checkboxCIDFollowing.SetValue(False) # Parse NAD byte; if PCD & 0b00000100: self._checkboxNADFollowing.SetValue(True) NAD = commandValue[commandValueIndex] self._textctrlNAD.SetValue('%02X' %(NAD)) commandValueIndex += 1 else: self._checkboxNADFollowing.SetValue(False) # Block Number Flag; self._checkboxBlockNumber.SetValue(True if (PCD & 0b00000001) else False) # Parse INF byte; INF = commandValue[commandValueIndex : ] self._textctrlINF.SetValue(Util.vl2s(INF, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING try: commandValue = [] commandValue.append(0b11010000 | self._choiceCID.GetSelection()) if self._checkboxPPS1.GetValue(): commandValue.append(0x11) commandValue.append( 0b0000 | ((self._choiceDSI.GetSelection() & 0x03) << 2) | (self._choiceDSI.GetSelection() & 0x03)) else: commandValue.append(0x01) self._textctrlCommandValue.SetValue(Util.vl2s( commandValue, '')) except: pass self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # PCD byte; PCD = 0b11000010 if self._choiceType.GetSelection() != 0: PCD |= 0b00110000 if self._checkboxCIDFollowing.IsChecked(): PCD |= 0b00001000 commandValue.append(PCD) # CID byte; if self._checkboxCIDFollowing.IsChecked(): CID = self._choiceCID.GetSelection() commandValue.append(CID) # Build INF field; WTXM = 0 try: WTXM = Util.s2vl(self._textctrlWTXM.GetValue())[0] & 0b00111111 except: pass commandValue.append(self._choicePowerLevel.GetSelection() | WTXM) # # EDC bytes; # EDC = [ 0x00, 0x00 ] # try: # EDC = Util.s2vl(self._textctrlEDC.GetValue())[ : 2] # except: # pass # try: # commandValue.append(EDC[0]) # except: # commandValue.append(0) # try: # commandValue.append(EDC[1]) # except: # commandValue.append(0) self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # Command type; commandValue.append(0xB0) # Block Number; commandValue.append(self._choiceBlockNumber.GetSelection()) # v = Util.vl2s(commandValue, '') print v print type(v) self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # Command type; commandValue.append(0xB0) # Block Number; commandValue.append(self._choiceBlockNumber.GetSelection()) # v = Util.vl2s(commandValue, "") print v print type(v) self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, "")) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValue= Util.s2vl(self._textctrlCommandValue.GetValue()) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValue = Util.s2vl(self._textctrlCommandValue.GetValue()) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # Command type; commandValue.append(0xC0) # Block Number; commandValue.append(self._choiceBlockNumber.GetSelection()) # Operand; operand = [0x00, 0x00, 0x00, 0x00] try: operand = Util.s2vl(self._textctrlValue.GetValue()) except: pass for o in operand: commandValue.append(o) # self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # Command type; commandValue.append(0xA0) # Block number; commandValue.append(self._choiceBlockNumber.GetSelection()) # Data; data = [0x00] * 16 try: data = Util.s2vl(self._textctrlData.GetValue()) except: pass for d in data: commandValue.append(d) # self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING commandValue = [] # Command type; commandValue.append(0xC1) # Block Number; commandValue.append(self._choiceBlockNumber.GetSelection()) # Operand; operand = [0x00, 0x00, 0x00, 0x00] try: operand = Util.s2vl(self._textctrlValue.GetValue()) except: pass for o in operand: commandValue.append(o) # self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING try: commandValue = Util.s2vl(self._textctrlCommandValue.GetValue()) self._textctrlHeader.SetValue('%02X' %(commandValue[0])) parameter = commandValue[1] self._choiceFSDI.SetSelection((parameter >> 4) & 0x0F) self._choiceCID.SetSelection(parameter & 0x0F) except: pass self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING try: commandValue = Util.s2vl(self._textctrlCommandValue.GetValue()) self._textctrlHeader.SetValue('%02X' % (commandValue[0])) parameter = commandValue[1] self._choiceFSDI.SetSelection((parameter >> 4) & 0x0F) self._choiceCID.SetSelection(parameter & 0x0F) except: pass self.__mode = MODE_IDLE else: pass
def buildCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_BUILDING try: commandValue = [] commandValue.append(0b11010000 | self._choiceCID.GetSelection()) if self._checkboxPPS1.GetValue(): commandValue.append(0x11) commandValue.append(0b0000 | ((self._choiceDSI.GetSelection() & 0x03) << 2) | (self._choiceDSI.GetSelection() & 0x03)) else: commandValue.append(0x01) self._textctrlCommandValue.SetValue(Util.vl2s(commandValue, '')) except: pass self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING try: commandValueString = self._textctrlCommandValue.GetValue() commandValue = Util.s2vl(commandValueString) # Start byte; self._choiceCID.SetSelection(commandValue[0] & 0x0F) # Parameter 0; self._checkboxPPS1.SetValue(True if (commandValue[1] & 0x10) else False) # Parameter 1; parameter1 = commandValue[2] # DSI; self._choiceDSI.SetSelection((parameter1 >> 2) & 0x03) # DRI; self._choiceDSI.SetSelection(parameter1 & 0x03) except: pass self.__mode = MODE_IDLE else: pass
def parseCommandValue(self): if self.__mode == MODE_IDLE: self.__mode = MODE_PARSING commandValueString = self._textctrlCommandValue.GetValue() try: commandValue = Util.s2vl(commandValueString) except: return commandValueIndex = 0 # Parse PCD byte; PCD = commandValue[commandValueIndex] # commandTypeIndex = ((PCD >> 6) & 0x03) # if commandTypeIndex == 3: # pass self._choiceType.SetSelection(1 if (PCD & 0b00110000) else 0) commandValueIndex += 1 # Parse CID byte; if PCD & 0b00001000: self._checkboxCIDFollowing.SetValue(True) CID = commandValue[commandValueIndex] self._choiceCID.SetSelection(CID & 0x0F) commandValueIndex += 1 else: self._checkboxCIDFollowing.SetValue(False) # Parse INF byte; INF= commandValue[commandValueIndex] self._choicePowerLevel.SetSelection((INF >> 6) & 3) self._textctrlWTXM.SetValue('%02X' %(INF & 0b00111111)) self.__mode = MODE_IDLE else: pass
def getInstallParameters(self): parametersString = self._parametersTextCtrl.GetValue() return Util.s2vs(parametersString)
def getInstanceAID(self): instanceAIDString = self._instanceAIDTextCtrl.GetValue() return Util.s2vs(instanceAIDString)
def _parametersTextCtrlOnChar(self, event): keyCode = event.KeyCode if Util.ishexchar_kc(keyCode): event.Skip()
def getData(self): return Util.s2vl(self._textctrlData.GetValue())
def _instanceAIDTextCtrlOnChar(self, event): keyCode = event.KeyCode if Util.ishexchar_kc(keyCode): event.Skip()