|
@@ -16,75 +16,57 @@
|
|
|
#
|
|
|
# You should have received a copy of the GNU General Public License
|
|
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
|
-import logging
|
|
|
-from collections import OrderedDict
|
|
|
-from time import sleep
|
|
|
-from typing import List, Iterator
|
|
|
-from Serial import Interface, drain_serial
|
|
|
|
|
|
-logger = logging.getLogger(__name__)
|
|
|
+from .Hardware import get_interfaces
|
|
|
+from .NanoVNA_V2 import NanoVNA_V2_H4
|
|
|
|
|
|
+class MetaVna(type):
|
|
|
+ def __call__(cls, *args, **kwargs):
|
|
|
+ return super(MetaVna, NanoVNA_V2_H4).__call__(*args, **kwargs)
|
|
|
|
|
|
-class VNA:
|
|
|
- name = "VNA"
|
|
|
- wait = 0.05
|
|
|
+class Vna:
|
|
|
+ name = "Vna"
|
|
|
|
|
|
- def __init__(self, iface: Interface):
|
|
|
- self.iface = iface
|
|
|
- self.valid_freq = None
|
|
|
- self.valid_power = None
|
|
|
- self.valid_bw = None
|
|
|
- self.valid_points = None
|
|
|
+ def __init__(self, *args, **kwargs):
|
|
|
+ super(Vna, self).__init__(*args, **kwargs)
|
|
|
|
|
|
|
|
|
- self.freq_start = None
|
|
|
- self.power = None
|
|
|
- self.points = None
|
|
|
- self.bw = None
|
|
|
-
|
|
|
def connect(self) -> bool:
|
|
|
- self.iface.open()
|
|
|
- return self.iface.isOpen()
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
def disconnect(self) -> bool:
|
|
|
- self.iface.close()
|
|
|
- return not self.iface.isOpen()
|
|
|
-
|
|
|
- def reconnect(self) -> bool:
|
|
|
- self.iface.close()
|
|
|
- sleep(self.wait)
|
|
|
- self.iface.open()
|
|
|
- return self.iface.isOpen()
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
def set_bw(self):
|
|
|
- pass
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
def set_sweep(self, freq_start: float, freq_end: float, points: int):
|
|
|
- pass
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
def get_bw(self) -> float:
|
|
|
- pass
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
- def get_sweep(self) -> List:
|
|
|
- pass
|
|
|
+ def get_sweep(self) -> list:
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
- def get_info(self) -> Dict:
|
|
|
- pass
|
|
|
+ def get_info(self) -> dict:
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
- def run(self) -> List:
|
|
|
- pass
|
|
|
+ def measure(self) -> list:
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
def set_power(self, power: float):
|
|
|
- pass
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
+
|
|
|
|
|
|
def get_power(self) -> float:
|
|
|
- pass
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
- def set_cal(self):
|
|
|
- pass
|
|
|
+ def set_cal(self):
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
def get_cal(self):
|
|
|
- pass
|
|
|
+ assert NotImplementedError('Device does not support this method')
|
|
|
|
|
|
|
|
|
|