unify peripheral state struct.
This commit is contained in:
@@ -19,7 +19,8 @@ pub struct CentralState {
|
||||
pub struct PeripheralItem {
|
||||
pub id: PeripheralId,
|
||||
pub address: String,
|
||||
pub represent: String,
|
||||
pub represent: Option<String>,
|
||||
pub is_unknown: bool,
|
||||
pub is_connected: bool,
|
||||
pub rssi: Option<i16>,
|
||||
pub battery: Option<i16>,
|
||||
@@ -42,9 +43,8 @@ impl PeripheralItem {
|
||||
Self {
|
||||
id: periperial.id(),
|
||||
address: periperial.address().to_string(),
|
||||
represent: properties
|
||||
.and_then(|p| p.local_name.clone())
|
||||
.unwrap_or(String::from("Unknown")),
|
||||
represent: properties.and_then(|p| p.local_name.clone()),
|
||||
is_unknown: properties.and_then(|p| p.local_name.clone()).is_none(),
|
||||
is_connected: periperial.is_connected().await.unwrap_or(false),
|
||||
rssi: properties.and_then(|p| p.rssi),
|
||||
battery: properties.and_then(|p| p.tx_power_level),
|
||||
|
Reference in New Issue
Block a user