Can issue certificate for devices
This commit is contained in:
@ -5,6 +5,20 @@ pub struct DeviceInfo {
|
||||
max_relays: usize,
|
||||
}
|
||||
|
||||
impl DeviceInfo {
|
||||
pub fn error(&self) -> Option<&str> {
|
||||
if self.reference.trim().is_empty() {
|
||||
return Some("Given device reference is empty or blank!");
|
||||
}
|
||||
|
||||
if self.max_relays == 0 {
|
||||
return Some("Given device cannot handle any relay!");
|
||||
}
|
||||
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Clone, Debug, serde::Serialize, serde::Deserialize, Eq, PartialEq, Hash)]
|
||||
pub struct DeviceId(pub String);
|
||||
|
||||
|
Reference in New Issue
Block a user