|
| 1 | +from typing import Any |
| 2 | + |
| 3 | +from click_extra import ( |
| 4 | + extra_command, |
| 5 | + argument, |
| 6 | + Choice |
| 7 | +) |
| 8 | + |
| 9 | +from ..utils import ( |
| 10 | + com_port_argument, |
| 11 | + com_option_group |
| 12 | +) |
| 13 | + |
| 14 | + |
| 15 | +@extra_command( |
| 16 | + "gsidna", |
| 17 | + params=None, |
| 18 | + context_settings={"auto_envvar_prefix": None} |
| 19 | +) # type: ignore[misc] |
| 20 | +@com_port_argument() |
| 21 | +@com_option_group() |
| 22 | +def cli_shutdown_gsidna(**kwargs: Any) -> None: |
| 23 | + """ |
| 24 | + Deactivate a GSI Online capable digital level. |
| 25 | + """ |
| 26 | + from .app import main_shutdown_gsidna |
| 27 | + |
| 28 | + main_shutdown_gsidna(**kwargs) |
| 29 | + |
| 30 | + |
| 31 | +@extra_command( |
| 32 | + "geocom", |
| 33 | + params=None, |
| 34 | + context_settings={"auto_envvar_prefix": None} |
| 35 | +) # type: ignore[misc] |
| 36 | +@argument( |
| 37 | + "component", |
| 38 | + help="Instrument component to shut down", |
| 39 | + type=Choice( |
| 40 | + ( |
| 41 | + "protocol", |
| 42 | + "instrument", |
| 43 | + "edm", |
| 44 | + "pointer", |
| 45 | + "telescopic-camera", |
| 46 | + "overview-camera" |
| 47 | + ), |
| 48 | + case_sensitive=False |
| 49 | + ) |
| 50 | +) |
| 51 | +@com_port_argument() |
| 52 | +@com_option_group() |
| 53 | +def cli_shutdown_geocom(**kwargs: Any) -> None: |
| 54 | + """ |
| 55 | + Deactivate components of a GeoCom capable instrument. |
| 56 | +
|
| 57 | + To reduce power consumption, in certain scenarios it can be beneficial to |
| 58 | + power off some components of an instrument. Or shut down the entire machine |
| 59 | + completely. |
| 60 | +
|
| 61 | + Instruments before the TPS1200 series cannot be remotely reactivated after |
| 62 | + a complete shutdown (the GeoCom online mode has to be manually switched |
| 63 | + on). Similarly, instruments that are not connected by physical cable (but |
| 64 | + by Bluetooth for example) cannot be reactivated as the wireless connection |
| 65 | + can only be esatblished with an active instrument. Only shut down these |
| 66 | + instruments remotely if no further operation is needed until the next |
| 67 | + manual access. |
| 68 | + """ |
| 69 | + from .app import main_shutdown_geocom |
| 70 | + |
| 71 | + main_shutdown_geocom(**kwargs) |
| 72 | + |
| 73 | + |
| 74 | +@extra_command( |
| 75 | + "gsidna", |
| 76 | + params=None, |
| 77 | + context_settings={"auto_envvar_prefix": None} |
| 78 | +) # type: ignore[misc] |
| 79 | +@com_port_argument() |
| 80 | +@com_option_group() |
| 81 | +def cli_startup_gsidna(**kwargs: Any) -> None: |
| 82 | + """ |
| 83 | + Activate/reactivate a GSI Online capable digital level. |
| 84 | + """ |
| 85 | + from .app import main_startup_gsidna |
| 86 | + |
| 87 | + main_startup_gsidna(**kwargs) |
| 88 | + |
| 89 | + |
| 90 | +@extra_command( |
| 91 | + "geocom", |
| 92 | + params=None, |
| 93 | + context_settings={"auto_envvar_prefix": None} |
| 94 | +) # type: ignore[misc] |
| 95 | +@argument( |
| 96 | + "component", |
| 97 | + help="Instrument component to start up", |
| 98 | + type=Choice( |
| 99 | + ( |
| 100 | + "instrument", |
| 101 | + "edm", |
| 102 | + "pointer", |
| 103 | + "telescopic-camera", |
| 104 | + "overview-camera" |
| 105 | + ), |
| 106 | + case_sensitive=False |
| 107 | + ) |
| 108 | +) |
| 109 | +@com_port_argument() |
| 110 | +@com_option_group() |
| 111 | +def cli_startup_geocom(**kwargs: Any) -> None: |
| 112 | + """ |
| 113 | + Activate/reactivate components of a GeoCom capable instrument. |
| 114 | +
|
| 115 | + Instruments can be reactivated remotely after a complete shutdown only if |
| 116 | + they are TPS1200 or newer series and connected by a physical cable. |
| 117 | + """ |
| 118 | + from .app import main_startup_geocom |
| 119 | + |
| 120 | + main_startup_geocom(**kwargs) |
0 commit comments