Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SRC OBDH TMTC
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Robin Mueller
SRC OBDH TMTC
Commits
70a4e4e3
Commit
70a4e4e3
authored
4 years ago
by
Robin.Mueller
Browse files
Options
Downloads
Patches
Plain Diff
some more refactoring
parent
28af57e3
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml
+1
-1
1 addition, 1 deletion
.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml
core/tmtc_backend.py
+17
-17
17 additions, 17 deletions
core/tmtc_backend.py
with
18 additions
and
18 deletions
.idea/runConfigurations/tmtcclient_Service_8_QEMU__.xml
+
1
−
1
View file @
70a4e4e3
...
...
@@ -12,7 +12,7 @@
<option
name=
"ADD_CONTENT_ROOTS"
value=
"true"
/>
<option
name=
"ADD_SOURCE_ROOTS"
value=
"true"
/>
<EXTENSION
ID=
"PythonCoverageRunConfigurationExtension"
runner=
"coverage.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/
core/
tmtc_client_c
ore
.py"
/>
<option
name=
"SCRIPT_NAME"
value=
"$PROJECT_DIR$/tmtc_client_c
li
.py"
/>
<option
name=
"PARAMETERS"
value=
"-m 3 -s 8 -c 2 -t 2.5"
/>
<option
name=
"SHOW_COMMAND_LINE"
value=
"false"
/>
<option
name=
"EMULATE_TERMINAL"
value=
"true"
/>
...
...
This diff is collapsed.
Click to expand it.
core/tmtc_backend.py
+
17
−
17
View file @
70a4e4e3
...
...
@@ -36,7 +36,7 @@ class TmTcHandler:
self
.
mode
=
init_mode
self
.
com_if
=
g
.
G_COM_IF
# This flag could be used later to command the TMTC Client with a front-end
self
.
command_received
=
True
self
.
one_shot_operation
=
True
self
.
tmtc_printer
:
Union
[
None
,
TmTcPrinter
]
=
None
self
.
communication_interface
:
Union
[
None
,
CommunicationInterface
]
=
None
...
...
@@ -73,23 +73,27 @@ class TmTcHandler:
"""
Periodic operation
"""
while
True
:
try
:
if
self
.
command_received
:
self
.
command_received
=
False
self
.
handle_action
()
try
:
self
.
core_operation
(
self
.
one_shot_operation
)
except
KeyboardInterrupt
:
LOGGER
.
info
(
"
Closing TMTC client.
"
)
sys
.
exit
()
except
IOError
as
e
:
LOGGER
.
exception
(
e
)
LOGGER
.
info
(
"
Closing TMTC client.
"
)
sys
.
exit
()
def
core_operation
(
self
,
one_shot
):
if
not
one_shot
:
while
True
:
self
.
handle_action
()
if
self
.
mode
==
g
.
ModeList
.
Idle
:
LOGGER
.
info
(
"
TMTC Client in idle mode
"
)
time
.
sleep
(
5
)
elif
self
.
mode
==
g
.
ModeList
.
ListenerMode
:
time
.
sleep
(
1
)
except
KeyboardInterrupt
:
LOGGER
.
info
(
"
Closing TMTC client.
"
)
sys
.
exit
()
except
IOError
as
e
:
LOGGER
.
exception
(
e
)
LOGGER
.
info
(
"
Closing TMTC client.
"
)
sys
.
exit
()
else
:
self
.
handle_action
()
def
handle_action
(
self
):
"""
...
...
@@ -104,7 +108,6 @@ class TmTcHandler:
self
.
tmtc_printer
.
print_telemetry_queue
(
self
.
tm_listener
.
retrieve_tm_packet_queue
())
self
.
tm_listener
.
clear_tm_packet_queue
()
self
.
tm_listener
.
clear_reply_event
()
self
.
command_received
=
True
elif
self
.
mode
==
g
.
ModeList
.
SingleCommandMode
:
if
self
.
single_command_package
is
None
:
...
...
@@ -117,7 +120,6 @@ class TmTcHandler:
tm_listener
=
self
.
tm_listener
)
LOGGER
.
info
(
"
Performing single command operation
"
)
sender_and_receiver
.
send_single_tc_and_receive_tm
(
pus_packet_tuple
=
pus_packet_tuple
)
self
.
command_received
=
True
self
.
mode
=
g
.
ModeList
.
PromptMode
elif
self
.
mode
==
g
.
ModeList
.
ServiceTestMode
:
...
...
@@ -133,7 +135,6 @@ class TmTcHandler:
com_interface
=
self
.
communication_interface
,
tmtc_printer
=
self
.
tmtc_printer
,
tm_listener
=
self
.
tm_listener
,
tc_queue
=
service_queue
)
sender_and_receiver
.
send_queue_tc_and_receive_tm_sequentially
()
self
.
command_received
=
True
self
.
mode
=
g
.
ModeList
.
ListenerMode
elif
self
.
mode
==
g
.
ModeList
.
SoftwareTestMode
:
...
...
@@ -152,7 +153,6 @@ class TmTcHandler:
file_uploader
=
BinaryFileUploader
(
self
.
communication_interface
,
self
.
tmtc_printer
,
self
.
tm_listener
)
file_uploader
.
perform_file_upload
()
self
.
command_received
=
True
self
.
mode
=
g
.
ModeList
.
ListenerMode
elif
self
.
mode
==
g
.
ModeList
.
UnitTest
:
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment