Skip to content

Commit

Permalink
Change Language of an Instrument to TSP On Info (#47)
Browse files Browse the repository at this point in the history
  • Loading branch information
esarver authored Dec 20, 2024
1 parent a4cb919 commit e76f386
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 43 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,15 @@ Check [Keep a Changelog](http://keepachangelog.com/) for recommendations on how

- Determining supported instruments now depends on `kic-lib` implementation, not
a local re-implementation.
- Change instrument language during an `info` command.

## [0.19.0]

### Changed

- For instruments that support both SCPI and TSP command languages, force the
command language to TSP when doing `kic info`

### Added

- Added the `dump` subcommand to connect to an instrument and dump out the contents
Expand Down
80 changes: 40 additions & 40 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ serde_json = "1.0.114"
thiserror = "2.0.3"
tracing = { version = "0.1.40", features = ["async-await"] }
tracing-subscriber = { version = "0.3.18", features = ["json"] }
tsp-toolkit-kic-lib = { git = "https://github.com/tektronix/tsp-toolkit-kic-lib.git", tag = "v0.19.0" }
tsp-toolkit-kic-lib = { git = "https://github.com/tektronix/tsp-toolkit-kic-lib.git", tag = "v0.19.1" }

[workspace.lints.rust]
warnings = "deny"
Expand Down
14 changes: 13 additions & 1 deletion kic-visa/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ use tracing::{debug, error, info, instrument, level_filters::LevelFilter, trace,
use tracing_subscriber::{layer::SubscriberExt, Layer, Registry};

use tsp_toolkit_kic_lib::{
instrument::Instrument, interface::async_stream::AsyncStream, protocol::Protocol, Interface,
instrument::{CmdLanguage, Instrument},
interface::async_stream::AsyncStream,
protocol::Protocol,
Interface,
};

#[derive(Debug, Subcommand)]
Expand Down Expand Up @@ -998,6 +1001,15 @@ fn info(args: &ArgMatches) -> anyhow::Result<()> {
unreachable!("arguments didn't exist")
};

match instrument.get_language() {
Ok(CmdLanguage::Tsp) => {}
Ok(_) => match instrument.change_language(CmdLanguage::Tsp) {
Ok(_) => {}
Err(e) => error!("Error setting instrument language to TSP: {e}"),
},
Err(e) => error!("Unable to determine instrument language: {e}"),
}

let json: bool = *args.get_one::<bool>("json").unwrap_or(&true);

let info = match instrument.info() {
Expand Down
14 changes: 13 additions & 1 deletion kic/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,10 @@ use tracing::{debug, error, info, instrument, level_filters::LevelFilter, trace,
use tracing_subscriber::{layer::SubscriberExt, Layer, Registry};

use tsp_toolkit_kic_lib::{
instrument::Instrument, interface::async_stream::AsyncStream, protocol::Protocol, Interface,
instrument::{CmdLanguage, Instrument},
interface::async_stream::AsyncStream,
protocol::Protocol,
Interface,
};

#[derive(Debug, Subcommand)]
Expand Down Expand Up @@ -987,6 +990,15 @@ fn info(args: &ArgMatches) -> anyhow::Result<()> {
unreachable!("arguments didn't exist")
};

match instrument.get_language() {
Ok(CmdLanguage::Tsp) => {}
Ok(_) => match instrument.change_language(CmdLanguage::Tsp) {
Ok(_) => {}
Err(e) => error!("Error setting instrument language to TSP: {e}"),
},
Err(e) => error!("Unable to determine instrument language: {e}"),
}

let json: bool = *args.get_one::<bool>("json").unwrap_or(&true);

let info = match instrument.info() {
Expand Down

0 comments on commit e76f386

Please sign in to comment.