#pragma once

#include <rclcpp/rclcpp.hpp>
#include <can_msgs/msg/frame.hpp>
#include "can_driver/msg/can_mine.hpp"
#include <string>
#include <chrono>

class CanAnalyNode : public rclcpp::Node
{
public:
  CanAnalyNode();
  ~CanAnalyNode() = default;

private:
  void canCallback(const can_msgs::msg::Frame::SharedPtr msg);
  std::string parseFaultWord(uint16_t fault1, uint16_t fault2);
  rclcpp::Subscription<can_msgs::msg::Frame>::SharedPtr sub_;
  rclcpp::Publisher<can_driver::msg::CanMine>::SharedPtr pub_;

  // ½ÚÁ÷´òÓ¡¿ØÖÆ
  rclcpp::Time last_print_time_;
};
