DS2482-RK
Public Member Functions | Protected Attributes
DS2482Device Class Reference

Holds the address and temperature for a single DS18B20 the 1-wire bus. More...

#include <DS2482-RK.h>

Public Member Functions

 DS2482Device ()
 Constructs an empty DS2482Device object.
 
virtual ~DS2482Device ()
 Destructor for DS2482Device.
 
 DS2482Device (const DS24821WireAddress &addr)
 
 DS2482Device (const DS2482Device &other)
 Constructs a DS2482Device object from another DS2482Device (copy constructor).
 
DS2482Deviceoperator= (const DS2482Device &other)
 Copies another DS2482Device object values into this one.
 
String toString () const
 
void clear ()
 Clears the address, temperature, and valid flags.
 
float getTemperatureC () const
 Gets the temperature in degrees Celsius. More...
 
float getTemperatureF () const
 Gets the temperature in degrees Fahrenheit. More...
 
void setTemperatureC (float value)
 Sets the temperature in degrees Celsius. More...
 
bool getValid () const
 Gets the valid flag for this temperature reading. More...
 
void setValid (bool value)
 Sets the valid flag.
 
DS24821WireAddress getAddress () const
 Gets a copy of the DS24821WireAddress address.
 
void setAddress (const DS24821WireAddress &addr)
 Sets the 1-wire address. More...
 

Protected Attributes

DS24821WireAddress addr
 The 1-wire address (8 bytes)
 
float temperatureC
 The last temperature in degrees Celsius.
 
bool valid
 True if the last temperature read was successful.
 

Detailed Description

Holds the address and temperature for a single DS18B20 the 1-wire bus.

This hold the address, the last temperature, and whether the last retrieval was valid or not.

Constructor & Destructor Documentation

◆ DS2482Device()

DS2482Device::DS2482Device ( const DS24821WireAddress addr)

Constructs a DS2482Device object from a 1-wire address DS24821WireAddress.

Member Function Documentation

◆ getTemperatureC()

float DS2482Device::getTemperatureC ( ) const
inline

Gets the temperature in degrees Celsius.

Note that the resolution depends on the conversion bit settings. It ranges from 1/2 degree (9-bit) to 1/16 degree (12-bit)

◆ getTemperatureF()

float DS2482Device::getTemperatureF ( ) const
inline

Gets the temperature in degrees Fahrenheit.

The DS18B20 uses Celsius internally, so the resolution is reflected in that. The degrees F is the actual converted value and may have more decimal places.

◆ getValid()

bool DS2482Device::getValid ( ) const
inline

Gets the valid flag for this temperature reading.

When getting a list of temperatures using DS2482GetTemperatureForListCommand, it's possible that not every sensor will return a value. The getValid allows you to figure out which ones are valid.

◆ setAddress()

void DS2482Device::setAddress ( const DS24821WireAddress addr)
inline

Sets the 1-wire address.

Parameters
addrThe address to set.

The addr is copied, so it does not need to be preserved after this call completes.

◆ setTemperatureC()

void DS2482Device::setTemperatureC ( float  value)
inline

Sets the temperature in degrees Celsius.

Parameters
valueTemperature in degrees Celsius (as a float)

◆ toString()

String DS2482Device::toString ( ) const

Returns a string representation of this object including the address, temperature, and valid flag.


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