1#![cfg_attr(not(feature = "std"), no_std)]
10
11pub mod command;
12pub mod error;
13pub mod gatt;
14pub mod stream;
15
16pub use command::{Command, Response, ResponseBody};
17pub use error::ParseError;
18pub use gatt::Characteristic;
19pub use stream::{
20 BatteryPacket, ContactPacket, EegPacket, MotionPacket, Packet, PpgPacket, StatusMessage, VitalPacket,
21};
22
23pub(crate) fn be_u32(bytes: &[u8], offset: usize) -> Option<u32> {
25 let b = bytes.get(offset..offset.checked_add(4)?)?;
26 Some(u32::from_be_bytes([*b.first()?, *b.get(1)?, *b.get(2)?, *b.get(3)?]))
27}
28
29pub(crate) fn be_u16(bytes: &[u8], offset: usize) -> Option<u16> {
31 Some(u16::from_be_bytes([
32 *bytes.get(offset)?,
33 *bytes.get(offset.checked_add(1)?)?,
34 ]))
35}