AsciiRegister¶
- class lsst.ts.tunablelaser.AsciiRegister(commander, module_name, module_id, register_name, read_only=True, accepted_values=None, simulation_mode=False)¶
Bases:
object
A representation of an Ascii register inside of a module of the laser.
The class corresponds to a register within a module of a laser. A register can be read only or writable. If it is read only then the
accepted_values
argument is ignored.- Parameters:
- commander
TCPIPClient
A TCP/IP stream that writes and reads from the TunableLaser terminal server.
- module_name
str
The name of the module that is the parent of the register.
- module_id
int
The id of the module that is the parent of the register.
- register_name
str
The name of the register.
- read_only
bool
, optional Whether the register is read only or writable.
- accepted_values
list
[str
] orlist
[int
] orNone
, optional If read_only is set to true then this parameter can be None. If not, this parameter must contain a list of values accepted by this register and can be of int or str.
- simulation_mode
bool
, optional A bool representing whether the register is in simulation mode or not. Currently is not implemented.
- commander
- Attributes:
- log
logging.Logger
The log for this class.
- commander
TCPIPClient
A TCP/IP client for communicating with the TunableLaser.
- module_name
str
The name of the module that is the parent of the register.
- module_id
int
The id of the module that is the parent of the register.
- register_name
str
The name of the register.
- read_only
bool
Whether the register is read only or writable.
- accepted_values
list
If read_only is set to true then this parameter can be None. If not, this parameter must contain a list of values accepted by this register and can be of int or str.
- simulation_mode
bool
A bool representing whether the register is in simulation mode or not. Currently has a basic implementation.
- register_value
str
The value of the register as gotten by
get_register_value()
.
- log
Methods Summary
Generate the message that will get the register value.
create_set_message
(set_value)Create the message that sets the value of the register provided that it is not read only.
Read the value of the register.
set_register_value
(set_value)Set the value of the register and read the new value.
Methods Documentation
- create_get_message()¶
Generate the message that will get the register value.
- Returns:
- get_message:
bytes
- get_message:
- create_set_message(set_value)¶
Create the message that sets the value of the register provided that it is not read only.
- Parameters:
- set_valueAny
- Returns:
- set_message
bytes
- set_message
- Raises:
- ReadOnlyException
Indicates that the register is read only.
- ValueError
Indicates that the value received is not in the acceptable values for the register.
- async read_register_value()¶
Read the value of the register.
- Returns:
- None
- async set_register_value(set_value)¶
Set the value of the register and read the new value.
- Parameters:
- set_valueAny
- Returns:
- None
- Raises:
- ReadOnlyException
This indicates that the register is read only and cannot be set.