from ..........Internal.Core import Core
from ..........Internal.CommandsGroup import CommandsGroup
from ..........Internal import Conversions
from .......... import repcap


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class Use:
	"""Use commands group definition. 1 total commands, 0 Sub-groups, 1 group commands"""

	def __init__(self, core: Core, parent):
		self._core = core
		self._base = CommandsGroup("use", core, parent)

	def set(self, use: bool, userIx=repcap.UserIx.Default, cell=repcap.Cell.Default) -> None:
		"""SCPI: [SOURce<HW>]:BB:EUTRa:DL:USER<CH>:SCRambling:CELL<ST>:DMRS:USE \n
		Snippet: driver.source.bb.eutra.downlink.user.scrambling.cell.dmrs.use.set(use = False, userIx = repcap.UserIx.Default, cell = repcap.Cell.Default) \n
		Defines how the DMRS scrambling sequence is initialized. \n
			:param use: 0| 1| OFF| ON OFF DRMS sequence is generated with the variable nID = NIDcell. ON Used are two variable nID = nIDDMRS,i set with the commands [:SOURcehw]:BB:EUTRa:DL:USERch:SCRambling:CELLst:DMRS:ID1|ID2
			:param userIx: optional repeated capability selector. Default value: Nr1 (settable in the interface 'User')
			:param cell: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Cell')"""
		param = Conversions.bool_to_str(use)
		userIx_cmd_val = self._base.get_repcap_cmd_value(userIx, repcap.UserIx)
		cell_cmd_val = self._base.get_repcap_cmd_value(cell, repcap.Cell)
		self._core.io.write(f'SOURce<HwInstance>:BB:EUTRa:DL:USER{userIx_cmd_val}:SCRambling:CELL{cell_cmd_val}:DMRS:USE {param}')

	def get(self, userIx=repcap.UserIx.Default, cell=repcap.Cell.Default) -> bool:
		"""SCPI: [SOURce<HW>]:BB:EUTRa:DL:USER<CH>:SCRambling:CELL<ST>:DMRS:USE \n
		Snippet: value: bool = driver.source.bb.eutra.downlink.user.scrambling.cell.dmrs.use.get(userIx = repcap.UserIx.Default, cell = repcap.Cell.Default) \n
		Defines how the DMRS scrambling sequence is initialized. \n
			:param userIx: optional repeated capability selector. Default value: Nr1 (settable in the interface 'User')
			:param cell: optional repeated capability selector. Default value: Nr1 (settable in the interface 'Cell')
			:return: use: 0| 1| OFF| ON OFF DRMS sequence is generated with the variable nID = NIDcell. ON Used are two variable nID = nIDDMRS,i set with the commands [:SOURcehw]:BB:EUTRa:DL:USERch:SCRambling:CELLst:DMRS:ID1|ID2"""
		userIx_cmd_val = self._base.get_repcap_cmd_value(userIx, repcap.UserIx)
		cell_cmd_val = self._base.get_repcap_cmd_value(cell, repcap.Cell)
		response = self._core.io.query_str(f'SOURce<HwInstance>:BB:EUTRa:DL:USER{userIx_cmd_val}:SCRambling:CELL{cell_cmd_val}:DMRS:USE?')
		return Conversions.str_to_bool(response)
