examples_python
call-shutdown.py
Go to the documentation of this file.
1
#!/usr/bin/env python3
2
3
# ---------------------------------------------------------------------
4
# This example shows how to:
5
# - Call MVSIM server and invoke the shutdown service to close
6
# the simulation.
7
#
8
# Install python3-mvsim, or test with a local build with:
9
# export PYTHONPATH=$HOME/code/mvsim/build/:$PYTHONPATH
10
# ---------------------------------------------------------------------
11
12
from
mvsim_comms
import
pymvsim_comms
13
from
mvsim_msgs
import
SrvShutdown_pb2
14
15
import
time
16
17
18
def
call_mvsim_shutdown
(client):
19
# Send the request:
20
req = SrvShutdown_pb2.SrvShutdown()
21
# (no fields to fill in for this case)
22
client.callService(
'shutdown'
, req.SerializeToString())
23
24
25
if
__name__ ==
"__main__"
:
26
client = pymvsim_comms.mvsim.Client()
27
client.setName(
"tutorial1"
)
28
print
(
"Connecting to server..."
)
29
client.connect()
30
print
(
"Connected successfully."
)
31
32
call_mvsim_shutdown
(client)
33
print
(
"Shutdown called."
)
call-shutdown.call_mvsim_shutdown
def call_mvsim_shutdown(client)
Definition:
call-shutdown.py:18
rapidxml::print
OutIt print(OutIt out, const xml_node< Ch > &node, int flags=0)
Definition:
rapidxml_print.hpp:405
mvsim
Author(s):
autogenerated on Wed May 28 2025 02:13:07