OneWire Library for Arduino  version: 1.0.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator
RomIterator.h
Go to the documentation of this file.
1 /******************************************************************/
33 #ifndef OneWire_RomIterator
34 #define OneWire_RomIterator
35 
36 #include <stdint.h>
37 #include "RomCommands.h"
38 
39 namespace OneWire
40 {
41  class OneWireMaster;
42 
45  {
46  private:
47  OneWireMaster & owMaster;
48 
49  protected:
51  RomIterator(OneWireMaster & master) : owMaster(master) { }
52 
53  public:
54  virtual ~RomIterator() { }
55 
57  OneWireMaster & master() const { return owMaster; }
58  };
59 
62  {
63  public:
66 
68  virtual bool lastDevice() const = 0;
69 
72 
75 
78  };
79 
82  {
83  protected:
85 
86  public:
89 
91  const RomId & selectedDevice() const { return searchState.romId; }
92 
93  virtual bool lastDevice() const;
97 
101 
105  };
106 
109  {
110  public:
113 
115  virtual OneWireMaster::CmdResult selectDevice(const RomId & romId) = 0;
116  };
117 
120  {
121  public:
124 
127  virtual OneWireMaster::CmdResult selectDevice(const RomId & romId);
128  };
129 
132  {
133  public:
136 
137  virtual OneWireMaster::CmdResult selectDevice(const RomId & romId);
138  };
139 
142  {
143  private:
144  RomId lastRom;
145 
146  public:
149  : RandomAccessRomIterator(master), lastRom() { }
150 
151  virtual OneWireMaster::CmdResult selectDevice(const RomId & romId);
152  };
153 }
154 
155 #endif
virtual OneWireMaster::CmdResult reselectCurrentDevice()=0
Reselect the current device for an additional operation.
OneWireMaster::CmdResult selectDevice()
Select the one and only device.
Definition: RomIterator.h:126
OneWireMaster::CmdResult selectFirstDeviceInFamily(uint8_t familyCode)
Definition: RomIterator.cpp:59
Standard container for a 1-Wire ROM ID.
Definition: RomId.h:43
virtual ~RomIterator()
Definition: RomIterator.h:54
RomId romId
Definition: RomCommands.h:49
Iterates through all 1-Wire devices sequentially using the search procedure.
Definition: RomIterator.h:81
RandomAccessRomIterator(OneWireMaster &master)
Definition: RomIterator.h:112
SingledropRomIterator(OneWireMaster &master)
Definition: RomIterator.h:123
RomCommands::SearchState searchState
Definition: RomIterator.h:84
virtual OneWireMaster::CmdResult selectNextDevice()=0
Select the next device in the sequence.
ForwardRomIterator(OneWireMaster &master)
Definition: RomIterator.h:65
MultidropRomIteratorWithResume(OneWireMaster &master)
Definition: RomIterator.h:148
OneWireMaster & master() const
The 1-Wire master used to issue ROM commands.
Definition: RomIterator.h:57
Iterator for a multidrop 1-Wire bus where slaves support the Resume ROM command.
Definition: RomIterator.h:141
virtual OneWireMaster::CmdResult selectDevice(const RomId &romId)
Select the device with the given ROM ID.
Definition: RomIterator.cpp:81
Definition: DS2484.h:41
Controls selection of 1-Wire devices on the bus through ROM commands.
Definition: RomIterator.h:44
virtual bool lastDevice() const
Indicates that current device is the last.
Definition: RomIterator.cpp:39
virtual OneWireMaster::CmdResult reselectCurrentDevice()
Reselect the current device for an additional operation.
Definition: RomIterator.cpp:54
virtual bool lastDevice() const =0
Indicates that current device is the last.
Iterator for a multidrop 1-Wire bus.
Definition: RomIterator.h:131
virtual OneWireMaster::CmdResult selectFirstDevice()
Select the first device in the sequence.
Definition: RomIterator.cpp:44
OneWireMaster::CmdResult selectNextFamilyDevice()
Definition: RomIterator.cpp:65
virtual OneWireMaster::CmdResult selectDevice(const RomId &romId)=0
Select the device with the given ROM ID.
virtual OneWireMaster::CmdResult selectDevice(const RomId &romId)
Select the device with the given ROM ID.
Definition: RomIterator.cpp:76
Iterates through all 1-Wire devices in a sequential first to last order.
Definition: RomIterator.h:61
ForwardSearchRomIterator(OneWireMaster &master)
Definition: RomIterator.h:88
Base class for all 1-Wire Masters.
Definition: OneWireMaster.h:43
MultidropRomIterator(OneWireMaster &master)
Definition: RomIterator.h:135
const RomId & selectedDevice() const
ROM ID of the currently selected device.
Definition: RomIterator.h:91
virtual OneWireMaster::CmdResult selectNextDevice()
Select the next device in the sequence.
Definition: RomIterator.cpp:49
State used by all ROM ID search functions.
Definition: RomCommands.h:47
RomIterator(OneWireMaster &master)
Definition: RomIterator.h:51
Iterator for a singledrop 1-Wire bus.
Definition: RomIterator.h:119
CmdResult
Result of all 1-Wire commands.
Definition: OneWireMaster.h:68
virtual OneWireMaster::CmdResult selectFirstDevice()=0
Select the first device in the sequence.
OneWireMaster::CmdResult OWSkipRom(OneWireMaster &master)
Definition: RomCommands.cpp:152
Iterates though 1-Wire devices on the bus using random selection by ROM ID.
Definition: RomIterator.h:108