1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/*
 * File: link.rs
 * Project: src
 * Created Date: 22/05/2020
 * Author: Shun Suzuki
 * -----
 * Last Modified: 22/05/2020
 * Modified By: Shun Suzuki (suzuki@hapis.k.u-tokyo.ac.jp)
 * -----
 * Copyright (c) 2020 Hapis Lab. All rights reserved.
 *
 */

use std::error::Error;

/// Link is a interface to the AUTD device.
pub trait Link: Send {
    fn open(&mut self) -> Result<(), Box<dyn Error>>;
    fn close(&mut self) -> Result<(), Box<dyn Error>>;
    fn send(&mut self, data: Vec<u8>) -> Result<(), Box<dyn Error>>;
    fn read(&mut self, buffer_len: u32) -> Result<Vec<u8>, Box<dyn Error>>;
    fn is_open(&self) -> bool;
    fn calibrate(&mut self) -> Result<bool, Box<dyn Error>>;
}