Skip to content

Commit

Permalink
cli: clean enums
Browse files Browse the repository at this point in the history
  • Loading branch information
doegox committed Oct 8, 2023
1 parent deb6684 commit 2f4d84e
Showing 1 changed file with 100 additions and 102 deletions.
202 changes: 100 additions & 102 deletions software/script/chameleon_cmd.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,111 +10,111 @@

@enum.unique
class Command(enum.IntEnum):
GET_APP_VERSION = 1000,
CHANGE_DEVICE_MODE = 1001,
GET_DEVICE_MODE = 1002,
SET_ACTIVE_SLOT = 1003,
SET_SLOT_TAG_TYPE = 1004,
SET_SLOT_DATA_DEFAULT = 1005,
SET_SLOT_ENABLE = 1006,
GET_APP_VERSION = 1000
CHANGE_DEVICE_MODE = 1001
GET_DEVICE_MODE = 1002
SET_ACTIVE_SLOT = 1003
SET_SLOT_TAG_TYPE = 1004
SET_SLOT_DATA_DEFAULT = 1005
SET_SLOT_ENABLE = 1006

SET_SLOT_TAG_NICK = 1007,
GET_SLOT_TAG_NICK = 1008,
SET_SLOT_TAG_NICK = 1007
GET_SLOT_TAG_NICK = 1008

SLOT_DATA_CONFIG_SAVE = 1009,
SLOT_DATA_CONFIG_SAVE = 1009

ENTER_BOOTLOADER = 1010,
GET_DEVICE_CHIP_ID = 1011,
GET_DEVICE_ADDRESS = 1012,
ENTER_BOOTLOADER = 1010
GET_DEVICE_CHIP_ID = 1011
GET_DEVICE_ADDRESS = 1012

SAVE_SETTINGS = 1013,
RESET_SETTINGS = 1014,
SET_ANIMATION_MODE = 1015,
GET_ANIMATION_MODE = 1016,
SAVE_SETTINGS = 1013
RESET_SETTINGS = 1014
SET_ANIMATION_MODE = 1015
GET_ANIMATION_MODE = 1016

GET_GIT_VERSION = 1017,
GET_GIT_VERSION = 1017

GET_ACTIVE_SLOT = 1018,
GET_SLOT_INFO = 1019,
GET_ACTIVE_SLOT = 1018
GET_SLOT_INFO = 1019

WIPE_FDS = 1020,
WIPE_FDS = 1020

DELETE_SLOT_TAG_NICK = 1021,
DELETE_SLOT_TAG_NICK = 1021

GET_ENABLED_SLOTS = 1023,
DELETE_SLOT_SENSE_TYPE = 1024,
GET_ENABLED_SLOTS = 1023
DELETE_SLOT_SENSE_TYPE = 1024

GET_BATTERY_INFO = 1025,
GET_BATTERY_INFO = 1025

GET_BUTTON_PRESS_CONFIG = 1026,
SET_BUTTON_PRESS_CONFIG = 1027,
GET_BUTTON_PRESS_CONFIG = 1026
SET_BUTTON_PRESS_CONFIG = 1027

GET_LONG_BUTTON_PRESS_CONFIG = 1028,
SET_LONG_BUTTON_PRESS_CONFIG = 1029,
GET_LONG_BUTTON_PRESS_CONFIG = 1028
SET_LONG_BUTTON_PRESS_CONFIG = 1029

SET_BLE_PAIRING_KEY = 1030,
GET_BLE_PAIRING_KEY = 1031,
DELETE_ALL_BLE_BONDS = 1032,
SET_BLE_PAIRING_KEY = 1030
GET_BLE_PAIRING_KEY = 1031
DELETE_ALL_BLE_BONDS = 1032

GET_DEVICE_MODEL = 1033,
GET_DEVICE_MODEL = 1033
# FIXME: implemented but unused in CLI commands
GET_DEVICE_SETTINGS = 1034,
GET_DEVICE_CAPABILITIES = 1035,
GET_BLE_PAIRING_ENABLE = 1036,
SET_BLE_PAIRING_ENABLE = 1037,

HF14A_SCAN = 2000,
MF1_DETECT_SUPPORT = 2001,
MF1_DETECT_PRNG = 2002,
MF1_STATIC_NESTED_ACQUIRE = 2003,
MF1_DARKSIDE_ACQUIRE = 2004,
MF1_DETECT_NT_DIST = 2005,
MF1_NESTED_ACQUIRE = 2006,
MF1_AUTH_ONE_KEY_BLOCK = 2007,
MF1_READ_ONE_BLOCK = 2008,
MF1_WRITE_ONE_BLOCK = 2009,
HF14A_RAW = 2010,

EM410X_SCAN = 3000,
EM410X_WRITE_TO_T55XX = 3001,

MF1_WRITE_EMU_BLOCK_DATA = 4000,
HF14A_SET_ANTI_COLL_DATA = 4001,
MF1_SET_DETECTION_ENABLE = 4004,
MF1_GET_DETECTION_COUNT = 4005,
MF1_GET_DETECTION_LOG = 4006,
GET_DEVICE_SETTINGS = 1034
GET_DEVICE_CAPABILITIES = 1035
GET_BLE_PAIRING_ENABLE = 1036
SET_BLE_PAIRING_ENABLE = 1037

HF14A_SCAN = 2000
MF1_DETECT_SUPPORT = 2001
MF1_DETECT_PRNG = 2002
MF1_STATIC_NESTED_ACQUIRE = 2003
MF1_DARKSIDE_ACQUIRE = 2004
MF1_DETECT_NT_DIST = 2005
MF1_NESTED_ACQUIRE = 2006
MF1_AUTH_ONE_KEY_BLOCK = 2007
MF1_READ_ONE_BLOCK = 2008
MF1_WRITE_ONE_BLOCK = 2009
HF14A_RAW = 2010

