RIS
- class tlkcore.tmydev.DevRIS.RISController(*parent)
Reconfigurable Intelligent Surface
- getNetInfo()
Retrieve basic network information in dictionary format.
- Returns:
RetData- dict: A dictionary with the following keys:
mac: The MAC address of the device.
ip_mode: The IP mode (e.g., DHCP or STATIC) as an
IPModeenum.ip: The current IP address of the device.
static_ip: The static IP address (if configured).
subnet_mask: The static subnet mask (if configured).
gateway: The static gateway address (if configured).
- Return type:
Examples
>>> ret = service.getNetInfo(sn) >>> print(ret.RetData) { 'mac': '8c:1f:aa:bb:12:10', 'ip_mode': <IPMode.DHCP: 0>, 'ip': '192.168.137.168', 'static_ip': '192.168.100.114', 'subnet_mask': '255.255.255.0', 'gateway': '192.168.100.1' }
- setIPMode(ip_mode: IPMode | int)
Set the IP mode for the device.
- Parameters:
ip_mode (Union[
IPMode, int]) – The IP mode to set. It can be an instance of IPMode or an integer.- Returns:
- Return type:
Examples
>>> service.setIPMode(sn, IPMode.STATIC)
- setSubnetMsk(mask)
Set the subnet mask for the device.
- setGateway(gateway)
Set the gateway address for the device.
- getRISModuleInfo()
Get all module’s freq info(MHz), hw version, fpga version…etc as json format
- Returns:
RetData- dict: A dictionary with the following keys:
module_sn: Module’s SN
hw_ver: Hardware version in hex
fpga_ver: FPGA version (e.g., “v1.0.0”)
element_spacing: Element spacing in mm (e.g., [5400, 5400])
antenna_size: Antenna size in elements (e.g., [32, 32])
edge_gap_size: Edge gap size in um (e.g., [L, R, U, D])
- freq_mhz: Supported frequency dictionary in range and step, unit: MHz.
central: Central frequency in MHz
min: Minimum frequency in MHz
max: Maximum frequency in MHz
step: Step frequency in MHz
- Return type:
Examples
>>> module_info = service.getRISModuleInfo(sn).RetData >>> print(module_info) { "1": { "module_sn": "RIS-2521000-0100", "hw_ver": "v0", "fpga_ver": "v1.0.0", "element_spacing": [5400, 5400], "antenna_size": [32, 32], "edge_gap_size": [49100, 50500, 49760, 49840], "freq_mhz": { "central": 28000, "min": 26000, "max": 30000, "step": 100 } }, "2": { ... }, "3": { ... }, "4": { ... } }
- setRISAngle(incident: RIS_Dir, reflection: RIS_Dir, module_config: RIS_ModuleConfig, save=False)
Set RIS pattern via Incident angle and Reflection angle
- Parameters:
incident (
RIS_Dir) – RIS direction for incident with distance in meters.reflection (
RIS_Dir) – RIS direction for reflection with distance in meters.module_config (
RIS_ModuleConfig) – RIS module config for combinationsave (bool, optional) – Save pattern to csv file for debugging. Defaults to False.
Note
RIS direction only accept positive numbers.
- Returns:
- Return type:
Examples
- Set RIS pattern with incident angle (0, 0) and reflection angle (45, 0), and distance is 1m, central freq set to 28G, only module 1 (port 1), not rotate.
>>> incident = RIS_Dir(('distance'=1, (0, 0))) >>> reflection = RIS_Dir(('distance'=1, (45, 0))) >>> module_config = RIS_ModuleConfig(28000, 1) >>> service.setRISAngle(sn, incident, reflection, module_config)
- Set RIS pattern with incident angle 60 and reflection angle 60
>>> incident = RIS_Dir(0, 60) >>> reflection = RIS_Dir(0, 60)
Changed in version v2.3.0: Modify parameters to
RIS_DirandRIS_ModuleConfig
- setRISPattern(module_pattern: list | dict)
Set RIS pattern in list or dict for single/multiple modules
- Parameters:
module_pattern (Union[list, dict) – only pattern or {module: pattern}, which pattern is a double list filled 0 or 1
Note
The size of pattern should match the
antenna_sizefromgetRISModuleInfo()- Returns:
- Return type:
Examples
- Set single pattern only, here demo a simple case for 4 x 2 array (“antenna_size”: [4, 2])
>>> ptn = [[1,0,1,1], [0,0,1,1]] >>> service.setRISPattern(sn, ptn)
- Set the group of module and pattern, here demo a simple case for module 1 & 2, with a 4 x 2 array (“antenna_size”: [4, 2])
>>> module_ptn = {1: [[1,0,1,1], [0,0,1,1]], 2: [[1,1,0,0], [1,1,0,0]]} >>> service.setRISPattern(sn, module_ptn)
Changed in version v2.1.3: Add
moduleChanged in version v2.3.0: Remove
moduleparam and extend tomodule_patternfor multiple modules
- getRISPattern(module: int | list = 1)
Get the current pattern of the RIS, and pattern format is a double list with 0 or 1.
- Parameters:
module (Union[int, list], optional) – assigned module or module list. Defaults to 1.
- Returns:
- Return type:
Changed in version v2.3.0: Add support for multiple modules
- getDFUSupport()
Check if the device supports Device Firmware Upgrade (DFU).
- getDevTypeName()
Retrieve current name of device
- Returns:
Name of device
Examples
>>> service.getDevTypeName(sn) 'RIS'
- processDFU(file_path: str, dfu_dev_info: dict)
Process the Device Firmware Upgrade (DFU) at the local side.
- Parameters:
file_path (str) – The file path to the firmware file to be uploaded.
dfu_dev_info (dict) –
Information about the DFU device.
sn (str): Serial number of the device.
address (str): Address of the device.
devtype (int): Device type as defined in TMYDevType.
in_dfu (bool): Indicates if the device is already in DFU mode.
fw_ver (str): Firmware version of the device.
hw_ver (str): Hardware version of the device.
- Returns:
- An object containing the result of the DFU process.
OK: If the DFU process completes successfully.ERROR_METHOD_NOT_SUPPORT: If DFU is not supported on the device.ERROR_DFU: If the DFU process encounters an error.
- Return type:
- queryFWVer()
Query FW version of the device.
Examples
>>> fw_version = service.queryFWVer(sn).RetData >>> print(f"FW Version: {fw_version}") v1.0.0
- queryHWVer()
Query the hardware version of the device.
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.
- 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:
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.
- queryStaticIP()
Query the static IP address of the device.
- Parameters:
sn (str) – The serial number of the device.
- Returns:
RetDatastr: Static IP of the device.
- Return type:
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.111
- reboot()
Reboot of the device.
- setStaticIP(ip, reboot=False)
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 False.
Note
Some FW versions of device not support this reboot feature.
- Return type:
Examples
- Set the static IP address of a device:
>>> service.setStaticIP(sn, "192.168.100.150", True)