Skip to content
Snippets Groups Projects
contact.rs 1.07 KiB
Newer Older
Stephen D's avatar
Stephen D committed
use heapless::{String, Vec};

Stephen D's avatar
Stephen D committed
pub const MAX_CONTACTS: usize = 20;

Stephen D's avatar
Stephen D committed
#[derive(Debug, Clone)]
pub struct Contact {
    callsign: String<10>,
    ssid: u8,
    pub name: String<30>,
}

#[derive(Debug)]
pub struct ContactGroup {
Stephen D's avatar
Stephen D committed
    pub contacts: Vec<Contact, MAX_CONTACTS>,
Stephen D's avatar
Stephen D committed
}

impl Default for ContactGroup {
    fn default() -> Self {
        let mut contacts = Vec::new();
        contacts
            .push(Contact {
                callsign: String::try_from("VA3QAK").unwrap(),
                ssid: 19,
                name: String::try_from("Adrian").unwrap(),
            })
            .unwrap();
        contacts
            .push(Contact {
                callsign: String::try_from("VE3SVF").unwrap(),
                ssid: 239,
                name: String::try_from("Sasha").unwrap(),
            })
            .unwrap();
        contacts
            .push(Contact {
                callsign: String::try_from("VE3KCN").unwrap(),
                ssid: 19,
                name: String::try_from("Cam").unwrap(),
            })
            .unwrap();

        Self { contacts }
    }
}