upkie 6.1.0
Open-source wheeled biped robots
Loading...
Searching...
No Matches
upkie::cpp::sensors::CpuTemperature Class Reference

Sensor for CPU temperature readings. More...

#include <CpuTemperature.h>

Public Member Functions

 CpuTemperature (const char *temp_path="/sys/class/thermal/thermal_zone0/temp")
 Open file to query temperature from the kernel. More...
 
 ~CpuTemperature () override
 Close file.
 
std::string prefix () const noexcept final
 Prefix of output in the observation dictionary. More...
 
void write (Dictionary &observation) final
 Write output to a dictionary. More...
 
bool is_disabled () const
 Check if temperature observations are disabled.
 
- Public Member Functions inherited from upkie::cpp::sensors::Sensor
virtual ~Sensor ()
 Destructor is virtual to deallocate lists of observers properly.
 
virtual std::string prefix () const noexcept
 Prefix of output in the observation dictionary. More...
 
virtual void write (Dictionary &observation)
 Write output to a dictionary. More...
 

Detailed Description

Sensor for CPU temperature readings.

Note
This sensor only works on Linux.

Constructor & Destructor Documentation

◆ CpuTemperature()

upkie::cpp::sensors::CpuTemperature::CpuTemperature ( const char *  temp_path = "/sys/class/thermal/thermal_zone0/temp")

Open file to query temperature from the kernel.

Parameters
[in]temp_pathPath to thermal-zone special file from the Linux kernel.

Member Function Documentation

◆ prefix()

std::string upkie::cpp::sensors::CpuTemperature::prefix ( ) const
inlinefinalvirtualnoexcept

Prefix of output in the observation dictionary.

Reimplemented from upkie::cpp::sensors::Sensor.

◆ write()

void upkie::cpp::sensors::CpuTemperature::write ( Dictionary &  observation)
finalvirtual

Write output to a dictionary.

Parameters
[out]observationDictionary to write observations to.

Reimplemented from upkie::cpp::sensors::Sensor.


The documentation for this class was generated from the following files: