Add ability to delete sense type per slot

This commit is contained in:
Augusto Zanellato
2023-08-21 16:38:11 +02:00
parent 4aea618650
commit d33ae755c1
4 changed files with 52 additions and 0 deletions
+17
View File
@@ -1012,6 +1012,23 @@ class HWSlotTagType(TagTypeRequiredUnit, SlotIndexRequireUnit):
print(f' - Set slot tag type success.')
@hw_slot.command('delete', 'Delete sense type data for slot')
class HWDeleteSlotSense(SlotIndexRequireUnit, SenseTypeRequireUnit):
def args_parser(self) -> ArgumentParserNoExit:
parser = ArgumentParserNoExit()
parser.description = "Delete sense type data for a specific slot. " \
"The slot needs to have the other sense type correctly configured, " \
"otherwise an error will be thrown."
self.add_slot_args(parser)
self.add_sense_type_args(parser)
return parser
def on_exec(self, args: argparse.Namespace):
slot = args.slot
sense_type = args.sense_type
self.cmd.delete_slot_sense_type(slot, sense_type)
@hw_slot.command('init', 'Set emulation tag data to default')
class HWSlotDataDefault(TagTypeRequiredUnit, SlotIndexRequireUnit):
+16
View File
@@ -35,6 +35,7 @@ DATA_CMD_GET_SLOT_INFO = 1019
DATA_CMD_WIPE_FDS = 1020
DATA_CMD_GET_ENABLED_SLOTS = 1023
DATA_CMD_DELETE_SLOT_SENSE_TYPE = 1024
DATA_CMD_SCAN_14A_TAG = 2000
DATA_CMD_MF1_SUPPORT_DETECT = 2001
@@ -432,6 +433,21 @@ class ChameleonCMD:
data.append(tag_type)
return self.device.send_cmd_sync(DATA_CMD_SET_SLOT_TAG_TYPE, 0x00, data)
@expect_response(chameleon_status.Device.STATUS_DEVICE_SUCCESS)
def delete_slot_sense_type(self, slot_index: SlotNumber, sense_type: TagSenseType):
"""
Delete a sense type for a specific slot.
Another sense type must be enabled for the same slot,
otherwise an error will be thrown.
:param slot_index: Slot index
:param sense_type: Sense type to disable
:return:
"""
return self.device.send_cmd_sync(DATA_CMD_DELETE_SLOT_SENSE_TYPE, 0x00, bytearray([
SlotNumber.to_fw(slot_index),
sense_type,
]))
@expect_response(chameleon_status.Device.STATUS_DEVICE_SUCCESS)
def set_slot_data_default(self, slot_index: SlotNumber, tag_type: TagSpecificType):
"""