Skip to content

Commit 5f1e684

Browse files
committed
Break up data module, move device to own module and top level
1 parent 18436f2 commit 5f1e684

File tree

8 files changed

+828
-808
lines changed

8 files changed

+828
-808
lines changed

twinleaf-tools/src/bin/tio-monitor.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,8 +215,7 @@ fn main() {
215215
};
216216

217217
let proxy = tio::proxy::Interface::new(&root);
218-
let device = proxy.device_full(route).unwrap();
219-
let mut device = data::Device::new(device);
218+
let mut device = twinleaf::Device::open(&proxy, route);
220219

221220
let mut stdout = std::io::stdout();
222221
if let Ok(()) = terminal_setup(&stdout) {

twinleaf-tools/src/bin/tio-tool.rs

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -343,13 +343,11 @@ fn dump(args: &[String]) -> Result<(), ()> {
343343
}
344344

345345
fn meta_dump(args: &[String]) -> Result<(), ()> {
346-
use twinleaf::data::Device;
347346
let opts = tio_opts();
348347
let (_matches, root, route) = tio_parseopts(&opts, args);
349348

350349
let proxy = proxy::Interface::new(&root);
351-
let device = proxy.device_full(route).unwrap();
352-
let mut device = Device::new(device);
350+
let mut device = twinleaf::Device::open(&proxy, route);
353351

354352
let meta = device.get_metadata();
355353
println!("{:?}", meta.device);
@@ -378,13 +376,11 @@ fn print_sample(sample: &twinleaf::data::Sample) {
378376
}
379377

380378
fn data_dump(args: &[String]) -> Result<(), ()> {
381-
use twinleaf::data::Device;
382379
let opts = tio_opts();
383380
let (_matches, root, route) = tio_parseopts(&opts, args);
384381

385382
let proxy = proxy::Interface::new(&root);
386-
let device = proxy.device_full(route).unwrap();
387-
let mut device = Device::new(device);
383+
let mut device = twinleaf::Device::open(&proxy, route);
388384

389385
loop {
390386
print_sample(&device.next());
@@ -433,7 +429,6 @@ fn log(args: &[String]) -> Result<(), ()> {
433429
}
434430

435431
fn log_metadata(args: &[String]) -> Result<(), ()> {
436-
use twinleaf::data::Device;
437432
let mut opts = tio_opts();
438433
opts.optopt(
439434
"f",
@@ -448,8 +443,7 @@ fn log_metadata(args: &[String]) -> Result<(), ()> {
448443
}
449444

450445
let proxy = proxy::Interface::new(&root);
451-
let device = proxy.device_full(route).unwrap();
452-
let mut device = Device::new(device);
446+
let mut device = twinleaf::Device::open(&proxy, route);
453447

454448
let meta = device.get_metadata();
455449
let output_path = if let Some(path) = matches.opt_str("f") {

0 commit comments

Comments
 (0)