Function ros2_medkit_gateway::ros2::conversions::fault_to_json

Function Documentation

nlohmann::json ros2_medkit_gateway::ros2::conversions::fault_to_json(const ros2_medkit_msgs::msg::Fault &fault)

Convert a ros2_medkit_msgs::msg::Fault to JSON.

Produces the flat per-fault representation consumed by list_faults items, the SSE fault-event payload, and the trigger subsystem’s notifier change values. Timestamps become seconds-as-double; severity gains a label.

Lives at the ROS-coupled boundary because three independent call sites each translate ros2_medkit_msgs::msg::Fault directly into JSON: the fault-service transport adapter, the SSE fault handler (subscribes to the FaultEvent topic directly), and the trigger fault subscriber. Keeping the helper free standing avoids code duplication while preserving the neutral FaultManager contract.