ITimeSource.h 1.1 KB

12345678910111213141516171819202122232425262728293031323334
  1. /*
  2. * Copyright (c) Contributors to the Open 3D Engine Project.
  3. * For complete copyright and license terms please see the LICENSE at the root of this distribution.
  4. *
  5. * SPDX-License-Identifier: Apache-2.0 OR MIT
  6. *
  7. */
  8. #pragma once
  9. #include <AzCore/Outcome/Outcome.h>
  10. #include <AzCore/std/string/string.h>
  11. #include <builtin_interfaces/msg/time.hpp>
  12. namespace ROS2
  13. {
  14. //! Interface for time source used by ROS2ClockSystemComponent.
  15. class ITimeSource
  16. {
  17. public:
  18. virtual void Activate() = 0;
  19. virtual void Deactivate() = 0;
  20. virtual ~ITimeSource() = default;
  21. //! Sets the time source to the given time.
  22. //! @param time The time to set the time source to.
  23. //! @return An outcome indicating success or failure.
  24. virtual AZ::Outcome<void, AZStd::string> AdjustTime(const builtin_interfaces::msg::Time& time) = 0;
  25. //! Get time as ROS 2 message.
  26. //! @see ROS2Requests::GetROSTimestamp() for more details.
  27. virtual builtin_interfaces::msg::Time GetROSTimestamp() const = 0;
  28. };
  29. } // namespace ROS2