in device_info_pkg/device_info_pkg/device_info_node.py [0:0]
def get_device_info(self, req, res):
"""Callback for the get_device_info service. Returns the hardware and software
version details.
Args:
req (GetDeviceInfoSrv.Request): No request data passed.
res (GetDeviceInfoSrv.Response): Response object with hardware_version(str)
software_version(str) and error(int) flag.
Returns:
GetDeviceInfoSrv.Response: Response object with hardware_version(str)
software_version(str) and error(int) flag.
"""
self.get_logger().info("get_device_info")
try:
# Logging the secure boot info
self.get_secure_boot_info()
hw_version = self.get_hardware_version()
sw_version = self.get_software_version()
res.hardware_version = hw_version if hw_version else "--"
res.software_version = sw_version if sw_version else "--"
res.error = 0
except Exception:
res.error = 1
self.get_logger().error("Error while getting revision info")
return res