mirror of
https://github.com/RfidResearchGroup/ChameleonUltra.git
synced 2026-05-12 11:22:59 -07:00
Clean nrf* part of build.sh + get device address & chip id
This commit is contained in:
@@ -56,6 +56,14 @@ class ChameleonCLI:
|
||||
self.cmd_maps = {
|
||||
'hw': {
|
||||
'connect': new_uint(chameleon_cli_unit.HWConnect, "Connect to chameleon by serial port"),
|
||||
'chipid': {
|
||||
'get': new_uint(chameleon_cli_unit.HWChipIdGet, "Get device chipset ID"),
|
||||
'help': "Device chipsed ID get"
|
||||
},
|
||||
'address': {
|
||||
'get': new_uint(chameleon_cli_unit.HWAddressGet, "Get device address (used with Bluetooth)"),
|
||||
'help': "Device address get"
|
||||
},
|
||||
'mode': {
|
||||
'set': new_uint(chameleon_cli_unit.HWModeSet, "Change device mode to tag reader or tag emulator"),
|
||||
'get': new_uint(chameleon_cli_unit.HWModeGet, "Get current device mode"),
|
||||
|
||||
@@ -236,6 +236,24 @@ class HWModeGet(DeviceRequiredUnit):
|
||||
print(f"- Device Mode ( Tag {'Reader' if self.cmd_standard.is_reader_device_mode() else 'Emulator'} )")
|
||||
|
||||
|
||||
class HWChipIdGet(DeviceRequiredUnit):
|
||||
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
return None
|
||||
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
print(f' - Device chip ID: ' + self.cmd_positive.get_device_chip_id())
|
||||
|
||||
|
||||
class HWAddressGet(DeviceRequiredUnit):
|
||||
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
return None
|
||||
|
||||
def on_exec(self, args: argparse.Namespace):
|
||||
print(f' - Device address: ' + self.cmd_positive.get_device_address())
|
||||
|
||||
|
||||
class HF14AScan(ReaderRequiredUint):
|
||||
def args_parser(self) -> ArgumentParserNoExit or None:
|
||||
pass
|
||||
|
||||
@@ -18,6 +18,7 @@ DATA_CMD_SLOT_DATA_CONFIG_SAVE = 1009
|
||||
|
||||
DATA_CMD_ENTER_BOOTLOADER = 1010
|
||||
DATA_CMD_GET_DEVICE_CHIP_ID = 1011
|
||||
DATA_CMD_GET_DEVICE_ADDRESS = 1012
|
||||
|
||||
DATA_CMD_SCAN_14A_TAG = 2000
|
||||
DATA_CMD_MF1_SUPPORT_DETECT = 2001
|
||||
@@ -101,6 +102,12 @@ class BaseChameleonCMD:
|
||||
resp = self.device.send_cmd_sync(DATA_CMD_GET_DEVICE_CHIP_ID, 0x00, None)
|
||||
return resp.data.hex()
|
||||
|
||||
def get_device_address(self) -> str:
|
||||
"""
|
||||
Get device address
|
||||
"""
|
||||
resp = self.device.send_cmd_sync(DATA_CMD_GET_DEVICE_ADDRESS, 0x00, None)
|
||||
return resp.data[::-1].hex()
|
||||
|
||||
|
||||
def is_reader_device_mode(self) -> bool:
|
||||
|
||||
Reference in New Issue
Block a user