UD Box 5G

class tlkcore.tmydev.DevUDBox.UDBox(*parent)

Bases: UDConverter

UDBox 5G

queryStaticIP()

Query the static IP address of the device.

Parameters:

sn (str) – The serial number of the device.

Returns:

RetData
  • str: Static IP of the device.

Return type:

RetType

Note

Some FW versions of device not support this feature

Examples

Query the static IP address of a device:
>>> static_ip = service.queryStaticIP(sn).RetData
>>> print(f"Static IP Address: {static_ip}")
Static IP Address: 192.168.100.112
resetStaticIP(reboot=False)

Reset the static IP address of the device, and reboot or not.

Parameters:

reboot (bool, optional) – reboot device after setting static IP. Defaults to False.

Return type:

RetType

Note

Some FW versions of device not support this feature.

Examples

Set the static IP address of a device:
>>> from tlkcore.TLKCoreService import TLKCoreService
>>> service = TLKCoreService(".")
>>> sn = "UD-BD21080037-24"
>>> info = [sn, "192.168.100.112", 15]
>>> service.initDev(*tuple(info))
>>> service.resetStaticIP(sn, True)
getUDFreq()

Query frequency configuration from UD

Returns:

RetData
  • dict: the frequency configuration with the following keys
    • IFFreq: The IF range in kHz.

    • UDFreq: The UD frequency range in kHz.

    • RFFreq: The RF range in kHz.

Return type:

RetType

Changed in version TLKCore: v1.2.1 and UD5G v3.0.0 starts to support query real UD frequency configurations.

getUDState(item: UDState | int = UDState.NO_SET)

Retrieve all or a specific UD state.

Parameters:

item (Union[UDState, int], optional) – The specific UD state to retrieve. Defaults to UDState.NO_SET.

Returns:

RetData, and it returns the different types from the different queries.
  • dict: A dictionary of all UD states if item is UDState.NO_SET.

  • int: The value of the specific UD state if item is a specific state.

Return type:

RetType

Examples

  • Get the current state of the PLO lock:
    >>> state = service.getUDState(sn, UDState.PLO_LOCK)
    >>> print(state)
    1
    
  • Get all UD states:
    >>> state = service.getUDState(sn)
    >>> print(state)
    {'PLO_LOCK': 1, 'CH1': 1, 'CH2': 1, 'OUT_10M': 0, 'OUT_100M': 0, 'SOURCE_100M': 0, 'LED_100M': 1, 'PWR_5V': 0, 'PWR_9V': 0}
    
setUDState(newState, item: UDState | int = UDState.NO_SET)

Set all or a specific UD state.

..note::

PLO_LOCK does not allow to set.

Parameters:
  • newState (Union[dict, UD_REF, int]) –

    dict:
    • {UDState: value, …} if item use default value: NO_SET for ALL states.

    UD_REF:
    int:
    • int value if item uses single UD states: Use an integer value.

  • item (Union[UDState, int], optional) – The specific UD state to set. Defaults to NO_SET.

Returns:

RetData. An object containing the result of the operation.
  • dict: A dictionary of all UD states if item is NO_SET.

  • int: The value of the specific UD state if item is a specific state.

Return type:

RetType

Examples

  • Set the CH1 state off then on:
    >>> service.setUDState(sn, 0, UDState.CH1)
    >>> service.setUDState(sn, 1, UDState.CH1)
    
  • Switch 100M reference source to external, then please plug-in reference source:
    >>> service.setUDState(sn, UD_REF.EXTERNAL, UDState.SOURCE_100M)
    
  • Get ALL states, and modify partial states to set (e.g. set CH1 on and output 100M reference clock):
    state = service.getUDState(sn).RetData
    state.update({
        UDState.OUT_100M.name: 1,
        UDState.PWR_5V.name: 1
    })
    new_state = service.setUDState(sn, state)
    print(f"new_state: {new_state}")
    

    new_state: {‘PLO_LOCK’: 1, ‘CH1’: 1, ‘CH2’: 1, ‘OUT_10M’: 0, ‘OUT_100M’: 1, ‘SOURCE_100M’: 0, ‘LED_100M’: 1, ‘PWR_5V’: 1, ‘PWR_9V’: 0}

