from .......Internal.Core import Core
from .......Internal.CommandsGroup import CommandsGroup
from .......Internal.Types import DataType
from .......Internal.StructBase import StructBase
from .......Internal.ArgStruct import ArgStruct
from .......Internal.ArgSingleList import ArgSingleList
from .......Internal.ArgSingle import ArgSingle
from ....... import repcap


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class FrequencyCls:
	"""Frequency commands group definition. 1 total commands, 0 Subgroups, 1 group commands"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._cmd_group = CommandsGroup("frequency", core, parent)

	def set(self, frequency_1: float, frequency_2: float, internalGen=repcap.InternalGen.Default) -> None:
		"""SCPI: SOURce:AFRF:GENerator<Instance>:IGENerator<nr>:DTONe:FREQuency \n
		Snippet: driver.source.afRf.generator.internalGenerator.dtone.frequency.set(frequency_1 = 1.0, frequency_2 = 1.0, internalGen = repcap.InternalGen.Default) \n
		Configures the frequencies of a dual-tone signal, generated by an internal audio generator. \n
			:param frequency_1: Range: 0 Hz to 21 kHz, Unit: Hz
			:param frequency_2: Range: 0 Hz to 21 kHz, Unit: Hz
			:param internalGen: optional repeated capability selector. Default value: Nr1 (settable in the interface 'InternalGenerator')
		"""
		param = ArgSingleList().compose_cmd_string(ArgSingle('frequency_1', frequency_1, DataType.Float), ArgSingle('frequency_2', frequency_2, DataType.Float))
		internalGen_cmd_val = self._cmd_group.get_repcap_cmd_value(internalGen, repcap.InternalGen)
		self._core.io.write(f'SOURce:AFRF:GENerator<Instance>:IGENerator{internalGen_cmd_val}:DTONe:FREQuency {param}'.rstrip())

	# noinspection PyTypeChecker
	class FrequencyStruct(StructBase):
		"""Response structure. Fields: \n
			- Frequency_1: float: Range: 0 Hz to 21 kHz, Unit: Hz
			- Frequency_2: float: Range: 0 Hz to 21 kHz, Unit: Hz"""
		__meta_args_list = [
			ArgStruct.scalar_float('Frequency_1'),
			ArgStruct.scalar_float('Frequency_2')]

		def __init__(self):
			StructBase.__init__(self, self)
			self.Frequency_1: float = None
			self.Frequency_2: float = None

	def get(self, internalGen=repcap.InternalGen.Default) -> FrequencyStruct:
		"""SCPI: SOURce:AFRF:GENerator<Instance>:IGENerator<nr>:DTONe:FREQuency \n
		Snippet: value: FrequencyStruct = driver.source.afRf.generator.internalGenerator.dtone.frequency.get(internalGen = repcap.InternalGen.Default) \n
		Configures the frequencies of a dual-tone signal, generated by an internal audio generator. \n
			:param internalGen: optional repeated capability selector. Default value: Nr1 (settable in the interface 'InternalGenerator')
			:return: structure: for return value, see the help for FrequencyStruct structure arguments."""
		internalGen_cmd_val = self._cmd_group.get_repcap_cmd_value(internalGen, repcap.InternalGen)
		return self._core.io.query_struct(f'SOURce:AFRF:GENerator<Instance>:IGENerator{internalGen_cmd_val}:DTONe:FREQuency?', self.__class__.FrequencyStruct())
