Skip to content

Commit

Permalink
Merge pull request #9 from NathanaelGandhi/ng/rename-thermalzonenode
Browse files Browse the repository at this point in the history
fix: rename ThermalZoneNode from ThermalZonePublisherNode
  • Loading branch information
NathanaelGandhi authored May 15, 2024
2 parents 404c84f + 0c5ecbf commit 2a00255
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
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

0 comments on commit 2a00255

Please sign in to comment.