COSA
An Object-Oriented Platform for Arduino Programming
OWI::Search Class Reference

#include <OWI.hh>

Inheritance diagram for OWI::Search:
Inheritance graph
Collaboration diagram for OWI::Search:
Collaboration graph

Public Member Functions

 Search (OWI *owi, uint8_t family=0)
 
Drivernext ()
 
void reset ()
 

Protected Types

enum  { FIRST = -1, ERROR = -1, LAST = ROMBITS }
 

Protected Member Functions

uint8_t * rom ()
 
bool update_rom ()
 
int8_t search_rom (int8_t last=FIRST)
 
bool read_rom ()
 
bool match_rom ()
 
bool skip_rom ()
 
int8_t alarm_search (int8_t last=FIRST)
 
bool connect (uint8_t family, uint8_t index)
 
virtual void on_alarm ()
 
int8_t search (int8_t last=FIRST)
 

Protected Attributes

uint8_t m_family
 
int8_t m_last
 
str_P NAME
 
uint8_t m_rom [ROM_MAX]
 
const uint8_t * ROM
 
Driverm_next
 
OWIm_pin
 

Detailed Description

Alarm search iterator class.

Definition at line 183 of file OWI.hh.

Member Enumeration Documentation

anonymous enum
inherited
Enumerator
FIRST 
ERROR 
LAST 

Definition at line 60 of file OWI.hh.

Constructor & Destructor Documentation

OWI::Search::Search ( OWI owi,
uint8_t  family = 0 
)
inline

Initiate an alarm search iterator for the given one-wire bus and device family code.

Parameters
[in]owione-wire bus.
[in]familycode (default all).

Definition at line 191 of file OWI.hh.

Member Function Documentation

int8_t OWI::Driver::alarm_search ( int8_t  last = FIRST)
inherited

Search alarming device given the last position of discrepancy. Negative value for start from the beginning.

Parameters
[in]lastposition of discrepancy.
Returns
position of difference or negative error code.

Definition at line 264 of file OWI.cpp.

bool OWI::Driver::connect ( uint8_t  family,
uint8_t  index 
)
inherited

Connect to one-wire device with given family code and index.

Parameters
[in]familydevice family code.
[in]indexdevice order.
Returns
true(1) if successful otherwise false(0).

Definition at line 272 of file OWI.cpp.

bool OWI::Driver::match_rom ( )
inherited

Match device rom. Address the slave device with the rom code. Device specific function command should follow. May be used to verify rom code.

Returns
true(1) if successful otherwise false(0).

Definition at line 244 of file OWI.cpp.

OWI::Driver * OWI::Search::next ( )

Get the next device with an active alarm.

Returns
pointer to driver or null(0).

Definition at line 307 of file OWI.cpp.

virtual void OWI::Driver::on_alarm ( )
inlinevirtualinherited

Callback on alarm dispatch. Default is empty function.

Definition at line 159 of file OWI.hh.

bool OWI::Driver::read_rom ( )
inherited

Read device rom. This can only be used when there is only one slave on the bus.

Returns
true(1) if successful otherwise false(0).

Definition at line 236 of file OWI.cpp.

void OWI::Search::reset ( )
inline

Reset iterator.

Definition at line 206 of file OWI.hh.

uint8_t* OWI::Driver::rom ( )
inlineinherited

Return pointer to device rom.

Returns
device rom buffer.

Definition at line 96 of file OWI.hh.

int8_t OWI::Driver::search ( int8_t  last = FIRST)
protectedinherited

Search device rom given the last position of discrepancy. Negative value for start from the beginning.

Parameters
[in]lastposition of discrepancy.
Returns
position of difference or negative error code.

Definition at line 182 of file OWI.cpp.

int8_t OWI::Driver::search_rom ( int8_t  last = FIRST)
inherited

Search device rom given the last position of discrepancy. Negative value for start from the beginning.

Parameters
[in]lastposition of discrepancy.
Returns
position of difference or negative error code.

Definition at line 228 of file OWI.cpp.

bool OWI::Driver::skip_rom ( )
inherited

Skip device rom for boardcast or single device access. Device specific function command should follow.

Returns
true(1) if successful otherwise false(0).

Definition at line 256 of file OWI.cpp.

bool OWI::Driver::update_rom ( )
inherited

Update the rom identity (in EEPROM). Return true(1) if successful otherwise false(0). Typically used to save configuration after connect(). return bool.

Definition at line 174 of file OWI.cpp.

Member Data Documentation

uint8_t OWI::Search::m_family
protected

Definition at line 212 of file OWI.hh.

int8_t OWI::Search::m_last
protected

Definition at line 213 of file OWI.hh.

Driver* OWI::Driver::m_next
protectedinherited

Definition at line 164 of file OWI.hh.

OWI* OWI::Driver::m_pin
protectedinherited

Definition at line 165 of file OWI.hh.

uint8_t OWI::Driver::m_rom[ROM_MAX]
protectedinherited

Definition at line 162 of file OWI.hh.

str_P OWI::Driver::NAME
inherited

Name of device driver instance.

Definition at line 67 of file OWI.hh.

const uint8_t* OWI::Driver::ROM
protectedinherited

Definition at line 163 of file OWI.hh.


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