Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: rename ThermalZoneNode from ThermalZonePublisherNode #9

Merged
merged 1 commit into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions include/thermal_zone/thermal_zone_node.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@

#include "thermal_zone_interfaces/msg/thermal_zone.hpp"

class ThermalZonePublisherNode : public rclcpp::Node
class ThermalZoneNode : public rclcpp::Node
{
public:
explicit ThermalZonePublisherNode(const std::string & node_name);
~ThermalZonePublisherNode();
explicit ThermalZoneNode(const std::string & node_name);
~ThermalZoneNode();

protected:
private:
Expand Down
2 changes: 1 addition & 1 deletion src/thermal_zone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ int main(int argc, char ** argv)
rclcpp::init(argc, argv);

rclcpp::executors::SingleThreadedExecutor exec;
exec.add_node(std::make_shared<ThermalZonePublisherNode>("thermal_zone_publisher"));
exec.add_node(std::make_shared<ThermalZoneNode>("thermal_zone_node"));
exec.spin();

rclcpp::shutdown();
Expand Down
14 changes: 6 additions & 8 deletions src/thermal_zone_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,14 @@

// PUBLIC FUNCTIONS

ThermalZonePublisherNode::ThermalZonePublisherNode(const std::string & node_name)
: rclcpp::Node(node_name)
ThermalZoneNode::ThermalZoneNode(const std::string & node_name) : rclcpp::Node(node_name)
{
RCLCPP_INFO_STREAM(this->get_logger(), "default constructor executed");

std::vector<thermal_zone_interfaces::msg::ThermalZone> msgs = GetZoneMsgVector();
}

ThermalZonePublisherNode::~ThermalZonePublisherNode()
ThermalZoneNode::~ThermalZoneNode()
{
RCLCPP_INFO_STREAM(this->get_logger(), "destructor executed");
}
Expand All @@ -24,7 +23,7 @@ ThermalZonePublisherNode::~ThermalZonePublisherNode()

// PRIVATE FUNCTIONS

uint8_t ThermalZonePublisherNode::CountMatchingDirectories(const std::string & pattern)
uint8_t ThermalZoneNode::CountMatchingDirectories(const std::string & pattern)
{
uint8_t count = 0;

Expand All @@ -38,8 +37,7 @@ uint8_t ThermalZonePublisherNode::CountMatchingDirectories(const std::string & p
return count;
}

std::vector<thermal_zone_interfaces::msg::ThermalZone> ThermalZonePublisherNode::GetZoneMsgVector(
void)
std::vector<thermal_zone_interfaces::msg::ThermalZone> ThermalZoneNode::GetZoneMsgVector(void)
{
std::vector<thermal_zone_interfaces::msg::ThermalZone> msgs;
const std::string key = "thermal_zone";
Expand All @@ -56,7 +54,7 @@ std::vector<thermal_zone_interfaces::msg::ThermalZone> ThermalZonePublisherNode:
return msgs;
}

thermal_zone_interfaces::msg::ThermalZone ThermalZonePublisherNode::GetZoneMsg(
thermal_zone_interfaces::msg::ThermalZone ThermalZoneNode::GetZoneMsg(
std::string key, uint8_t zone_index)
{
std::string prefix = "/sys/class/thermal/";
Expand All @@ -75,7 +73,7 @@ thermal_zone_interfaces::msg::ThermalZone ThermalZonePublisherNode::GetZoneMsg(
return msg;
}

double ThermalZonePublisherNode::GetZoneTemperature(std::string thermal_zone_dir)
double ThermalZoneNode::GetZoneTemperature(std::string thermal_zone_dir)
{
std::string filename = "/temp";
std::string filepath = thermal_zone_dir + filename;
Expand Down
Loading