use bluer::gatt::remote::Characteristic; const BASE_STRIP_DATA : [u8; 5] = [0x0, 0x0, 0x0, 0x0, 0x1]; #[derive(Clone, Copy)] pub(crate) struct PixelColor { pub(crate) red: u8, pub(crate) green: u8, pub(crate) blue: u8, } pub(crate) struct Strip { pub strip: [PixelColor; N], } impl Strip { pub fn to_array(&self) -> Vec { let mut data : Vec = vec![]; for i in 0..N { data.append(&mut vec![self.strip[i].red, self.strip[i].green, self.strip[i].blue]); } data } } async fn write_strip(data: Strip, char: Characteristic) -> bluer::Result<()> { let mut frame= BASE_STRIP_DATA.to_vec(); frame.append(&mut data.to_array()); char.write(&*frame).await?; Ok(()) }