GSI Online DNA¶
Description¶
Module: geocompy.gsi.dna
The dna package provides wrapper methods for all GSI Online commands
available on a DNA digital level instrument.
Types¶
GsiOnlineDNA
Submodules¶
geocompy.gsi.dna.settingsgeocompy.gsi.dna.measurements
Definitions¶
-
class GsiOnlineDNA(connection: Connection, *, logger: Logger | None =
None, attempts: int =2)[source]¶ DNA GSI Online protocol handler.
The individual commands are available through their respective subsystems.
Examples
Opening a simple serial connection:
>>> from geocompy.communication import open_serial >>> from geocompy.gsi.dna import GsiOnlineDNA >>> >>> with open_serial("COM1") as line: ... dna = GsiOnlineDNA(line) ... dna.beep('SHORT') ... >>>Passing a logger:
>>> from sys import stdout >>> from logging import getLogger, DEBUG, StreamHandler >>> >>> from geocompy.communication import open_serial >>> from geocompy.gsi.dna import GsiOnlineDNA >>> >>> logger = getLogger("TPS") >>> logger.addHandler(StreamHandler(stdout)) >>> logger.setLevel(DEBUG) >>> with open_serial("COM1") as com: ... dna = GsiOnlineDNA(com, logger=logger) ... dna.beep('SHORT') ... >>> GsiOnlineResponse(GSI Type) ... # Startup GSI format sync GsiOnlineResponse(Beep) ... # First executed commandAfter all subsystems are initialized, the connection is tested / initiated with a wake up command (this means the instrument does not have to be turned on manually before initiating the connection). If the test fails, it is retried with one second delay (if multiple attempts are allowed).
- Parameters:
- Raises:
ConnectionRefusedError – If the connection could not be verified in the specified number of attempts.
- beep(beeptype: BEEPTYPE | str) GsiOnlineResponse[bool][source]¶
Gives a beep signal command to the instrument.
- Parameters:
- Returns:
Success of the execution.
- Return type:
- clear() GsiOnlineResponse[bool][source]¶
Clears the command receiver buffer and aborts any running continuous measurement.
- Returns:
Success of the execution.
- Return type:
- confrequest(param: int, parser: Callable[[str], _T]) GsiOnlineResponse[_T][source]¶
Executes a GSI Online CONF command and returns the result of the parameter query.
- getrequest(mode: str, wordtype: type[_G]) GsiOnlineResponse[_G][source]¶
Executes a GSI Online GET command and returns the parsed result of the GSI word query.
- Parameters:
- Returns:
Parsed value.
- Return type:
- putrequest(word: GsiWord) GsiOnlineResponse[bool][source]¶
Executes a GSI Online PUT command and returns the success of the operation.
- Parameters:
- Returns:
Success of the change.
- Return type:
-
request(cmd: str, desc: str =
'') GsiOnlineResponse[bool][source]¶ Executes a low level GSI Online command and returns the success of the execution.
- Parameters:
- Returns:
Success of the execution.
- Return type:
- setrequest(param: int, value: int) GsiOnlineResponse[bool][source]¶
Executes a GSI Online SET command and returns the success of the operation.
- Parameters:
- Returns:
Success of the parameter change.
- Return type:
- shutdown() GsiOnlineResponse[bool][source]¶
Shuts down the instrument.
- Returns:
Success of the execution.
- Return type:
- wakeup() GsiOnlineResponse[bool][source]¶
Wakes up the instrument.
- Returns:
Success of the execution.
- Return type:
- measurements : GsiOnlineDNAMeasurements[source]¶
Measurements subsystem.
- settings : GsiOnlineDNASettings[source]¶
Instrument settings subsystem.