#include <LOW_linkPassiveSerial.h>
Inheritance diagram for LOW_linkPassiveSerial:
Public Types | |
typedef std::vector< LOW_link * > | linkPtrVec_t |
Vector type of link class pointers. | |
typedef LOW_objectIDFactory::objectID_t | linkID_t |
Type for individual link ID number. | |
enum | strongPullup_t { pullUp_16_4 = 0x00, pullUp_65_5, pullUp_131, pullUp_262, pullUp_524, pullUp_1048, pullUp_NONE = 0xff } |
Type for strong pullup period specification. More... | |
enum | progPulse_t { progPulse_32 = 0x00, progPulse_64, progPulse_128, progPulse_256, progPulse_512, progPulse_1024, progPulse_2048 } |
Type for 12V program pulse period specification. More... | |
Public Member Functions | |
LOW_linkPassiveSerial (const LOW_portSerialFactory::portSpecifier_t &inSerPortSpec, const bool inAllowProgPulse=false) | |
Constructor. | |
~LOW_linkPassiveSerial () | |
Destructor. | |
virtual std::string | getLinkFamily () const |
Get the link's family type. | |
class_DERIVE_FROM_EXCEPTION (link_error, LOW_exception) | |
Exception base class for all exceptions thrown by LOW_link. | |
class_DERIVE_FROM_EXCEPTION (comm_error, link_error) | |
Exception class to be thrown on communication errors. | |
class_DERIVE_FROM_EXCEPTION (internal_error, link_error) | |
Exception class to be thrown on pure internal errors. | |
class_DERIVE_FROM_EXCEPTION (illegalSpeed_error, link_error) | |
Exception class to be thrown on errors related to currently selected wire speed. | |
class_DERIVE_FROM_EXCEPTION (illegalLevel_error, link_error) | |
Exception class to be thrown on errors related to requested voltage level. | |
class_DERIVE_FROM_EXCEPTION (notAllowed_error, link_error) | |
Exception class to be thrown on access violation errors. | |
class_DERIVE_FROM_EXCEPTION (sizeMismatch_error, link_error) | |
virtual bool | operator== (LOW_link &inLink) const |
Comparison based on linkID. | |
Bus touch (write/read) methods required by LOW_Link | |
virtual bool | touchBit (const bool inSendBit, const strongPullup_t inPullup=pullUp_NONE) |
Send 1 bit of communication to the 1-Wire net and return the result 1 bit read from the 1-Wire net. | |
virtual uint8_t | touchByte (const uint8_t inSendByte, const strongPullup_t inPullup=pullUp_NONE) |
Send 8 bits of communication to the 1-Wire net and return the result 8 bits read from the 1-Wire net. | |
Misc methods required by LOW_Link | |
virtual void | resetLinkAdapter () |
Reset the adapter. | |
virtual bool | resetBus () |
Reset all of the devices on the 1-Wire net. | |
virtual void | strongPullup (const unsigned long inMicroSecs) |
Set the 1-Wire net line level to strong pullup for a specified time. | |
virtual void | strongPullup (const strongPullup_t inPullupTime) |
Set the 1-Wire net line level to strong pullup for a specified time. | |
virtual void | programPulse (const unsigned long inMicroSecs) |
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. | |
virtual void | programPulse (const progPulse_t inPulseTime) |
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. | |
Bus touch (write/read) methods | |
virtual byteVec_t | touchBlock (const byteVec_t &inBytes, const strongPullup_t inPullup=pullUp_NONE) |
Send block of communication to the 1-Wire net and return the resulting bytes read from the 1-Wire net. | |
Bus read methods | |
virtual bool | readDataBit (const strongPullup_t inPullup=pullUp_NONE) |
Receive 1 bit from the 1-Wire net by previously sending one bit of read communication to the 1-Wire net. | |
virtual uint8_t | readDataByte (const strongPullup_t inPullup=pullUp_NONE) |
Receive 1 byte from the 1-Wire net by previously sending 8 bits of read communication to the 1-Wire net. | |
virtual void | readData (byteVec_t &outBytes, const strongPullup_t inPullup=pullUp_NONE) |
Receive a block of bytes from the 1-Wire net by previously sending a block of bytes of read communication to the 1-Wire Net. | |
Bus write methods | |
virtual void | writeData (const bool inSendBit, const strongPullup_t inPullup=pullUp_NONE) |
Send 1 bit to the 1-Wire net and verify that the bit read from the 1-Wire net is the same (bus write operation). | |
virtual void | writeData (const uint8_t inSendByte, const strongPullup_t inPullup=pullUp_NONE) |
Send 1 byte to the 1-Wire net and verify that the byte read from the 1-Wire net is the same (bus write operation). | |
virtual void | writeData (const byteVec_t &inSendBytes, const strongPullup_t inPullup=pullUp_NONE) |
Send block of bytes to the 1-Wire net and verify that the bytes block read from the 1-Wire net are the same (bus write operation). | |
Higher level actions | |
virtual LOW_deviceID::deviceIDVec_t | searchDevices (const bool inOnlyAlarm, const LOW_deviceIDRaw inPreload, const LOW_deviceIDRaw::devFamCode_t inFamCode, const bool inDoReset) |
Execute a complete search sequence from preloaded ID vector. | |
Misc methods | |
linkID_t | getID () const |
Get ID of the link. | |
bool | getHasProgramPulse () const |
Get wether the adapter is capable of 12V Program pulse. | |
bool | getHasExternalPower () const |
Get whether there is an external power line on the segment. | |
bool | getAllowProgPulse () const |
Get wether the program pulse should be allowed. | |
Protected Member Functions | |
virtual void | doSearchSequence (const LOW_deviceIDRaw &inBranchVector, LOW_deviceIDRaw &outFoundID, LOW_deviceIDRaw &outDiscrVec) |
Execute a single search sequence on the bus. | |
Protected Attributes | |
const linkID_t | linkID |
Individual ID of the link adapter. | |
bool | hasProgramPulse |
Wether the adapter is capable of 12V Program pulse. | |
const bool | hasExternalPower |
Wether the attached bus supplies external power. | |
const bool | allowProgPulse |
Wether the program pulse should be allowed. | |
Private Attributes | |
LOW_portSerial * | serialPort |
The serial port the adapter is attached to. | |
Static Private Attributes | |
const int | strongPullupEmuTime = 3 |
Time to wait for emulation of strong pullup in seconds. |
As the passive adapter is not capable of real strong pullups with high current, it is emulated by providing high level on the bus for a relatively long time.
This class is thread-safe.
Definition at line 38 of file LOW_linkPassiveSerial.h.
|
Type for individual link ID number.
Definition at line 126 of file LOW_link.h. |
|
Vector type of link class pointers.
Definition at line 124 of file LOW_link.h. |
|
Type for 12V program pulse period specification. Period may vary a little, depending on actual device.
Definition at line 141 of file LOW_link.h. |
|
Type for strong pullup period specification. Period may vary a little, depending on actual device.
Definition at line 130 of file LOW_link.h. |
|
Constructor.
Definition at line 28 of file LOW_linkPassiveSerial.cpp. References LOW_portSerialFactory::new_portSerial(), resetBus(), resetLinkAdapter(), and serialPort. |
|
Destructor.
Definition at line 40 of file LOW_linkPassiveSerial.cpp. References serialPort, and LOW_portSerial::tty_flush(). |
|
|
|
Exception class to be thrown on access violation errors.
|
|
Exception class to be thrown on errors related to requested voltage level.
|
|
Exception class to be thrown on errors related to currently selected wire speed.
|
|
Exception class to be thrown on pure internal errors.
|
|
Exception class to be thrown on communication errors.
|
|
Exception base class for all exceptions thrown by LOW_link.
|
|
Execute a single search sequence on the bus. A default implementation relying on bit i/o methods is provided.
Reimplemented in LOW_linkDS2480B, and LOW_linkDS2490. Definition at line 267 of file LOW_link.cpp. References LOW_deviceIDRaw::getBit(), LOW_link::readDataBit(), LOW_deviceIDRaw::setBit(), and LOW_link::writeData(). Referenced by LOW_link::searchDevices(). |
|
Get wether the program pulse should be allowed.
Definition at line 80 of file LOW_link.cpp. References LOW_link::allowProgPulse. |
|
Get whether there is an external power line on the segment.
Definition at line 74 of file LOW_link.cpp. References LOW_link::hasExternalPower. Referenced by LOW_netSegment::LOW_netSegment(). |
|
Get wether the adapter is capable of 12V Program pulse.
Definition at line 68 of file LOW_link.cpp. References LOW_link::hasProgramPulse. |
|
Get ID of the link.
Definition at line 62 of file LOW_link.cpp. References LOW_link::linkID. |
|
Get the link's family type. Note: Subclasses must implement this method to return a clear text name of their kind.
Implements LOW_link. Definition at line 66 of file LOW_linkPassiveSerial.h. |
|
Comparison based on linkID.
Definition at line 50 of file LOW_link.cpp. References LOW_link::linkID. |
|
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. For EPROM programming, only a single slave device should be connected to the 1-Wire bus and the cable must be short, not to exceed a few meters. Note: One should not attempt generating a programming pulse with a non-EPROM device on the bus; this may damage the device as well as the link controller. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implements LOW_link. Definition at line 194 of file LOW_linkPassiveSerial.cpp. References LOW_link::allowProgPulse, and LOW_link::hasProgramPulse. |
|
Create a 12 volt pulse on the 1-Wire net for programming EPROM devices. For EPROM programming, only a single slave device should be connected to the 1-Wire bus and the cable must be short, not to exceed a few meters. Note: One should not attempt generating a programming pulse with a non-EPROM device on the bus; this may damage the device as well as the link controller. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implements LOW_link. Definition at line 180 of file LOW_linkPassiveSerial.cpp. References LOW_link::allowProgPulse, and LOW_link::hasProgramPulse. |
|
Receive a block of bytes from the 1-Wire net by previously sending a block of bytes of read communication to the 1-Wire Net. Note: When the strong pullup is selected it will NOT appear after each byte sent, only after the last byte the pullup is done! A default implementation relying on the touch methods is provided.
Definition at line 130 of file LOW_link.cpp. References byteVec_t, and LOW_link::touchBlock(). Referenced by LOW_devDS2890::cmd_ReadControlRegister(), LOW_devDS2890::cmd_ReadPosition(), LOW_netSegment::cmd_ReadROM(), LOW_devDS1820::cmd_ReadScratchpad(), LOW_devDS2406::cmd_ChannelAccess::readData(), and LOW_devDS2406::readMemUniversal(). |
|
Receive 1 bit from the 1-Wire net by previously sending one bit of read communication to the 1-Wire net. A default implementation relying on the touch methods is provided.
Definition at line 114 of file LOW_link.cpp. References LOW_link::touchBit(). Referenced by LOW_devDS1820::cmd_ConvertT(), LOW_devDS2405::cmd_MatchRead(), LOW_devDS1820::cmd_ReadPowerSupply(), LOW_devDS1820::cmd_RecallE2(), LOW_devDS2405::cmd_SearchRead(), LOW_devDS2890::cmd_WriteControlRegister(), LOW_devDS2890::cmd_WritePosition(), LOW_link::doSearchSequence(), and LOW_devDS2406::cmd_ChannelAccess::readDataBit(). |
|
Receive 1 byte from the 1-Wire net by previously sending 8 bits of read communication to the 1-Wire net. A default implementation relying on the touch methods is provided.
Definition at line 122 of file LOW_link.cpp. References LOW_link::touchByte(). Referenced by LOW_devDS2406::cmd_ChannelAccess::cmd_ChannelAccess(), LOW_devDS2890::cmd_Decrement(), LOW_devDS2890::cmd_Increment(), LOW_devDS2890::cmd_WriteControlRegister(), LOW_devDS2890::cmd_WritePosition(), LOW_devDS2406::cmd_WriteStatus(), LOW_devDS2406::cmd_ChannelAccess::readDataByte(), and LOW_devDS2406::readMemUniversal(). |
|
Reset all of the devices on the 1-Wire net.
Implements LOW_link. Definition at line 115 of file LOW_linkPassiveSerial.cpp. References LOW_portSerial::B10472_speed, LOW_portSerial::B115200_speed, LOW_portSerial::bit1_stopBit, LOW_portSerial::bit6_size, LOW_portSerial::bit8_size, LOW_portSerial::no_parity, LOW_portSerial::none_flowControl, serialPort, LOW_portSerial::tty_configure(), LOW_portSerial::tty_flush(), LOW_portSerial::tty_readByte(), and LOW_portSerial::tty_write(). Referenced by LOW_linkPassiveSerial(). |
|
Reset the adapter. Note: This does not necessarily include a reset on the 1-Wire net. Whether this is done or net is left to the concrete implementation. Implements LOW_link. Definition at line 104 of file LOW_linkPassiveSerial.cpp. References LOW_portSerial::B115200_speed, LOW_portSerial::bit1_stopBit, LOW_portSerial::bit6_size, LOW_portSerial::no_parity, LOW_portSerial::none_flowControl, serialPort, LOW_portSerial::tty_configure(), and LOW_portSerial::tty_flush(). Referenced by LOW_linkPassiveSerial(). |
|
Execute a complete search sequence from preloaded ID vector. Search is executed on the currently active bus configuration. No branch selection is done in advance. A default implementation relying on the doSearchSequence() method is provided.
Reimplemented in LOW_linkDS2490. Definition at line 185 of file LOW_link.cpp. References LOW_device::anyDev_famCode, LOW_deviceID::deviceIDVec_t, LOW_link::doSearchSequence(), LOW_deviceIDRaw::getBit(), LOW_deviceIDRaw::getFamilyCode(), LOW_link::resetBus(), LOW_device::SearchAlarmROM_COMMAND, LOW_device::SearchROM_COMMAND, LOW_deviceIDRaw::setBit(), LOW_deviceIDRaw::setFamilyCode(), and LOW_link::writeData(). Referenced by LOW_netSegment::cmd_SearchROM(), and LOW_netSegment::cmd_SearchROMVerify(). |
|
Set the 1-Wire net line level to strong pullup for a specified time. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implements LOW_link. Definition at line 172 of file LOW_linkPassiveSerial.cpp. References LOW_platformMisc::secSleep(), and strongPullupEmuTime. |
|
Set the 1-Wire net line level to strong pullup for a specified time. Note: Dependening on the implementation, time may only as accurate as the operating system permits (scheduling!).
Implements LOW_link. Definition at line 164 of file LOW_linkPassiveSerial.cpp. References LOW_platformMisc::secSleep(), and strongPullupEmuTime. Referenced by touchBit(), and touchByte(). |
|
Send 1 bit of communication to the 1-Wire net and return the result 1 bit read from the 1-Wire net.
Implements LOW_link. Definition at line 54 of file LOW_linkPassiveSerial.cpp. References serialPort, strongPullup(), LOW_portSerial::tty_flush(), LOW_portSerial::tty_readByte(), and LOW_portSerial::tty_write(). Referenced by touchByte(). |
|
Send block of communication to the 1-Wire net and return the resulting bytes read from the 1-Wire net. A default implementation relying on the touchByte() method is provided. Note: When the strong pullup is selected it will NOT appear after each byte sent, only after the last byte the pullup is done!
Reimplemented in LOW_linkDS2480B, and LOW_linkDS2490. Definition at line 92 of file LOW_link.cpp. References byteVec_t, LOW_link::pullUp_NONE, and LOW_link::touchByte(). Referenced by LOW_link::readData(), and LOW_link::writeData(). |
|
Send 8 bits of communication to the 1-Wire net and return the result 8 bits read from the 1-Wire net.
Implements LOW_link. Definition at line 81 of file LOW_linkPassiveSerial.cpp. References strongPullup(), and touchBit(). |
|
Send block of bytes to the 1-Wire net and verify that the bytes block read from the 1-Wire net are the same (bus write operation). A default implementation relying on the touch methods is provided. Note: When the strong pullup is selected it will NOT appear after each byte sent, only after the last byte the pullup is done!
Definition at line 166 of file LOW_link.cpp. References byteVec_t, and LOW_link::touchBlock(). |
|
Send 1 byte to the 1-Wire net and verify that the byte read from the 1-Wire net is the same (bus write operation). A default implementation relying on the touch methods is provided.
Definition at line 157 of file LOW_link.cpp. References LOW_link::touchByte(). |
|
|
Wether the program pulse should be allowed.
Definition at line 460 of file LOW_link.h. Referenced by LOW_link::getAllowProgPulse(), programPulse(), LOW_linkDS2490::programPulse(), LOW_linkDS2480B::programPulse(), and LOW_linkDS2490::resetLinkAdapter(). |
|
Wether the attached bus supplies external power.
Definition at line 459 of file LOW_link.h. Referenced by LOW_link::getHasExternalPower(). |
|
Wether the adapter is capable of 12V Program pulse.
Definition at line 458 of file LOW_link.h. Referenced by LOW_link::getHasProgramPulse(), programPulse(), LOW_linkDS2490::programPulse(), LOW_linkDS2480B::programPulse(), LOW_linkDS2480B::resetBus(), and LOW_linkDS2490::resetLinkAdapter(). |
|
Individual ID of the link adapter.
Definition at line 457 of file LOW_link.h. Referenced by LOW_link::getID(), and LOW_link::operator==(). |
|
The serial port the adapter is attached to.
Definition at line 102 of file LOW_linkPassiveSerial.h. Referenced by LOW_linkPassiveSerial(), resetBus(), resetLinkAdapter(), touchBit(), and ~LOW_linkPassiveSerial(). |
|
Time to wait for emulation of strong pullup in seconds.
Definition at line 94 of file LOW_linkPassiveSerial.h. Referenced by strongPullup(). |