Enhance device channel handling

Introduced a new utility function to extract and return the number of
channels associated with a given device, improving the driver's ability
to handle device-specific configurations. Also expanded the C++ bindings
by importing the pair class, which is pivotal for representing the
channel information. This enhancement facilitates more granular control
and paves the way for future features that may require detailed channel
info.
This commit is contained in:
Kumi 2024-02-17 18:02:59 +01:00
parent 0696cc3b20
commit ce89c445d7
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -7,6 +7,7 @@ from libc.string cimport memcpy, strcpy
from libcpp.vector cimport vector
from libcpp.string cimport string
from libcpp.pair cimport pair
import pathlib
@ -95,6 +96,8 @@ cdef extern from "limedriver.h":
cdef int run_experiment_from_LimeCfg(LimeConfig_t config)
cdef pair[int, int] getChannelsFromInfo(string device)
cdef vector[string] getDeviceList()
@ -718,4 +721,8 @@ cdef class PyLimeConfig:
def get_device_list():
cdef vector[string] devices = getDeviceList()
return [device.decode('utf-8') for device in devices]
return [device.decode('utf-8') for device in devices]
def get_channels_for_device(device):
cdef pair[int, int] channels = getChannelsFromInfo(device)
return channels.first, channels.second