Skip to content

Commit

Permalink
minor refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
blandger committed Feb 5, 2024
1 parent fa9687d commit ee0726f
Show file tree
Hide file tree
Showing 7 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions brainbit/src/bbit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ pub mod errors;
pub(crate) mod internals;
pub mod resist;
pub mod responses;
pub mod results;
pub(crate) mod sealed;
pub mod traits;
pub mod uuids;
2 changes: 1 addition & 1 deletion brainbit/src/bbit/control.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use crate::bbit::device::BBitResult;
use crate::bbit::results::BBitResult;
use crate::bbit::uuids::WRITE_COMMAN_UUID;
use crate::{find_characteristic, Error};
use btleplug::api::{Characteristic, Peripheral as _, WriteType};
Expand Down
3 changes: 1 addition & 2 deletions brainbit/src/bbit/device.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use uuid::Uuid;
use crate::bbit::control::{ControlCommandType, ControlPoint, ControlPointCommand};
use crate::bbit::internals::{ADS1294ChannelInput, ChannelType, MeasurementType};
use crate::bbit::responses::{DeviceInfo, DeviceStatusData};
use crate::bbit::results::BBitResult;
use crate::bbit::sealed::{Bluetooth, Configure, Connected, EventLoop, Level};
use crate::bbit::traits::EventHandler;
use crate::bbit::uuids::{
Expand All @@ -23,8 +24,6 @@ use crate::bbit::uuids::{
};
use crate::{find_characteristic, Error};

pub type BBitResult<T> = Result<T, Error>;

/// Structure to contain EEG data and interval.
#[derive(Debug, Clone)]
pub struct CommandData {
Expand Down
2 changes: 1 addition & 1 deletion brainbit/src/bbit/internals.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::bbit::device::BBitResult;
use crate::bbit::errors::Error;
use crate::bbit::results::BBitResult;

/// List of measurement types you can request.
#[derive(Debug, PartialEq, Eq, Clone, Copy)]
Expand Down
3 changes: 3 additions & 0 deletions brainbit/src/bbit/results.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
use crate::bbit::errors::Error;

pub type BBitResult<T> = Result<T, Error>;
2 changes: 1 addition & 1 deletion brainbit/src/bbit/traits.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use async_trait::async_trait;
/// Base trait for handling events coming from a BrainBit device.
#[async_trait]
pub trait EventHandler {
/// Dispatched when a internal device status update is received.
/// Dispatched when an internal device status update is received.
///
/// Contains the status, cmd error, battery level.
async fn device_status_update(&self, _status: DeviceStatusData) {}
Expand Down
2 changes: 1 addition & 1 deletion brainbit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
pub mod bbit;

use crate::bbit::device::BBitResult;
use bbit::errors::Error;
use bbit::results::BBitResult;
use btleplug::api::{Characteristic, Peripheral as _};
use btleplug::platform::Peripheral;
use thiserror::Error;
Expand Down

0 comments on commit ee0726f

Please sign in to comment.