checkFWVersion(min_version: VER, msg: str = '') RetType

Check if the current firmware version is greater than or equal to the minimum required version.

Parameters:

min_version (VER) – The minimum required firmware version.

Returns:

RetData
  • bool: True if the current firmware version is sufficient, False otherwise.

Return type:

RetType

checkHWVersion(versions: List[VER], msg: str = '', check_version: VER = None) RetType

Check if the current hardware version is greater than or equal to the minimum required version.

Parameters:

version (VER) – The minimum required hardware version.

Returns:

RetData
  • bool: True if the current hardware version is sufficient, False otherwise.

Return type:

RetType

getDFUSupport()

Check if the device supports Device Firmware Upgrade (DFU).

Returns:

RetData
  • bool: True if DFU is supported, False otherwise.

Return type:

RetType

getDevTypeName()

Retrieve current name of device.

Returns:

Name of device

Examples

>>> service.getDevTypeName(sn)
'RIS'
getFullRefSourceStatus()

Retrieve the full reference source status including source, output, and frequency.

Parameters:

None

Returns:

RetData
  • dict: A dictionary with the following keys
    • source (UD_REF): The reference source (internal or external).

    • output (bool): Whether the internal reference source is outputting.

    • freq (int): The frequency of the reference source in kHz.

Return type:

RetType

Examples

  • Get the full reference source status:
    >>> status = service.getFullRefSourceStatus(sn).RetData
    >>> print(status)
    {'source': UD_REF.INTERNAL, 'output': True, 'freq': 100000}
    
getHarmonic(freq_ud: int | float, freq_if: int | float, bandwidth: int | float)

Check if the freq setting affected by harmonic (KHz), not check equation here.

Note

This function always return OK, please monitor the RetData.

Parameters:
  • freq_ud (Union[int,float]) – LO frequency as kHz

  • freq_if (Union[int,float]) – IF frequency as kHz

  • bandwidth (Union[int,float]) – bandwidth frequency as kHz

Returns:

RetData
  • bool: harmonic or not

Return type:

RetType

Examples

  • Normal case
    >>> ret = service.getHarmonic(sn, 24e6, 4e6, 100000)
    >>> print(ret)
    False
    
  • Harmonic case
    >>> ret = service.getHarmonic(sn, 24e6, 3e6, 100000)
    >>> print(ret)
    True
    

Changed in version TLKCore: v2.1.0 removed freq_rf parameter

getInjectionLO(freq_rf, freq_if)

Get the High-side / Low-side Injection LO frequency based on the RF and IF frequencies in kHz.

LSI

RF

HSI

LO=RF-IF

RF

LO=RF+IF

Parameters:
  • freq_rf (float) – The RF frequency with unit in kHz.

  • freq_if (float) – The IF frequency with unit in kHz.

Returns:

RetData
  • dict: A dictionary with the following keys
    • LSI (float): Low-side (LO<RF) LO frequency in kHz.

    • HSI (float): High-side (LO>RF) LO frequency in kHz.

Return type:

RetType

Examples

>>> inj = service.getInjectionLO(sn, 28e6, 2e6).RetData
>>> print(inj)
{'LSI': 26000000.0, 'HSI': 30000000.0}

Added in version v2.3.0.

getRecommendLO(freq_rf, freq_if, bandwidth)

Get the recommended local oscillator (LO) frequency based on the RF and IF frequencies.

Deprecated since version v2.3.0: Please use getInjectionLO instead.

queryFWVer()

Query FW version of the device.

Returns:

RetData
  • str: FW version.

Return type:

RetType

Examples

>>> fw_version = service.queryFWVer(sn).RetData
>>> print(f"FW Version: {fw_version}")
v1.0.0
queryHWVer()

Query the hardware version of the device.

Returns:

RetData
  • str: The hardware version as a string.

Return type:

RetType

