added retrieval by time range impl
This commit is contained in:
parent
6a6d9c0a7a
commit
8f5f7064e9
@ -45,15 +45,12 @@ def pack_tm_store_commands(p: ServiceProviderParams):
|
|||||||
if o == OpCode.DELETE_UP_TO:
|
if o == OpCode.DELETE_UP_TO:
|
||||||
obj_id, store_string = store_select_prompt()
|
obj_id, store_string = store_select_prompt()
|
||||||
app_data = bytearray(obj_id.as_bytes)
|
app_data = bytearray(obj_id.as_bytes)
|
||||||
delete_up_to_time = time_prompt()
|
delete_up_to_time = time_prompt("Determining deletion end time")
|
||||||
end_stamp = int(math.floor(delete_up_to_time.timestamp()))
|
end_stamp = int(math.floor(delete_up_to_time.timestamp()))
|
||||||
app_data.extend(struct.pack("!I", end_stamp))
|
app_data.extend(struct.pack("!I", end_stamp))
|
||||||
q.add_log_cmd(Info.DELETE_UP_TO)
|
q.add_log_cmd(Info.DELETE_UP_TO)
|
||||||
q.add_log_cmd(f"Selected Store: {obj_id}")
|
q.add_log_cmd(f"Selected Store: {obj_id}")
|
||||||
q.add_log_cmd(
|
q.add_log_cmd(f"Deletion up to time {delete_up_to_time}")
|
||||||
f"Deletion up to time "
|
|
||||||
f"{datetime.datetime.fromtimestamp(end_stamp, tz=datetime.timezone.utc)}"
|
|
||||||
)
|
|
||||||
q.add_pus_tc(
|
q.add_pus_tc(
|
||||||
PusTelecommand(
|
PusTelecommand(
|
||||||
service=15, subservice=Subservice.DELETE_UP_TO, app_data=app_data
|
service=15, subservice=Subservice.DELETE_UP_TO, app_data=app_data
|
||||||
@ -61,7 +58,26 @@ def pack_tm_store_commands(p: ServiceProviderParams):
|
|||||||
)
|
)
|
||||||
elif o == OpCode.RETRIEVAL_BY_TIME_RANGE:
|
elif o == OpCode.RETRIEVAL_BY_TIME_RANGE:
|
||||||
q.add_log_cmd(Info.RETRIEVAL_BY_TIME_RANGE)
|
q.add_log_cmd(Info.RETRIEVAL_BY_TIME_RANGE)
|
||||||
pass
|
obj_id, store_string = store_select_prompt()
|
||||||
|
app_data = bytearray(obj_id.as_bytes)
|
||||||
|
start_of_dump_time = time_prompt("Determining retrival start time")
|
||||||
|
start_stamp = int(math.floor(start_of_dump_time.timestamp()))
|
||||||
|
end_of_dump_time = time_prompt("Determining retrieval end time")
|
||||||
|
end_stamp = int(math.floor(end_of_dump_time.timestamp()))
|
||||||
|
app_data.extend(struct.pack("!I", start_stamp))
|
||||||
|
app_data.extend(struct.pack("!I", end_stamp))
|
||||||
|
q.add_log_cmd(Info.RETRIEVAL_BY_TIME_RANGE)
|
||||||
|
q.add_log_cmd(f"Selected Store: {obj_id}")
|
||||||
|
q.add_log_cmd(
|
||||||
|
f"Retrieval from time {start_of_dump_time} up to time {end_of_dump_time}"
|
||||||
|
)
|
||||||
|
q.add_pus_tc(
|
||||||
|
PusTelecommand(
|
||||||
|
service=15,
|
||||||
|
subservice=Subservice.RETRIEVAL_BY_TIME_RANGE,
|
||||||
|
app_data=app_data,
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
@tmtc_definitions_provider
|
@tmtc_definitions_provider
|
||||||
@ -100,8 +116,8 @@ TIME_INPUT_DICT = {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
def time_prompt() -> datetime.datetime:
|
def time_prompt(info_str: str) -> datetime.datetime:
|
||||||
print("Available time input types: ")
|
print(f"{info_str}. Available time input types: ")
|
||||||
for k, v in TIME_INPUT_DICT.items():
|
for k, v in TIME_INPUT_DICT.items():
|
||||||
print(f" {k}: {v}")
|
print(f" {k}: {v}")
|
||||||
while True:
|
while True:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user