add tmtccmd client program
This commit is contained in:
parent
c19d49d331
commit
db6fb0ab5c
3
fsrc-example/pyclient/.gitignore
vendored
3
fsrc-example/pyclient/.gitignore
vendored
@ -1 +1,4 @@
|
|||||||
/venv
|
/venv
|
||||||
|
/log
|
||||||
|
/.idea/*
|
||||||
|
!/.idea/runConfigurations
|
||||||
|
@ -47,7 +47,7 @@ from tmtccmd.util.tmtc_printer import FsfwTmTcPrinter
|
|||||||
|
|
||||||
LOGGER = get_console_logger()
|
LOGGER = get_console_logger()
|
||||||
|
|
||||||
EXAMPLE_PUS_APID = 0xEF
|
EXAMPLE_PUS_APID = 0x02
|
||||||
|
|
||||||
|
|
||||||
class SatRsConfigHook(TmTcCfgHookBase):
|
class SatRsConfigHook(TmTcCfgHookBase):
|
||||||
@ -113,10 +113,10 @@ class PusHandler(SpecificApidHandlerBase):
|
|||||||
def handle_tm(self, packet: bytes, _user_args: any):
|
def handle_tm(self, packet: bytes, _user_args: any):
|
||||||
try:
|
try:
|
||||||
tm_packet = PusTelemetry.unpack(packet)
|
tm_packet = PusTelemetry.unpack(packet)
|
||||||
except ValueError:
|
except ValueError as e:
|
||||||
LOGGER.warning("Could not generate PUS TM object from raw data")
|
LOGGER.warning("Could not generate PUS TM object from raw data")
|
||||||
LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
LOGGER.warning(f"Raw Packet: [{packet.hex(sep=',')}], REPR: {packet!r}")
|
||||||
return
|
raise e
|
||||||
service = tm_packet.service
|
service = tm_packet.service
|
||||||
dedicated_handler = False
|
dedicated_handler = False
|
||||||
if service == 1:
|
if service == 1:
|
||||||
@ -263,7 +263,10 @@ def main():
|
|||||||
elif state.request == BackendRequest.DELAY_LISTENER:
|
elif state.request == BackendRequest.DELAY_LISTENER:
|
||||||
time.sleep(0.8)
|
time.sleep(0.8)
|
||||||
elif state.request == BackendRequest.DELAY_CUSTOM:
|
elif state.request == BackendRequest.DELAY_CUSTOM:
|
||||||
time.sleep(state.next_delay)
|
if state.next_delay.total_seconds() <= 0.4:
|
||||||
|
time.sleep(state.next_delay.total_seconds())
|
||||||
|
else:
|
||||||
|
time.sleep(0.4)
|
||||||
elif state.request == BackendRequest.CALL_NEXT:
|
elif state.request == BackendRequest.CALL_NEXT:
|
||||||
pass
|
pass
|
||||||
except KeyboardInterrupt:
|
except KeyboardInterrupt:
|
||||||
|
1
fsrc-example/pyclient/seqcnt.txt
Normal file
1
fsrc-example/pyclient/seqcnt.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
30
|
6
fsrc-example/pyclient/tmtc_conf.json
Normal file
6
fsrc-example/pyclient/tmtc_conf.json
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
{
|
||||||
|
"com_if": "udp",
|
||||||
|
"tcpip_udp_ip_addr": "127.0.0.1",
|
||||||
|
"tcpip_udp_port": 7301,
|
||||||
|
"tcpip_udp_recv_max_size": 1500
|
||||||
|
}
|
@ -28,10 +28,10 @@ impl CcsdsPacketHandler for CcsdsReceiver {
|
|||||||
|
|
||||||
fn handle_unknown_apid(
|
fn handle_unknown_apid(
|
||||||
&mut self,
|
&mut self,
|
||||||
_sp_header: &SpHeader,
|
sp_header: &SpHeader,
|
||||||
_tc_raw: &[u8],
|
_tc_raw: &[u8],
|
||||||
) -> Result<(), Self::Error> {
|
) -> Result<(), Self::Error> {
|
||||||
println!("Unknown APID detected");
|
println!("Unknown APID 0x{:x?} detected", sp_header.apid());
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,10 +100,13 @@ fn main() {
|
|||||||
event_sender,
|
event_sender,
|
||||||
event_request_tx,
|
event_request_tx,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
println!("Starting TMTC task");
|
||||||
let jh0 = thread::spawn(move || {
|
let jh0 = thread::spawn(move || {
|
||||||
core_tmtc_task(core_args, tm_server_rx, addr, reporter_with_sender_0);
|
core_tmtc_task(core_args, tm_server_rx, addr, reporter_with_sender_0);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
println!("Starting TM funnel task");
|
||||||
let jh1 = thread::spawn(move || {
|
let jh1 = thread::spawn(move || {
|
||||||
let tm_funnel = TmFunnel {
|
let tm_funnel = TmFunnel {
|
||||||
tm_server_tx,
|
tm_server_tx,
|
||||||
@ -119,6 +122,7 @@ fn main() {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
println!("Starting event handling task");
|
||||||
let jh2 = thread::spawn(move || {
|
let jh2 = thread::spawn(move || {
|
||||||
let mut timestamp: [u8; 7] = [0; 7];
|
let mut timestamp: [u8; 7] = [0; 7];
|
||||||
let mut sender = EventTmSender::new(tm_store_helper, tm_funnel_tx);
|
let mut sender = EventTmSender::new(tm_store_helper, tm_funnel_tx);
|
||||||
|
@ -1 +1 @@
|
|||||||
Subproject commit c750f94fba31114c5ade530ea6235acb6bb8835a
|
Subproject commit 1ec21c1bff69a04b9112c66bec39cb0acb3412be
|
Loading…
Reference in New Issue
Block a user