#include <LOW_devDS2406.h>
Inheritance diagram for LOW_devDS2406:
Public Types | |
typedef std::vector< LOW_devDS2406 * > | devDS2406PtrVec_t |
Vector type of class device pointers. | |
typedef LOW_devDS2406::statusRegister_t | statusRegister_t |
DS2406 internal status register as defined by Dallas. | |
enum | chanSelect_t { noneSelect = 0, chanASelect = 1, chanBSelect = 2, chanBothSelect = 3 } |
Type for PIO channel selection. More... | |
enum | sourceSelect_t { latchSelect = 1, flipFlopSelect = 2, curStatusSelect = 3 } |
Type for search source selection. More... | |
enum | pioTransistor_t { pioTransistorOn = 0, pioTransistorOff = 1 } |
Type for PIO transistor states. More... | |
enum | activePolarity_t { activeLow = 0, activeHigh = 1 } |
Type for activity polarity selection. More... | |
typedef std::vector< LOW_device * > | devPtrVec_t |
Vector type of class device pointers. | |
typedef std::map< LOW_deviceID, LOW_device * > | deviceMap_t |
Map type of devices with LOW_deviceID as key. | |
Public Member Functions | |
class_DERIVE_FROM_EXCEPTION (devDS2406_error,LOW_exception) | |
Exception base class for all exceptions thrown by LOW_devDS2406. | |
LOW_devDS2406 (LOW_netSegment &inSegment, const LOW_deviceID &inDevID) | |
Real constructor corresponding to static pseudo constructor new_Instance(). | |
virtual | ~LOW_devDS2406 () |
Destructor. | |
virtual const LOW_deviceIDRaw::devFamCode_t | getFamilyCode () const |
Get the device's family code. | |
virtual const std::string | getFamilyName () const |
Get the device's family name. | |
virtual bool | getIsExternalPowered () const |
Get wether the device is externally powered. | |
virtual bool | getHasPioB () const |
Get wether the second PIO channel is present. | |
virtual void | getSearchCondition (LOW_devDS2406::statusRegister_t *outStatusRegister) const |
Get the current search condition. | |
virtual void | setSearchCondition (const chanSelect_t inChanSelect, const sourceSelect_t inSourceSelect, const activePolarity_t inPolaritySelect, const pioTransistor_t inPioATrans, const pioTransistor_t inPioBTrans) const |
Set the search condition and status of the PIO transistors. | |
virtual void | cmd_ReadMemory (const uint8_t inStartAddr, byteVec_t &outBytes) const |
Read from EPROM memory. | |
virtual void | cmd_ReadStatus (const uint8_t inStartAddr, byteVec_t &outBytes) const |
Read from status memory. | |
virtual void | cmd_WriteStatus (const uint8_t inStartAddr, const byteVec_t &inWriteBytes) const |
Write to status memory. | |
virtual LOW_deviceID | getID () const |
Get the device's ROM ID. | |
virtual LOW_netSegment & | getNetSegment () const |
Get the network segment the device is on. | |
virtual bool | verifyDevice (const bool inOnlyAlarm=false, const bool inDoReset=true) const |
Shortcut method to verify the presence of the device on it's network segment. | |
Static Public Attributes | |
const LOW_deviceIDRaw::devFamCode_t | familyCode = 0x12 |
Family code of this specific device. | |
const std::string | familyName = "DS2406" |
Family name of this specific device. | |
const owCommand_t | ReadMemory_COMMAND = 0xf0 |
1-Wire command byte constant | |
const owCommand_t | ExtendedReadMemory_COMMAND = 0xa5 |
1-Wire command byte constant | |
const owCommand_t | WriteMemory_COMMAND = 0x0f |
1-Wire command byte constant | |
const owCommand_t | WriteStatus_COMMAND = 0x55 |
1-Wire command byte constant | |
const owCommand_t | ReadStatus_COMMAND = 0xaa |
1-Wire command byte constant | |
const owCommand_t | ChannelAccess_COMMAND = 0xf5 |
1-Wire command byte constant | |
const LOW_deviceIDRaw::devFamCode_t | anyDev_famCode = 0x00 |
Pseudo family code for selecting any/all device types. | |
const LOW_deviceIDRaw::devFamCode_t | unknownDev_famCode = 0xff |
Pseudo family code for unknown device types. | |
const owCommand_t | MatchROM_COMMAND = 0x55 |
1-Wire command byte constant | |
const owCommand_t | ReadROM_COMMAND = 0x33 |
1-Wire command byte constant | |
const owCommand_t | SkipROM_COMMAND = 0xcc |
1-Wire command byte constant | |
const owCommand_t | SearchROM_COMMAND = 0xf0 |
1-Wire command byte constant | |
const owCommand_t | SearchAlarmROM_COMMAND = 0xec |
1-Wire command byte constant | |
Protected Member Functions | |
virtual void | readMemUniversal (const uint16_t inStartAddr, byteVec_t &outBytes, const uint16_t inMaxLen, const owCommand_t inCommand) const |
Universal, internal data reading. | |
virtual LOW_link & | getLink () const |
Get the link the device is on. | |
virtual void | cmd_MatchROM () const |
Shortcut for issuing a matchROM command for a device. | |
Static Protected Member Functions | |
LOW_device * | new_Instance (LOW_netSegment &inNetSegment, const LOW_deviceID &inDevID) |
Static pseudo constructor for registering with LOW_deviceFactory. | |
Protected Attributes | |
bool | isExternalPowered |
External supply indicator. | |
bool | hasPioB |
Wether the second PIO channel is present. | |
const LOW_deviceID | ID |
1-Wire ROM ID of the device | |
LOW_netSegment & | netSegment |
Network segment where the device is located. | |
Static Private Member Functions | |
int | initialize () |
Static inizializer to register the class with LOW_deviceFactory. | |
Static Private Attributes | |
int | initHelper = initialize() |
Needed for dirty little C++ hack to force static initialization on application start. | |
Friends | |
class | cmd_ChannelAccess |
required for accessing the device's lock | |
class | linkLock |
Needed to grant access to the protected getLink() method. |
DS2406 features:
This class is thread-safe.
Parts of the documentation by Dallas Semiconductors / Maxim Integrated Products
Definition at line 59 of file LOW_devDS2406.h.
|
Vector type of class device pointers.
Definition at line 99 of file LOW_devDS2406.h. |
|
Map type of devices with LOW_deviceID as key.
Definition at line 101 of file LOW_device.h. |
|
Vector type of class device pointers.
Definition at line 100 of file LOW_device.h. Referenced by LOW_netSegment::searchDevices(). |
|
DS2406 internal status register as defined by Dallas.
|
|
Type for activity polarity selection.
Definition at line 111 of file LOW_devDS2406.h. |
|
Type for PIO channel selection.
Definition at line 102 of file LOW_devDS2406.h. |
|
Type for PIO transistor states.
Definition at line 108 of file LOW_devDS2406.h. |
|
Type for search source selection.
Definition at line 105 of file LOW_devDS2406.h. |
|
Real constructor corresponding to static pseudo constructor new_Instance().
Definition at line 62 of file LOW_devDS2406.cpp. References chanASelect, cmd_ChannelAccess, LOW_devDS2406::cmd_ChannelAccess::getChannelInfo(), LOW_devDS2406::cmd_ChannelAccess::channelInfo_t::hasPioB, hasPioB, LOW_devDS2406::cmd_ChannelAccess::channelInfo_t::isExternalPowered, and isExternalPowered. Referenced by new_Instance(). |
|
Destructor.
Definition at line 77 of file LOW_devDS2406.cpp. |
|
Exception base class for all exceptions thrown by LOW_devDS2406.
|
|
Shortcut for issuing a matchROM command for a device. Calls the corresponding method in LOW_netSegment. Definition at line 102 of file LOW_device.cpp. References LOW_netSegment::cmd_MatchROM(), and LOW_device::netSegment. Referenced by LOW_devDS2406::cmd_ChannelAccess::cmd_ChannelAccess(), LOW_devDS1820::cmd_ConvertT(), LOW_devDS1820::cmd_CopyScratchpad(), LOW_devDS2890::cmd_Decrement(), LOW_devDS2890::cmd_Increment(), LOW_devDS2405::cmd_Match(), LOW_devDS2890::cmd_ReadControlRegister(), LOW_devDS2890::cmd_ReadPosition(), LOW_devDS1820::cmd_ReadPowerSupply(), LOW_devDS1820::cmd_ReadScratchpad(), LOW_devDS1820::cmd_RecallE2(), LOW_devDS2890::cmd_WriteControlRegister(), LOW_devDS2890::cmd_WritePosition(), LOW_devDS1820::cmd_WriteScratchpad(), cmd_WriteStatus(), and readMemUniversal(). |
|
Read from EPROM memory. The Read Memory command is used to read data from the 1024-bit EPROM data memory field. The bus master follows the command byte with a two-byte address (TA1=(T7:T0), TA2=(T15:T8)) that indicates a starting byte location within the data field. With every subsequent read data time slot the bus master receives data from the DS2406 starting at the initial address and continuing until the end of the 1024-bits data field is reached or until a Reset Pulse is issued. If reading occurs through the end of memory space, the bus master issues sixteen additional read time slots and the DS2406 will respond with a 16-bit CRC of the command, address bytes and all data bytes read from the initial starting byte through the last byte of memory. This CRC is the result of clearing the CRC generator and then shifting in the command byte followed by the two address bytes and the data bytes beginning at the first addressed memory location and continuing through to the last byte of the EPROM data memory. Any reads ended by a Reset Pulse prior to reaching the end of memory will not have the 16-bit CRC available. Typically the software controlling the device should store a 16-bit CRC with each page of data to insure rapid, error-free data transfers that eliminate having to read a page multiple times to determine if the received data is correct or not. (See Book of DS19xx iButton Standards, Chapter 7 for the recommended file structure to be used with the 1-Wire environment). If CRC values are imbedded within the data it is unnecessary to read the end-of-memory CRC. The Read Memory command can be ended at any point by issuing a Reset Pulse.
Definition at line 140 of file LOW_devDS2406.cpp. References ReadMemory_COMMAND, and readMemUniversal(). |
|
Read from status memory. The Read Status command is used to read data from the Status Memory field. The functional flow of this command is identical to the Read Memory command. Since the Status Memory is only 8 bytes, the DS2406 will send the 16-bit CRC after the last byte of status information has been transmitted. DS2406 status memory map:
Definition at line 147 of file LOW_devDS2406.cpp. References readMemUniversal(), and ReadStatus_COMMAND. Referenced by getSearchCondition(). |
|
Write to status memory. The Write Status command is used to program the Status Memory, which includes the specification of the Conditional Search Settings. The Status Memory address range is 0000h to 0007h. The general programming algorithm is valid for the EPROM section of the Status Memory (addresses 0 to 4) only. The Status memory locations 5 and 6 are already pre-programmed to 00h and therefore cannot be altered. Status memory location 7 consists of static RAM, which can be reprogrammed without limitation. The supply indication (bit 7) is read-only; attempts to write to it are ignored. The function flow for writing to status memory location 7 is basically the same as for the other EPROM Status Memory Bytes. However, instead of a programming pulse the bus master sends a FFh byte (equivalent to 8 Write-One Time Slots) to transfer the new value from the scratchpad to the status memory. See also cmd_ReadStatus().
Definition at line 154 of file LOW_devDS2406.cpp. References byteVec_t, LOW_helper_CRC::calcCRC16(), LOW_device::cmd_MatchROM(), LOW_device::getLink(), LOW_device::linkLock, LOW_link::readDataByte(), LOW_link::resetBus(), LOW_link::writeData(), and WriteStatus_COMMAND. Referenced by setSearchCondition(). |
|
Get the device's family code. Note: Subclasses must implement this method to return their specific family code.
Reimplemented from LOW_device. Definition at line 279 of file LOW_devDS2406.h. References LOW_deviceIDRaw::devFamCode_t, and familyCode. |
|
Get the device's family name. Note: Subclasses must implement this method to return a clear text name of their family.
Reimplemented from LOW_device. Definition at line 286 of file LOW_devDS2406.h. References familyName. |
|
Get wether the second PIO channel is present.
Definition at line 93 of file LOW_devDS2406.cpp. References hasPioB. Referenced by LOW_devDS2406::cmd_ChannelAccess::cmd_ChannelAccess(), LOW_compTwinSwitch::handleAlarm(), LOW_compTwinSwitch::LOW_compTwinSwitch(), and setSearchCondition(). |
|
Get the device's ROM ID.
Definition at line 73 of file LOW_device.cpp. References LOW_device::ID. Referenced by LOW_netSegment::buryDevice(), LOW_netSegment::cmd_MatchROM(), LOW_compJalousieController::LOW_compJalousieController(), LOW_netSegment::removeDevice(), and LOW_netSegment::revitalizeDevice(). |
|
Get wether the device is externally powered.
Definition at line 87 of file LOW_devDS2406.cpp. References isExternalPowered. |
|
|
Get the network segment the device is on.
Definition at line 79 of file LOW_device.cpp. References LOW_device::netSegment. Referenced by LOW_compJalousieController::LOW_compJalousieController(), and LOW_compTwinSwitch::LOW_compTwinSwitch(). |
|
Get the current search condition. See also setSearchCondition().
Definition at line 99 of file LOW_devDS2406.cpp. References LOW_devDS2406::statusRegister_t::activePolarity, byteVec_t, LOW_devDS2406::statusRegister_t::channelFFQ_pioA, LOW_devDS2406::statusRegister_t::channelFFQ_pioB, LOW_devDS2406::statusRegister_t::channelSelect, cmd_ReadStatus(), LOW_devDS2406::statusRegister_t::isExternalPowered, and LOW_devDS2406::statusRegister_t::sourceSelect. |
|
Static inizializer to register the class with LOW_deviceFactory.
Definition at line 37 of file LOW_devDS2406.cpp. References familyCode, new_Instance(), and LOW_deviceFactory::registerSpecificCtor(). |
|
Static pseudo constructor for registering with LOW_deviceFactory.
Reimplemented from LOW_device. Definition at line 50 of file LOW_devDS2406.cpp. References LOW_devDS2406(). Referenced by initialize(). |
|
Universal, internal data reading. Implements common parts of memory reading.
Definition at line 201 of file LOW_devDS2406.cpp. References byteVec_t, LOW_helper_CRC::calcCRC16(), LOW_device::cmd_MatchROM(), LOW_device::getLink(), LOW_device::linkLock, LOW_link::readData(), LOW_link::readDataByte(), LOW_link::resetBus(), and LOW_link::writeData(). Referenced by cmd_ReadMemory(), and cmd_ReadStatus(). |
|
Set the search condition and status of the PIO transistors. The condition is specified by the bit functions CSS0 to CSS4 in Status Memory location 7. At power-on all these bits are 1s. As long as the device remains powered up, the modified search conditions are available for use at any time. For the conditional search, one can specify
The table shows all qualifying conditions and the required settings for CSS0 to CSS4:
Definition at line 116 of file LOW_devDS2406.cpp. References byteVec_t, chanBothSelect, chanBSelect, cmd_WriteStatus(), and getHasPioB(). Referenced by LOW_compTwinSwitch::setAlarmCondition(). |
|
Shortcut method to verify the presence of the device on it's network segment.
Definition at line 85 of file LOW_device.cpp. References LOW_device::ID, LOW_device::netSegment, and LOW_netSegment::verifyDevice(). Referenced by LOW_compTwinSwitch::alarmPollLoop(), LOW_compTempSensor::checkAlarm(), LOW_devDS2405::cmd_SearchActive(), and LOW_devDS2405::cmd_SearchRead(). |
|
required for accessing the device's lock
Definition at line 500 of file LOW_devDS2406.h. Referenced by LOW_devDS2406(), LOW_compTwinSwitch::readStatus(), and LOW_compTwinSwitch::resetLatches(). |
|
|
Pseudo family code for selecting any/all device types.
Definition at line 73 of file LOW_device.h. Referenced by LOW_netSegment::cmd_SearchROMVerify(), LOW_netSegment::getDevice(), LOW_netSegment::getDevices(), LOW_deviceFactory::registerSpecificCtor(), LOW_linkDS2490::searchDevices(), and LOW_link::searchDevices(). |
|
1-Wire command byte constant
Definition at line 90 of file LOW_devDS2406.h. |
|
1-Wire command byte constant
Definition at line 86 of file LOW_devDS2406.h. |
|
Family code of this specific device.
Reimplemented from LOW_device. Definition at line 80 of file LOW_devDS2406.h. Referenced by getFamilyCode(), and initialize(). |
|
Family name of this specific device.
Reimplemented from LOW_device. Definition at line 34 of file LOW_devDS2406.cpp. Referenced by getFamilyName(). |
|
Wether the second PIO channel is present.
Definition at line 509 of file LOW_devDS2406.h. Referenced by getHasPioB(), and LOW_devDS2406(). |
|
1-Wire ROM ID of the device
Definition at line 192 of file LOW_device.h. Referenced by LOW_device::getID(), LOW_device::LOW_device(), and LOW_device::verifyDevice(). |
|
Needed for dirty little C++ hack to force static initialization on application start.
Definition at line 36 of file LOW_devDS2406.cpp. |
|
External supply indicator.
Definition at line 508 of file LOW_devDS2406.h. Referenced by getIsExternalPowered(), and LOW_devDS2406(). |
|
1-Wire command byte constant
Definition at line 88 of file LOW_device.h. Referenced by LOW_netSegment::cmd_MatchROM(). |
|
Network segment where the device is located.
Definition at line 193 of file LOW_device.h. Referenced by LOW_device::cmd_MatchROM(), LOW_device::getLink(), LOW_device::getNetSegment(), LOW_device::LOW_device(), LOW_device::verifyDevice(), and LOW_device::~LOW_device(). |
|
1-Wire command byte constant
Definition at line 85 of file LOW_devDS2406.h. Referenced by cmd_ReadMemory(). |
|
1-Wire command byte constant
Definition at line 89 of file LOW_device.h. Referenced by LOW_netSegment::cmd_ReadROM(). |
|
1-Wire command byte constant
Definition at line 89 of file LOW_devDS2406.h. Referenced by cmd_ReadStatus(). |
|
1-Wire command byte constant
Definition at line 92 of file LOW_device.h. Referenced by LOW_linkDS2490::searchDevices(), and LOW_link::searchDevices(). |
|
1-Wire command byte constant
Definition at line 91 of file LOW_device.h. Referenced by LOW_linkDS2490::searchDevices(), and LOW_link::searchDevices(). |
|
1-Wire command byte constant
Definition at line 90 of file LOW_device.h. Referenced by LOW_netSegment::cmd_SkipROM(). |
|
Pseudo family code for unknown device types.
Definition at line 76 of file LOW_device.h. Referenced by LOW_netSegment::getDevice(), LOW_netSegment::getDevices(), and LOW_deviceFactory::registerSpecificCtor(). |
|
1-Wire command byte constant
Definition at line 87 of file LOW_devDS2406.h. |
|
1-Wire command byte constant
Definition at line 88 of file LOW_devDS2406.h. Referenced by cmd_WriteStatus(). |