DS2482-RK
|
Holds an array of DS2482Device objects. More...
#include <DS2482-RK.h>
Public Member Functions | |
DS2482DeviceList (DS2482Device *devices, size_t deviceMax) | |
Constructs a DS2482DeviceList object with an array of DS2482Device objects. | |
virtual | ~DS2482DeviceList () |
Destructor for DS2482DeviceList. | |
bool | addAddress (const DS24821WireAddress &addr) |
Adds a DS24821WireAddress to the device list. More... | |
void | clear () |
Clears add of the objects in the array. | |
void | clearValid () |
Clears all of the valid values in the array. More... | |
DS24821WireAddress | getAddressByIndex (size_t ii) |
Gets the 1-wire address of a device in list by index. More... | |
DS2482Device & | getDeviceByIndex (size_t ii) |
Gets the DS2482Device of a device in list by index. More... | |
const DS2482Device & | getDeviceByIndex (size_t ii) const |
Gets the DS2482Device of a device in list by index. More... | |
size_t | getDeviceCount () |
Returns the number of devices in the list (devices that have been added) More... | |
size_t | getDeviceMax () |
Returns the maximum number of devices that can be added, based on the size of the array. More... | |
Protected Attributes | |
DS2482Device * | devices |
The array of device objects. | |
size_t | deviceCount |
The number of devices currently in the list (0 = none, 1 = one, ...) | |
size_t | deviceMax |
The maximum number of objects in the array. | |
Holds an array of DS2482Device objects.
Normally you will use DS2482DeviceListStatic, below, instead of instantiating this object directly.
This class does not allocate memory; you pass in a buffer and length and it keeps track of the number of devices in the list. Note that deviceMax is in number of DS2482Device objects; the actual size in bytes is 16 times that.
bool DS2482DeviceList::addAddress | ( | const DS24821WireAddress & | addr | ) |
Adds a DS24821WireAddress to the device list.
addr | The 1-wire address to add. addr is copied. |
void DS2482DeviceList::clearValid | ( | ) |
Clears all of the valid values in the array.
This is done before reading temperatures using DS24821GetTemperatureForListCommand.
|
inline |
Gets the 1-wire address of a device in list by index.
ii | The index to retrieve (0 is the first element) |
|
inline |
Gets the DS2482Device of a device in list by index.
ii | The index to retrieve (0 is the first element) |
|
inline |
Gets the DS2482Device of a device in list by index.
ii | The index to retrieve (0 is the first element) |
Note that DS2482Device supports the copy operator and copy constructor so it's easy to make your own copy of it.
|
inline |
Returns the number of devices in the list (devices that have been added)
|
inline |
Returns the maximum number of devices that can be added, based on the size of the array.
If getDeviceCount() == getDeviceMax() then the list is full and no more can be added.