from enum import Enum


class CommandDetails(Enum):
    version = {'cmd': 'version', 'cmd_shortcut': 'v', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_version', 'args': None, 'desc': 'returns the Gateway Firmware version'}
    set_energizing_pattern = {'cmd': 'set_energizing_pattern', 'cmd_shortcut': 'sep', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_energy_pattern', 'args': ['ENERGY_PATTERN'], 'desc': 'set the Gateway energy pattern, default 18'}
    set_dyn_energizing_pattern = {'cmd': 'set_dyn_energizing_pattern', 'cmd_shortcut': 'sdep', 'num_of_args': ['SKIP_ARGS_VALIDATION'], 'status_return': True, 'cmd_func': 'cmd_set_dynamic_energy_pattern'}
    set_beacons_pattern = {'cmd': 'set_beacons_pattern', 'cmd_shortcut': 'sbp', 'num_of_args': ['SKIP_ARGS_VALIDATION'], 'status_return': True, 'cmd_func': 'cmd_set_beacons_pattern'}
    output_power = {'cmd': 'output_power', 'cmd_shortcut': 'op', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_2_4_ghz_power_set', 'args': ['OUTPUT_POWER_STR'], 'desc': 'set the Gateway intenral output-power, default pos3dBm, e.g. neg4dBm, ...'}
    time_profile = {'cmd': 'time_profile', 'cmd_shortcut': 'tp', 'num_of_args': ['2'], 'status_return': True, 'cmd_func': 'cmd_time_profile_set', 'args': ['CYCLE_TIME_MS', 'ON_TIME_MS'], 'desc': 'set the Gateway time profile - cycle + on/transmit time, default 15 5'}
    set_pacer_interval = {'cmd': 'set_pacer_interval', 'cmd_shortcut': 'pi', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_wlt_pacer_interval_set', 'args': ['PACER_INTERVAL_S'], 'desc': 'set the Gateway pacer interval - the minimum time in seconds the gateway should pass a packet from specific tag, default 0 (meaining no pacing), e.g 1'}
    set_sub_1_ghz_energizing_frequency = {'cmd': 'set_sub_1_ghz_energizing_frequency', 'cmd_shortcut': 'sf', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_sub_1_ghz_energizing_frequency', 'args': ['SUB1G_FREQ_MHZ'], 'desc': 'set the Gateway sub1g frequency in MHz, default 915000'}
    set_sub_1_ghz_energizing_mode = {'cmd': 'set_sub_1_ghz_energizing_mode', 'cmd_shortcut': 'sm', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_sub_1_ghz_energizing_mode', 'args': ['SUB1G_ENERGY_MODE'], 'desc': 'set the Gateway sub1g energy mode: 0 = [default] energy on single frequency based on the SUB1G_FREQ_MHZ, 1 = enrgy using the FCC hopping method, 905Mhz till 920 Mhz with 300 Khz intervals'}
    set_sub_1_ghz_power = {'cmd': 'set_sub_1_ghz_power', 'cmd_shortcut': 'sop', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_sub_1_ghz_power_set', 'args': ['SUB1G_POWER_DBM'], 'desc': 'set the Gateway sub1g output power in dBm, between 17-29, default 29'}
    start_2_4_ghz_energizing = {'cmd': 'start_2_4_ghz_energizing', 'cmd_shortcut': 'NONE', 'num_of_args': ['2'], 'status_return': True, 'cmd_func': 'cmd_2_4_ghz_energizing_start', 'args': ['ENRGY_FREQ, RADIO_MODE'], 'desc': 'start to energize with constant wave on the selected freq and radio mode [0: 1Mbit/s Nordic, 1: 2Mbit/s Nordic, 3: 1Mbit/s BLE, 3: 2Mbit/s BLE], e.g. 2480, 0'}
    enable_hw_dual_band = {'cmd': 'enable_hw_dual_band', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': False, 'cmd_func': 'cmd_enable_hw_dual_band', 'args': ['IS_DUAL_BAND'], 'desc': 'enable or disable dual band options (sub1g) for the Gateway. the default is dual band enabled, e.g. 1 or 0'}
    gateway_app = {'cmd': 'gateway_app', 'cmd_shortcut': 's', 'num_of_args': ['0', '4'], 'status_return': True, 'cmd_func': 'cmd_gateway_application_start', 'args': None, 'desc': 'start the Gateway application to transmit energy/beacons and receive packets'}
    store_to_flash = {'cmd': 'store_to_flash', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_store_to_flash', 'args': None, 'desc': 'store the current Gateway configuration to its flash, so even after power-down or software reset the Gateway is configured with the saved configurations'}
    reset = {'cmd': 'reset', 'cmd_shortcut': 'r', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_reset', 'args': None, 'desc': 'soft reset the Gateway - will restore default configuration and re-run all the processes'}
    move_to_bootloader = {'cmd': 'move_to_bootloader', 'cmd_shortcut': 'mtb', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_move_to_bootloader', 'args': None, 'desc': 'move the Gateway to bootloader mode for firmware upgrade purposes'}
    print_config = {'cmd': 'print_config', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_print_config', 'args': None, 'desc': 'returns the current Gateway configuration - short list'}
    print_config_extended = {'cmd': 'print_config_extended', 'cmd_shortcut': 'pce', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_print_config_extended', 'args': None, 'desc': 'returns the current Gateway configuration - detailed list'}
    get_device_address = {'cmd': 'get_device_address', 'cmd_shortcut': 'pda', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_get_device_address', 'args': None, 'desc': 'returns the Gateway device address, a unique address per device'}
    pl_gw_config = {'cmd': 'pl_gw_config', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_pl_gw_config', 'args': ['ENABLE_PRODUCTION_LINE'], 'desc': 'enable/disable production line mode - when pulse detected on GPIO P010, Gateway sends message, start with constant wave for PL_DELAY time [defualt is 0] and continues with the configured energy pattern. default 0, e.g. 1'}
    full_packet_mode = {'cmd': 'full_packet_mode', 'cmd_shortcut': 'fpm', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_full_packet_mode', 'args': ['IS_FULL_PACKET_MODE'], 'desc': 'relevant only for LEGACY (BLE4) packets. if enabled the Gateway passes the BLE4 packet inclusing the physical header, default 0 (disable), e.g. 1'}
    enable_crc = {'cmd': 'enable_crc', 'cmd_shortcut': 'ecrc', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_enable_wrong_crc', 'args': ['DO_PASS_BAD_CRC_PACKET'], 'desc': 'enable the Gateway to pass bad crc packets, default is 0 (disabled), e.g. 1'}
    print_crc = {'cmd': 'print_crc', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_print_crc', 'args': None, 'desc': 'returns the crc packets (any packets not only Wiliot) counter'}
    reset_crc = {'cmd': 'reset_crc', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_reset_crc_counters', 'args': None, 'desc': 'reset the crc packets counters'}
    listen_to_tag_only = {'cmd': 'listen_to_tag_only', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_listen_to_tag_only', 'args': ['DO_LISTEN_TO_TAG_ONLY'], 'desc': 'enable/disable listen to packets that were echoed by bridges. 1 = only from tags [defualt], 0 = also packets echo from bridges'}
    beacons_backoff = {'cmd': 'beacons_backoff', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_beacons_backoff_set', 'args': ['BEACONS_BACKOF_DBM'], 'desc': 'set the Gateway beacons backoff/power reduction from the maximum power in dbm, default 0 = means no beacons backoff, e.g. 2'}
    scan_ch = {'cmd': 'scan_ch', 'cmd_shortcut': 'NONE', 'num_of_args': ['1', '2'], 'status_return': True, 'cmd_func': 'cmd_scan_channel_set', 'args': ['RX_CHANNEL_FREQ', 'WHITENING_CHANNEL'], 'desc': 'set the Gateway scan/recieve channel or frequency, default 37, e.g. 10, 2480, 39, ... the WHITENING_CHANNEL is optional if the data whitening channel is different than the scan channel.'}
    start_rx = {'cmd': 'start_rx', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_rx_start', 'args': None, 'desc': 'start to listen only based on the configured scan channel'}
    start_cw = {'cmd': 'start_cw', 'cmd_shortcut': 'NONE', 'num_of_args': ['2'], 'status_return': True, 'cmd_func': 'cmd_cw_transmit_time_start', 'args': ['ON_TIME_MS, OFF_TIME_MS'], 'desc': 'start Gateway transmitting (NO recieiving at all) of constant wave for the specified on time in ms, and stop transmitting based on the specified off time in ms, e.g. 2 5'}
    set_packet_filter_on = {'cmd': 'set_packet_filter_on', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_set_packet_filter_on', 'args': None, 'desc': 'enable packet filter, which means the Gateway passes only unique packets'}
    set_packet_filter_off = {'cmd': 'set_packet_filter_off', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_set_packet_filter_off', 'args': None, 'desc': '[default] disable packet filter, which means the Gateway passes only unique packets'}
    bypass_pa = {'cmd': 'bypass_pa', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_bypass_pa', 'args': ['IS_BYPASS_PA_TX'], 'desc': 'set the Gateway TX Power Amplifier: 0 = means no pybass, hence PA is on, 1 = otherwise, default 0, e.g. 1'}
    bypass_tx_rx = {'cmd': 'bypass_tx_rx', 'cmd_shortcut': 'NONE', 'num_of_args': ['2'], 'status_return': True, 'cmd_func': 'cmd_bypass_tx_rx', 'args': ['IS_BYPASS_PA_TX', 'IS_BYPASS_PA_RX'], 'desc': 'set the Gateway TX and RX Power Amplifier: 0 = means no pybass, hence PA is on, 1 = otherwise, default 0, e.g. 1'}
    trigger_pl = {'cmd': 'trigger_pl', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_trigger_pl', 'args': None, 'desc': 'trigger the Production Line process similar to extenral triggering by GPIO'}
    set_pl_delay = {'cmd': 'set_pl_delay', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_pl_delay', 'args': ['PL_DELAY_MS'], 'desc': 'set the Gateway Constant Wave duration in ms upon triggering the Production Line process. default 0, e.g. 100'}
    set_rssi_th = {'cmd': 'set_rssi_th', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_rssi_th', 'args': ['RSSI_THRESHOLD'], 'desc': 'set the Gateway rssi threshold to filter packets with low signal. 0 [default] meaning no filtering, otherwise value is in minus, so to filter all packets with rssi(signal power) lower than -50dBm, set the threshold to 50'}
    enable_hv_gpio = {'cmd': 'enable_hv_gpio', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_enable_hv_gpio', 'args': None, 'desc': 'enable the high voltage GPIO on the Gateway. when this mode is enable, instead of energy transmitted by the Gateway, the Gateway set GPIO P009 to High to interact with external hardware'}
    run_ed_sample = {'cmd': 'run_ed_sample', 'cmd_shortcut': 'NONE', 'num_of_args': ['2'], 'status_return': False, 'cmd_func': 'cmd_run_ed_sample', 'args': None, 'desc': 'returns the Energy power the Gateway detect over the air using nordic ED methods'}
    set_lbt = {'cmd': 'set_lbt', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_lbt_mode', 'args': ['DO_LISTEN_BEFORE_TALK'], 'desc': 'enable the option to transmit only if there is no noise (under -70dBm) over the air. default 0, e.g. 1'}
    cancel = {'cmd': 'cancel', 'cmd_shortcut': 'c', 'num_of_args': ['0'], 'status_return': True, 'cmd_func': 'cmd_cancel', 'args': None, 'desc': 'stop the Gateway application, no transmiting nor receiving'}
    sub1g_sync = {'cmd': 'sub1g_sync', 'cmd_shortcut': 'NONE', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_sub1g_sync', 'args': ['IS_SUB1G_SYNCED'], 'desc': 'set the Gateway sub1g transmission to start at the same time the 2.4 transmission starts, otherwise the sub1g trasmission would start at some point of the 2.4 cycle. default 1, e.g. 0'}
    beacons_train = {'cmd': 'beacons_train', 'cmd_shortcut': 'bt', 'num_of_args': ['SKIP_ARGS_VALIDATION'], 'status_return': True, 'cmd_func': 'cmd_set_beacons_train', 'args': ['IS_SUB1G_ENERGY', 'NUMBER_OF_BEACONS', 'BEACON1', 'BEACON2', '...'], 'desc': 'set dynamic energy pattern on the Gateway (the EP number is always 41). the command set if there is energy in sub1g during the on time that is configured based on the time profile (different command), each beacon setup contains the frequncy,beacon duration,silence time till the next beacon. e.g. EP18 is the same as: !beacons_train 0 4 2402,550,1 2426,550,1 2480,550,1 2480,3246,1'}
    cmd_gpio = {'cmd': 'cmd_gpio', 'cmd_shortcut': 'NONE', 'num_of_args': ['SKIP_ARGS_VALIDATION'], 'status_return': True, 'cmd_func': 'cmd_gpio', 'args': ['COMMAND', 'PIN', 'ARGUMENT'], 'desc': 'for detailed explanation please check https://wiliot.atlassian.net/wiki/spaces/SW/pages/3228827713/GW+Tester+Board+GPIO. examples: !cmd_gpio SEND 1 P004 pulse 1 500, !cmd_gpio SEND 1 P004 static 1, !cmd_gpio CONTROL_OUT P030 0, !cmd_gpio CONTROL_IN P030 1'}
    get_name = {'cmd': 'get_name', 'cmd_shortcut': 'NONE', 'num_of_args': ['0'], 'status_return': False, 'cmd_func': 'cmd_get_name', 'args': None, 'desc': 'returns the Gateway name, a unique name per device'}
    set_scan_radio = {'cmd': 'set_scan_radio', 'cmd_shortcut': 'NONE', 'num_of_args': ['2'], 'status_return': True, 'cmd_func': 'cmd_scan_radio_params', 'args': ['SCAN_RADIO_MODE', 'PREAMBLE_LENGTH'], 'desc': 'set the Gateway scan radio mode [0: 1Mbit/s Nordic, 1: 2Mbit/s Nordic, 3: 1Mbit/s BLE, 3: 2Mbit/s BLE], default 3, and the preamble length [0=8bits, 1=16bits], default 0'}
    set_sub_1_ghz_starting_point = {'cmd': 'set_sub_1_ghz_starting_point', 'cmd_shortcut': 'st', 'num_of_args': ['1'], 'status_return': True, 'cmd_func': 'cmd_set_sub_1_ghz_starting_point', 'args': ['SUB1G_START_POINT_MODE'], 'desc': 'set the Gateway sub1g time sync w.r.t the 2.4 transmission. mode 0 = starts with the first beacon [default], 1 = starts after completing beacons in 2.4 transmission. defaul 0, e.g. 1'}
