new mib crate

This commit is contained in:
2022-11-27 22:05:42 +01:00
parent 7e0d3f394a
commit b0b41a07dc
19 changed files with 341 additions and 65 deletions

View File

@ -9,6 +9,7 @@ default-run = "satrs-example"
crossbeam-channel = "0.5"
delegate = "0.8"
zerocopy = "0.6"
csv = "1"
[dependencies.spacepackets]
path = "../spacepackets"
@ -18,3 +19,6 @@ path = "../satrs-macros"
[dependencies.satrs-core]
path = "../satrs-core"
[dependencies.satrs-mib]
path = "../satrs-mib"

View File

@ -22,8 +22,8 @@ fn main() {
.write_to_bytes(&mut buf)
.expect("Creating PUS TC failed");
client
.send_to(&buf[0..size], &addr)
.expect(&*format!("Sending to {:?} failed", addr));
.send_to(&buf[0..size], addr)
.unwrap_or_else(|_| panic!("Sending to {:?} failed", addr));
client
.set_read_timeout(Some(Duration::from_secs(2)))
.expect("Setting read timeout failed");

View File

@ -1,4 +1,27 @@
use std::net::Ipv4Addr;
use satrs_core::res_code::ResultU16;
use satrs_macros::resultcode;
use satrs_mib::res_code::ResultU16Info;
#[derive(Debug)]
pub enum GroupId {
Tmtc = 0,
}
pub const OBSW_SERVER_ADDR: Ipv4Addr = Ipv4Addr::new(127, 0, 0, 1);
pub const SERVER_PORT: u16 = 7301;
#[resultcode]
pub const INVALID_PUS_SERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 0);
#[resultcode]
pub const INVALID_PUS_SUBSERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 1);
#[resultcode(info = "Not enough data inside the TC application data field")]
pub const NOT_ENOUGH_APP_DATA: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 2);
pub const TMTC_RESULTS: &[ResultU16Info] = &[
INVALID_PUS_SERVICE_EXT,
INVALID_PUS_SUBSERVICE_EXT,
NOT_ENOUGH_APP_DATA_EXT,
];

View File

@ -1,7 +1,6 @@
mod ccsds;
mod pus;
mod tmtc;
mod results;
use crate::tmtc::{core_tmtc_task, CoreTmtcArgs, TmStore, PUS_APID};
use satrs_core::event_man::{

View File

@ -1,5 +1,4 @@
use crate::tmtc::TmStore;
use crate::results::{INVALID_PUS_SERVICE, INVALID_PUS_SUBSERVICE, NOT_ENOUGH_APP_DATA};
use satrs_core::events::EventU32;
use satrs_core::pool::StoreAddr;
use satrs_core::pus::event::Subservices;
@ -7,14 +6,15 @@ use satrs_core::pus::event_man::{EventRequest, EventRequestWithToken};
use satrs_core::pus::verification::{
FailParams, StdVerifReporterWithSender, TcStateAccepted, VerificationToken,
};
use satrs_core::res_code::ResultU16;
use satrs_core::tmtc::tm_helper::PusTmWithCdsShortHelper;
use satrs_core::tmtc::PusServiceProvider;
use satrs_example::{INVALID_PUS_SERVICE, INVALID_PUS_SUBSERVICE, NOT_ENOUGH_APP_DATA};
use spacepackets::ecss::PusPacket;
use spacepackets::tc::PusTc;
use spacepackets::time::{CdsShortTimeProvider, TimeWriter};
use spacepackets::SpHeader;
use std::sync::mpsc;
use satrs_core::resultcode::ResultU16;
pub struct PusReceiver {
pub tm_helper: PusTmWithCdsShortHelper,
@ -67,7 +67,11 @@ impl PusServiceProvider for PusReceiver {
self.handle_event_service(pus_tc, accepted_token);
} else {
self.update_time_stamp();
self.verif_reporter.start_failure(accepted_token, FailParams::new(&self.time_stamp, &INVALID_PUS_SERVICE, None))
self.verif_reporter
.start_failure(
accepted_token,
FailParams::new(&self.time_stamp, &INVALID_PUS_SERVICE, None),
)
.expect("Start failure verification failed")
}
Ok(())

View File

@ -1,15 +0,0 @@
use satrs_core::resultcode::ResultU16;
use satrs_macros::resultcode;
#[derive(Debug)]
pub enum GroupId {
Tmtc = 0,
}
#[resultcode]
pub const INVALID_PUS_SERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 0);
#[resultcode]
pub const INVALID_PUS_SUBSERVICE: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 1);
#[resultcode(info="Not enough data inside the TC application data field")]
pub const NOT_ENOUGH_APP_DATA: ResultU16 = ResultU16::const_new(GroupId::Tmtc as u8, 2);