Skip to content

Commit

Permalink
added ros clean purge to crossbar interface (ros1)
Browse files Browse the repository at this point in the history
  • Loading branch information
atiderko committed Jan 8, 2024
1 parent 2be6828 commit fe5c374
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,3 +81,11 @@ def getDiagnostics(self) -> DiagnosticArray:
rosmsg = self._monitor.get_diagnostics(0, 0)
# copy message to the crossbar structure
return json.dumps(self._toCrossbarDiagnostics(rosmsg), cls=SelfEncoder)

@wamp.register("ros.provider.ros_clean_purge")
def rosCleanPurge(self) -> {bool, str}:
Log.info("crossbar: ros_clean_purge")
result = False
message = 'Not implemented'
Log.warn("Not implemented: ros.provider.ros_clean_purge")
return json.dumps({result: result, message: message}, cls=SelfEncoder)
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@
from fkie_multimaster_pylib.crossbar.base_session import CrossbarBaseSession
from fkie_multimaster_pylib.crossbar.base_session import SelfEncoder
from fkie_multimaster_pylib.logging.logging import Log
from fkie_multimaster_pylib.system.screen import ros_clean


class MonitorServicer(mgrpc.MonitorServiceServicer, CrossbarBaseSession):
Expand Down Expand Up @@ -130,3 +131,15 @@ def getSystemInfo(self) -> SystemInformation:
def getSystemEnv(self) -> SystemEnvironment:
Log.info("crossbar: get system env")
return json.dumps(SystemEnvironment(), cls=SelfEncoder)

@wamp.register("ros.provider.ros_clean_purge")
def rosCleanPurge(self) -> {bool, str}:
Log.info("crossbar: ros_clean_purge")
result = False
message = ''
try:
ros_clean()
result = True
except Exception as error:
message = str(error)
return json.dumps({result: result, message: message}, cls=SelfEncoder)

0 comments on commit fe5c374

Please sign in to comment.