EM410X_SCAN = 3000
EM410X_WRITE_TO_T55XX = 3001

MF1_WRITE_EMU_BLOCK_DATA = 4000
HF14A_SET_ANTI_COLL_DATA = 4001
MF1_SET_DETECTION_ENABLE = 4004
MF1_GET_DETECTION_COUNT = 4005
MF1_GET_DETECTION_LOG = 4006
# FIXME: not implemented
MF1_GET_DETECTION_ENABLE = 4007,
MF1_READ_EMU_BLOCK_DATA = 4008,
MF1_GET_EMULATOR_CONFIG = 4009,
MF1_GET_DETECTION_ENABLE = 4007
MF1_READ_EMU_BLOCK_DATA = 4008
MF1_GET_EMULATOR_CONFIG = 4009
# FIXME: not implemented
MF1_GET_GEN1A_MODE = 4010,
MF1_SET_GEN1A_MODE = 4011,
MF1_GET_GEN1A_MODE = 4010
MF1_SET_GEN1A_MODE = 4011
# FIXME: not implemented
MF1_GET_GEN2_MODE = 4012,
MF1_SET_GEN2_MODE = 4013,
MF1_GET_GEN2_MODE = 4012
MF1_SET_GEN2_MODE = 4013
# FIXME: not implemented
MF1_GET_BLOCK_ANTI_COLL_MODE = 4014,
MF1_SET_BLOCK_ANTI_COLL_MODE = 4015,
MF1_GET_BLOCK_ANTI_COLL_MODE = 4014
MF1_SET_BLOCK_ANTI_COLL_MODE = 4015
# FIXME: not implemented
MF1_GET_WRITE_MODE = 4016,
MF1_SET_WRITE_MODE = 4017,
HF14A_GET_ANTI_COLL_DATA = 4018,
MF1_GET_WRITE_MODE = 4016
MF1_SET_WRITE_MODE = 4017
HF14A_GET_ANTI_COLL_DATA = 4018

EM410X_SET_EMU_ID = 5000,
EM410X_GET_EMU_ID = 5001,
EM410X_SET_EMU_ID = 5000
EM410X_GET_EMU_ID = 5001


@enum.unique
class SlotNumber(enum.IntEnum):
SLOT_1 = 1,
SLOT_2 = 2,
SLOT_3 = 3,
SLOT_4 = 4,
SLOT_5 = 5,
SLOT_6 = 6,
SLOT_7 = 7,
SLOT_8 = 8,
SLOT_1 = 1
SLOT_2 = 2
SLOT_3 = 3
SLOT_4 = 4
SLOT_5 = 5
SLOT_6 = 6
SLOT_7 = 7
SLOT_8 = 8

@staticmethod
def to_fw(index: int): # can be int or SlotNumber
Expand All @@ -139,24 +139,24 @@ class TagSenseType(enum.IntEnum):

@enum.unique
class TagSpecificType(enum.IntEnum):
UNDEFINED = 0,
UNDEFINED = 0

# old HL/LF common types, slots using these ones need to be migrated first
OLD_EM410X = 1,
OLD_MIFARE_Mini = 2,
OLD_MIFARE_1024 = 3,
OLD_MIFARE_2048 = 4,
OLD_MIFARE_4096 = 5,
OLD_NTAG_213 = 6,
OLD_NTAG_215 = 7,
OLD_NTAG_216 = 8,
OLD_TAG_TYPES_END = 9,
OLD_EM410X = 1
OLD_MIFARE_Mini = 2
OLD_MIFARE_1024 = 3
OLD_MIFARE_2048 = 4
OLD_MIFARE_4096 = 5
OLD_NTAG_213 = 6
OLD_NTAG_215 = 7
OLD_NTAG_216 = 8
OLD_TAG_TYPES_END = 9

###### LF ######

#### ASK Tag-Talk-First 100 ####
# EM410x
EM410X = 100,
EM410X = 100
# FDX-B
# securakey
# gallagher
Expand Down Expand Up @@ -184,19 +184,19 @@ class TagSpecificType(enum.IntEnum):
# EM4x50/4x70
# Hitag series

TAG_TYPES_LF_END = 999,
TAG_TYPES_LF_END = 999

###### HF ######

#### MIFARE Classic series 1000 ####
MIFARE_Mini = 1000,
MIFARE_1024 = 1001,
MIFARE_2048 = 1002,
MIFARE_4096 = 1003,
MIFARE_Mini = 1000
MIFARE_1024 = 1001
MIFARE_2048 = 1002
MIFARE_4096 = 1003
#### MFUL / NTAG series 1100 ####
NTAG_213 = 1100,
NTAG_215 = 1101,
NTAG_216 = 1102,
NTAG_213 = 1100
NTAG_215 = 1101
NTAG_216 = 1102
#### MIFARE Plus series 1200 ####
#### DESFire series 1300 ####

Expand Down Expand Up @@ -346,15 +346,13 @@ def __str__(self):

@enum.unique
class ButtonType(enum.IntEnum):
# what, you need the doc for button type? maybe chatgpt known... LOL
A = ord('A')
B = ord('B')


@enum.unique
class MfcKeyType(enum.IntEnum):
# what, you need the doc for button type? maybe chatgpt known... LOL
A = 0x60,
A = 0x60
B = 0x61


Expand Down

0 comments on commit 2f4d84e

Please sign in to comment.