#![cfg_attr(not(feature = "std"), no_std)]
pub mod command;
pub mod error;
pub mod gatt;
pub mod stream;
pub use command::{Command, Response, ResponseBody};
pub use error::ParseError;
pub use gatt::Characteristic;
pub use stream::{
BatteryPacket, ContactPacket, EegPacket, MotionPacket, Packet, PpgPacket, StatusMessage, VitalPacket,
};
pub(crate) fn be_u32(bytes: &[u8], offset: usize) -> Option<u32> {
let b = bytes.get(offset..offset.checked_add(4)?)?;
Some(u32::from_be_bytes([*b.first()?, *b.get(1)?, *b.get(2)?, *b.get(3)?]))
}
pub(crate) fn be_u16(bytes: &[u8], offset: usize) -> Option<u16> {
Some(u16::from_be_bytes([
*bytes.get(offset)?,
*bytes.get(offset.checked_add(1)?)?,
]))
}