Examples

  • Query the hardware version of the device
    >>> hw_version = service.queryHWVer(sn).RetData
    >>> print(f"Hardware Version: {hw_version}")
    
queryLoaderVer()

Query the bootloader version of the device.

Returns:

RetData
  • str: The bootloader version as a string.

Return type:

RetType

queryMAC()

Query the MAC address of the device.

Returns:

An object containing the MAC address of the device.
  • str: The MAC address as a string.

Return type:

RetType

Examples

Query the MAC address of the device
>>> mac_address = service.queryMAC(sn).RetData
>>> print(f"MAC Address: {mac_address}")
MAC Address: 00:0C:FE:AA:BB:01
querySN()

Query the serial number of the device.

Returns:

RetData
  • str: The serial number of the device.

Return type:

RetType

reboot()

Reboot of the device.

Returns:

An object containing the result of the reboot process.
  • OK: If the reboot process completes successfully.

Return type:

RetType

setStaticIP(ip, reboot=True)

Set the static IP address of the device, and reboot or not.

Note

Support LAN device only,

Parameters:
  • ip (str) – IP with x.x.x.x format

  • reboot (bool, optional) – reboot device after setting static IP. Defaults to True.

Note

Some FW versions of device not support this reboot feature.

Return type:

RetType

Examples

Set the static IP address of a device:
>>> service.setStaticIP(sn, "192.168.100.150", True)

Changed in version v2.4.7: for UD Box 0630, UD Box 5G, and BBox 8x8 Duo devices. Rebooting after an IP address change is now enabled by default.

setUDFreq(freq_ud: int | float, freq_rf: int | float = 0, freq_if: int | float = 0, bandwidth: int | float = 100000, forceSend=False)

Set UD frequency in kHz, it also calls getHarmonic() if not forced.

Note

Setting will make effect even if harmonic warning

Parameters:
  • freq_ud (Union[int, float]) – The UD frequency in kHz.

  • freq_rf (Union[int, float], optional) – The RF frequency in kHz. Defaults to 0.

  • freq_if (Union[int, float], optional) – The IF frequency in kHz. Defaults to 0.

  • bandwidth (Union[int, float], optional) – The bandwidth in kHz. Defaults to 100000.

  • forceSend (bool, optional) – True to force send the frequency. Defaults to False.

Return type:

RetType

Examples

  • Set UD frequency to 25GHz with RF frequency 28GHz and IF frequency 3GHz
    >>> ret = service.setUDFreq(sn, 25e6, 28e6, 3e6)
    >>> print(ret)
    [RetType] OK
    >>> ret = service.getUDFreq(sn)
    >>> print(ret)
    {'UDFreq': 25000000.0, 'RFFreq': 0, 'IFFreq': 0}
    
  • Set UD frequency to 24GHz with RF frequency 27GHz and IF frequency 3GHz -> Harmonic warning but still set
    >>> ret = service.setUDFreq(sn, 24e6, 27e6, 3e6)
    >>> print(ret)
    [RetType] WARNING_HARMONIC, Harmonic warning <LO:24000000,IF:3000000> by IF range: (2880000.0, 3120000.0)
    >>> ret = service.getUDFreq(sn)
    >>> print(ret)
    {'UDFreq': 24000000.0, 'RFFreq': 0, 'IFFreq': 0}
    
  • Set UD frequency to 26GHz only -> equation error due to default RF/IF frequency
    >>> ret = service.setUDFreq(sn, 26000000)
    >>> print(ret)
    [RetType] ERROR_FREQ_EQUATION, Frequency equation error !
    >>> ret = service.getUDFreq(sn)
    >>> print(ret)
    {'UDFreq': 24000000.0, 'RFFreq': 0, 'IFFreq': 0}
    
  • Set UD frequency to 26GHz forcefully
    >>> ret = service.setUDFreq(sn=sn, freq_ud=26000000, forceSend=True)
    >>> print(ret)
    [RetType] OK
    >>> ret = service.getUDFreq(sn)
    >>> print(ret)
    {'UDFreq': 26000000.0, 'RFFreq': 0, 'IFFreq': 0}