use crate::serial_core::{
    frame::{TactileAFrame, TestFrame},
    record::Recording,
};

pub mod codec;
pub mod codecs;
pub mod error;
pub mod frame;
pub mod model;
pub mod serial;
pub mod record;
pub mod utils;

pub type TestRecording = Recording<TestFrame>;
pub type TactileARecording = Recording<TactileAFrame>;

pub struct SerialConnection {
    pub port: String,
}

pub fn connect(port: &str) -> Result<SerialConnection, String> {
    let port = port.trim();

    if port.is_empty() {
        return Err("Serial port is required".to_string());
    }

    Ok(SerialConnection {
        port: port.to_string(),
    })
}
