Innova300 C Series.
| 47 | |
| 48 | |
| 49 | class Innova300C(MessageBasedDriver): |
| 50 | """Innova300 C Series. |
| 51 | """ |
| 52 | |
| 53 | |
| 54 | DEFAULTS = {'ASRL': {'write_termination': '\r\n', |
| 55 | 'read_termination': '\r\n', |
| 56 | 'baud_rate': 1200, |
| 57 | 'bytesize': 8, |
| 58 | 'parity': constants.Parity.none, |
| 59 | 'stop_bits': constants.StopBits.one, |
| 60 | 'encoding': 'ascii', |
| 61 | }} |
| 62 | |
| 63 | |
| 64 | def initialize(self): |
| 65 | super().initialize() |
| 66 | self.echo_enabled = False |
| 67 | |
| 68 | def query(self, command, *, send_args=(None, None), recv_args=(None, None)): |
| 69 | """Send query to the laser and return the answer, after handling |
| 70 | possible errors. |
| 71 | |
| 72 | :param command: command to be sent to the instrument |
| 73 | :type command: string |
| 74 | """ |
| 75 | ans = super().query(command, send_args=send_args, recv_args=recv_args) |
| 76 | # TODO: Echo handling |
| 77 | if ans == 'Out of Range': |
| 78 | raise ValueError() |
| 79 | elif ans.startswith('Syntax Error'): |
| 80 | raise InvalidCommand() |
| 81 | elif ans == 'Laser must be off': |
| 82 | raise Exception('Laser must be off') |
| 83 | |
| 84 | return ans |
| 85 | |
| 86 | |
| 87 | # General information and communication |
| 88 | |
| 89 | idn = make_feat('ID', |
| 90 | readonly=True, |
| 91 | doc='Laser identification, should be I300.', |
| 92 | read_once=True) |
| 93 | |
| 94 | software_rev = make_feat('SOFTWARE', |
| 95 | readonly=True, |
| 96 | doc='Software revision level in the power supply.', |
| 97 | read_once=True) |
| 98 | |
| 99 | head_software_rev = make_feat('HEAD SOFTWARE', |
| 100 | readonly=True, |
| 101 | doc='Software revision level in the laser head board.', |
| 102 | read_once=True) |
| 103 | |
| 104 | echo_enabled = make_feat('ECHO', |
| 105 | writeonly=True, |
| 106 | doc='Echo mode of the serial interface.', |