#include <LOW_netSegment.h>
Inheritance diagram for LOW_netSegment:
Public Types | |
typedef LOW_objectIDFactory::objectID_t | segmentID_t |
segment ID type | |
typedef std::vector< LOW_netSegment * > | netSegPtrVec_t |
Vector type of class pointers. | |
Public Member Functions | |
virtual LOW_link & | getLink () |
Get the LOW_link instance associated with this segment. | |
virtual bool | getHasExternalPower () const |
Get wether there is an external power line on the segment. | |
template<class devType> devType * | getDevice (const LOW_deviceID inDevID) |
Get a specific device. | |
template<class devType> std::vector< devType * > | getDevices () const |
Get devices of a specific type. | |
template<class devType> std::vector< devType * > | searchDevices (const bool inOnlyAlarm=false) |
Search for devices on the segment. | |
virtual bool | verifyDevice (const LOW_deviceID inDevID, const bool inOnlyAlarm=false, const bool inDoReset=true) |
Verify existance of a specific device on the segment. | |
Protected Member Functions | |
virtual | ~LOW_netSegment () |
Destructor. | |
virtual void | unregisterDevice (const LOW_device *inDev) |
Indicate that a device instance is going to be deleted. | |
virtual void | cmd_MatchROM (const LOW_device *inDevice) const |
Select a single device on a link. | |
virtual void | cmd_SkipROM () const |
Select all devices on a link. | |
virtual LOW_deviceID | cmd_ReadROM () const |
Read ID number from bus. | |
virtual LOW_deviceID::deviceIDVec_t | cmd_SearchROM (const bool inOnlyAlarm=false, const LOW_deviceIDRaw::devFamCode_t inFamCode=LOW_device::anyDev_famCode) const |
Scan the bus for devices. | |
virtual bool | cmd_SearchROMVerify (const LOW_deviceID inDevID, const bool inOnlyAlarm=false, const bool inDoReset=true) const |
Scan the bus for a specific device. | |
Static Protected Member Functions | |
netSegPtrVec_t | newSegmentsFromLink (LOW_link &inLink) |
Discovers network segments on a link. | |
Static Protected Attributes | |
LOW_thread_rwlock * | __staticSyncRwlockSingleton = 0 |
LOW_platformMiscFactory::threadIdent_t | __writeLockHolder = 0 |
Private Member Functions | |
LOW_netSegment (LOW_link &inLink) | |
Constructor from link. | |
virtual bool | operator== (LOW_netSegment &inSegment) const |
Comparison based on segmentID. | |
template<class castType> castType * | devicePtr_cast (LOW_device *inPtr) const |
Safely cast a generic device pointer to a specific one. | |
virtual void | buryDevice (const LOW_device *inDev) |
Move a device from the alive map to the graveyard. | |
virtual void | revitalizeDevice (const LOW_device *inDev) |
Move a device from the graveyard to the alive map. | |
virtual LOW_device * | addDevice (const LOW_deviceID inDevID) |
Add a device to the alive map. | |
virtual void | removeDevice (const LOW_device *inDev) |
Removes a device from either the alive map or the graveyard. | |
Private Attributes | |
const segmentID_t | segmentID |
Identifier of the segment. | |
LOW_link & | link |
Link this segment is present on. | |
bool | hasExternalPower |
Whether there is an additional line for external power supply available. | |
LOW_device::deviceMap_t | aliveDevMap |
Map of currently present devices on the segment. | |
LOW_device::deviceMap_t | graveyardMap |
Map of formerly present devices on the segment. | |
Friends | |
class | LOW_network |
Enable access to static pseudo constructor and destructor. | |
class | LOW_device |
Enable access to unregister a device on destruction. |
The class models a single segment reachable by a concrete link of the 1-Wire network.
Objects for devices are automatically instanciated via LOW_deviceFactory. The objects are cached in two maps:
This means, that once a device is not visible any more, the device object is not deleted but burried on the graveyard. Once the device is visible again, it is revitalized.
This class is thread-safe.
Parts of the documentation by Dallas Semiconductors / Maxim Integrated Products
Definition at line 55 of file LOW_netSegment.h.
|
Vector type of class pointers.
Definition at line 80 of file LOW_netSegment.h. Referenced by LOW_network::addSegments(), LOW_network::getSegments(), LOW_network::network_error::network_error(), and newSegmentsFromLink(). |
|
segment ID type
Definition at line 78 of file LOW_netSegment.h. |
|
Destructor. Destroys all objects of devices (in both maps). Definition at line 48 of file LOW_netSegment.cpp. References aliveDevMap, and graveyardMap. |
|
Constructor from link. Triggers initial search of devices on the segment.
Definition at line 36 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE__, LOW_link::getHasExternalPower(), hasExternalPower, and link. Referenced by newSegmentsFromLink(). |
|
Add a device to the alive map. When the device is already in the alive map nothing is done. When it is on the graveyard, it is moved to the alive map. When it does not exist at all, a new instance is created.
Definition at line 277 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, aliveDevMap, graveyardMap, LOW_deviceFactory::new_SpecificDevice(), and revitalizeDevice(). Referenced by searchDevices(), and verifyDevice(). |
|
Move a device from the alive map to the graveyard. If not in alive map, the method returns silently.
Definition at line 241 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, aliveDevMap, LOW_device::getID(), and graveyardMap. Referenced by searchDevices(). |
|
Select a single device on a link. The matchROM command followed by a 64-bit ROM code sequence allows the bus master to address a specific slave device on a multidrop or single-drop bus. Only the slave that exactly matches the 64-bit ROM code sequence will respond to the function command issued by the master; all other slaves on the bus will wait for a reset pulse.
Definition at line 160 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, byteVec_t, LOW_device::getID(), LOW_deviceIDRaw::getRomIDVec(), link, LOW_device::MatchROM_COMMAND, LOW_link::resetBus(), and LOW_link::writeData(). Referenced by LOW_device::cmd_MatchROM(). |
|
Read ID number from bus. The read ROM command allows the bus master to read the slave's 64-bit ROM code without using the Search ROM procedure. Note: The read ROM command can only be used when there is one slave on the bus. If this command is used when there is more than one slave present on the bus, a data collision will occur when all the slaves attempt to respond at the same time.
Definition at line 180 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ__, byteVec_t, LOW_deviceIDRaw::devRomID_t, link, LOW_link::readData(), LOW_device::ReadROM_COMMAND, LOW_link::resetBus(), and LOW_link::writeData(). |
|
Scan the bus for devices. The searchROM command allows the master to determine the number of slaves and their device types. The master learns the ROM codes through a process of elimination that requires the master to perform a Search ROM cycle (i.e., Search ROM command followed by data exchange) as many times as necessary to identify all of the slave devices. If there is only one slave on the bus, the simpler Read ROM command can be used in place of the Search ROM process. The search can be narrowed to devices which their alarm flag set and/or to specific family codes.
Definition at line 212 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, LOW_deviceID::deviceIDVec_t, link, and LOW_link::searchDevices(). Referenced by searchDevices(). |
|
Scan the bus for a specific device.
Definition at line 221 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, LOW_device::anyDev_famCode, LOW_deviceID::deviceIDVec_t, link, and LOW_link::searchDevices(). Referenced by verifyDevice(). |
|
Select all devices on a link. The master can use this command to address all devices on the bus simultaneously without sending out any ROM code information. For example, the master can make all DS18S20s on the bus perform simultaneous temperature conversions by issuing a Skip ROM command followed by a ConvertT command.
Definition at line 199 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ__, link, LOW_link::resetBus(), LOW_device::SkipROM_COMMAND, and LOW_link::writeData(). |
|
Safely cast a generic device pointer to a specific one. The type to cast to is specified by the template parameter.
Definition at line 484 of file LOW_netSegment.h. |
|
Get a specific device. Devices are searched in the internal device list only. No bus actions are performed. Note::The device type to look for is selected by the template parameter.
Definition at line 411 of file LOW_netSegment.h. References __LOW_SYNCHRONIZE_METHOD_READ__, aliveDevMap, LOW_device::anyDev_famCode, LOW_deviceIDRaw::getFamilyCode(), and LOW_device::unknownDev_famCode. |
|
Get devices of a specific type. Devices are searched in the internal device list only. No bus actions are performed. Selecting any device type will result in the complete list of devices known to be present on the segment. Note:: The device type to look for is selected by the template parameter. To select any device type use LOW_device.
Definition at line 429 of file LOW_netSegment.h. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, aliveDevMap, LOW_device::anyDev_famCode, and LOW_device::unknownDev_famCode. |
|
Get wether there is an external power line on the segment.
Definition at line 106 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, and hasExternalPower. Referenced by LOW_compJalousieController::LOW_compJalousieController(), LOW_compTwinSwitch::LOW_compTwinSwitch(), and LOW_devDS1820::LOW_devDS1820(). |
|
Get the LOW_link instance associated with this segment.
Definition at line 98 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, and link. Referenced by LOW_device::getLink(). |
|
Discovers network segments on a link.
Definition at line 64 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_STATIC_WRITE__, LOW_netSegment(), and netSegPtrVec_t. Referenced by LOW_network::addSegments(). |
|
Comparison based on segmentID.
Definition at line 84 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_READ_WEAK__, and segmentID. |
|
Removes a device from either the alive map or the graveyard. If it does not exist, the method returns silently.
Definition at line 302 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, aliveDevMap, LOW_device::getID(), and graveyardMap. Referenced by unregisterDevice(). |
|
Move a device from the graveyard to the alive map. If not on graveyard, the method returns silently.
Definition at line 259 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, aliveDevMap, LOW_device::getID(), and graveyardMap. Referenced by addDevice(), and verifyDevice(). |
|
Search for devices on the segment. Selecting any device type will result in searching the whole segment. Note:: The device type to look for is selected by the template parameter. To select any device type use LOW_device. Note:: The bus will be actively searched. Newly found devices will be added to the internal device list.
Definition at line 447 of file LOW_netSegment.h. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, addDevice(), buryDevice(), cmd_SearchROM(), LOW_deviceID::deviceIDVec_t, and LOW_device::devPtrVec_t. |
|
Indicate that a device instance is going to be deleted. Function mainly used by the destructor of LOW_device.
Definition at line 146 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, and removeDevice(). Referenced by LOW_device::~LOW_device(). |
|
Verify existance of a specific device on the segment. Note:: In case you already own a reference to the device, use the corresponding method from LOW_device. Note:: The bus will be actively searched. Newly found devices will be added to the internal device list.
Definition at line 114 of file LOW_netSegment.cpp. References __LOW_SYNCHRONIZE_METHOD_WRITE_WEAK__, addDevice(), cmd_SearchROMVerify(), and revitalizeDevice(). Referenced by LOW_device::verifyDevice(). |
|
Enable access to unregister a device on destruction.
Definition at line 174 of file LOW_netSegment.h. |
|
Enable access to static pseudo constructor and destructor.
Definition at line 173 of file LOW_netSegment.h. |
|
Definition at line 28 of file LOW_netSegment.cpp. |
|
Definition at line 28 of file LOW_netSegment.cpp. |
|
Map of currently present devices on the segment.
Definition at line 323 of file LOW_netSegment.h. Referenced by addDevice(), buryDevice(), getDevice(), getDevices(), removeDevice(), revitalizeDevice(), and ~LOW_netSegment(). |
|
Map of formerly present devices on the segment.
Definition at line 324 of file LOW_netSegment.h. Referenced by addDevice(), buryDevice(), removeDevice(), revitalizeDevice(), and ~LOW_netSegment(). |
|
Whether there is an additional line for external power supply available.
Definition at line 322 of file LOW_netSegment.h. Referenced by getHasExternalPower(), and LOW_netSegment(). |
|
Link this segment is present on.
Definition at line 321 of file LOW_netSegment.h. Referenced by cmd_MatchROM(), cmd_ReadROM(), cmd_SearchROM(), cmd_SearchROMVerify(), cmd_SkipROM(), getLink(), and LOW_netSegment(). |
|
Identifier of the segment.
Definition at line 320 of file LOW_netSegment.h. Referenced by operator==(). |