Source code for rsmxo.Implementations.System.Time

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


# noinspection PyPep8Naming,PyAttributeOutsideInit,SpellCheckingInspection
class TimeCls:
	"""
	| Commands in total: 1
	| Subgroups: 0
	| Direct child commands: 1
	"""

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

[docs] def set(self, hours: int, minutes: int, seconds: int) -> None: """ ``SYSTem:TIME`` \n Snippet: ``driver.system.time.set(hours = 1, minutes = 1, seconds = 1)`` \n Returns the current time of the clock. :param hours: 0 to 24 :param minutes: 0 to 59 :param seconds: 0 to 59 """ param = ArgSingleList().compose_cmd_string(ArgSingle('hours', hours, DataType.Integer), ArgSingle('minutes', minutes, DataType.Integer), ArgSingle('seconds', seconds, DataType.Integer)) self._core.io.write(f'SYSTem:TIME {param}'.rstrip())
# noinspection PyTypeChecker
[docs] class TimeStruct(StructBase): """ Response structure. Fields: \n - 1 Hours: int: 0 to 24 - 2 Minutes: int: 0 to 59 - 3 Seconds: int: 0 to 59 """ __meta_args_list = [ ArgStruct.scalar_int('Hours'), ArgStruct.scalar_int('Minutes'), ArgStruct.scalar_int('Seconds')] def __init__(self): StructBase.__init__(self, self) self.Hours: int = None self.Minutes: int = None self.Seconds: int = None
[docs] def get(self) -> TimeStruct: """ ``SYSTem:TIME`` \n Snippet: ``value: TimeStruct = driver.system.time.get()`` \n Returns the current time of the clock. :return: structure: for return value, see the help for TimeStruct structure arguments. """ return self._core.io.query_struct(f'SYSTem:TIME?', self.__class__.TimeStruct())