in usb_monitor_pkg/usb_monitor_pkg/usb_monitor_node.py [0:0]
def usb_file_system_subscribe_cb(self, req, res):
"""Callback for the usb_file_system_subscribe service. Adds the file/folder details
to the subscriber list.
Args:
req (USBFileSystemSubscribeSrv.Request): Request object with file_name(str),
callback_name(str) and
verify_name_exists(bool) flag to be
added to the subscriber list.
res (USBFileSystemSubscribeSrv.Response): Response object with error(int) flag
to indicate if the service call was
successful.
Returns:
USBFileSystemSubscribeSrv.Response: Response object with error(int) flag to
indicate if the service call was successful.
"""
self.subscribers.append((req.file_name, req.callback_name, req.verify_name_exists))
res.error = 0
self.get_logger().info("USB File system subscription : "
f"{req.file_name} "
f"{req.callback_name} "
f"{req.verify_name_exists}")
return res