1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
 * File: mod.rs
 * Project: link
 * Created Date: 09/05/2023
 * Author: Shun Suzuki
 * -----
 * Last Modified: 14/09/2023
 * Modified By: Shun Suzuki (suzuki@hapis.k.u-tokyo.ac.jp)
 * -----
 * Copyright (c) 2023 Shun Suzuki. All rights reserved.
 *
 */

mod bundle;
mod debug;
mod log;
mod test;

use autd3_driver::{
    cpu::{RxDatagram, TxDatagram},
    error::AUTDInternalError,
    geometry::{Device, Transducer},
    link::Link,
};
pub use bundle::Bundle;
pub use debug::Debug;
pub use log::{IntoLog, Log};
pub use test::Test;

/// Link to do nothing
pub struct NullLink {}

impl<T: Transducer> Link<T> for NullLink {
    fn open(&mut self, _devices: &[Device<T>]) -> Result<(), AUTDInternalError> {
        Ok(())
    }

    fn close(&mut self) -> Result<(), AUTDInternalError> {
        Ok(())
    }

    fn send(&mut self, _tx: &TxDatagram) -> Result<bool, AUTDInternalError> {
        Ok(true)
    }

    fn receive(&mut self, _rx: &mut RxDatagram) -> Result<bool, AUTDInternalError> {
        Ok(true)
    }

    fn is_open(&self) -> bool {
        true
    }

    fn timeout(&self) -> std::time::Duration {
        std::time::Duration::ZERO
    }
}