Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Related Pages  

LOW_devDS2405.h

Go to the documentation of this file.
00001 /***************************************************************************
00002                           LOW_devDS2405.h  -  description
00003                              -------------------
00004     begin                : Tue Aug 20 2002
00005     copyright            : (C) 2002 by Harald Roelle, Helmut Reiser
00006     email                : roelle@informatik.uni-muenchen.de, reiser@informatik.uni-muenchen.de
00007  ***************************************************************************/
00008 
00009 /***************************************************************************
00010  *                                                                         *
00011  *   This program is free software; you can redistribute it and/or modify  *
00012  *   it under the terms of the GNU General Public License as published by  *
00013  *   the Free Software Foundation; either version 2 of the License, or     *
00014  *   (at your option) any later version.                                   *
00015  *                                                                         *
00016  ***************************************************************************/
00017 
00018 #ifndef LOW_DEVDS2405_H
00019 #define LOW_DEVDS2405_H
00020 
00021 
00022 
00023 #include "LOW_device.h"
00024 #include "LOW_helper_crc.h"
00025 
00026 
00027 
00028 /** Device class for DS2405 Addressable Switch.
00029 
00030     DS2405 features:
00031 
00032     - Open-drain PIO pin is controlled by matching 64-bit, laser-engraved registration number
00033       associated with each device
00034     - Logic level of open drain output can be determined over 1-Wire bus for closed-loop control
00035     - PIO pin sink capability is greater than 4mA at 0.4V
00036     - Multiple DS2405s can be identified on a common 1-Wire bus and be turned on or off independent
00037       of other devices on the bus
00038     - Unique, factory-lasered and tested 64-bit registration number (8-bit family code +48- bit serial
00039       number +8-bit CRC tester) assures absolute identity because no two parts are alike
00040     - Built-in multidrop controller ensures compatibility with other MicroLAN products
00041     - Reduces control, address, data, and power to a single data pin
00042     - Directly connects to a single port pin of a microprocessor and communicates at up to 16.3kbits/s
00043     - 8-bit family code specifies DS2405 communications requirements to reader
00044     - 8-bit cyclic redundancy check ensures errorfree selection
00045     - Zero standby power required
00046     - Low cost TO-92, SOT-223, or 6-pin TSOC surface mount package
00047     - 1-Wire communication operates over a wide voltage range of 2.8V to 6.0V from -40°C to +85°C
00048 
00049     @author Harald Roelle, Helmut Reiser
00050  */
00051 class LOW_devDS2405 : public LOW_device  {
00052 
00053 //=======================================================================================
00054 public: 
00055 
00056   //=====================================================================================
00057   //
00058   // exceptions
00059   //
00060 
00061   /** Exception base class for all exceptions thrown by LOW_devDS2405. */
00062   class_DERIVE_FROM_EXCEPTION( devDS2405_error, LOW_exception);
00063 
00064 
00065 
00066   //=====================================================================================
00067   //
00068   // constants
00069   //
00070   
00071   /** Family code of this specific device. */
00072   static const LOW_deviceIDRaw::devFamCode_t  familyCode = 0x05;
00073 
00074   /** Family name of this specific device. */
00075   static const string familyName;
00076 
00077   
00078   //=====================================================================================
00079   //
00080   // type definitions
00081   //
00082   
00083   typedef std::vector<LOW_devDS2405*> devDS2405PtrVec_t;    /**< Vector type of class device pointers. */
00084   
00085     
00086   //=====================================================================================
00087   //
00088   // constructors
00089   //
00090   
00091   /** Real constructor corresponding to static pseudo constructor new_Instance().
00092       @param  inSegment  Reference to network segment the device is on.
00093       @param  inDevID    Reference to device's ID.
00094    */
00095   LOW_devDS2405( LOW_netSegment &inSegment, const LOW_deviceID &inDevID);
00096 
00097   /** Destructor.
00098    */
00099   ~LOW_devDS2405();
00100 
00101   
00102   //=====================================================================================
00103   //
00104   // methods
00105   //
00106 
00107   /** Get the device's family name.
00108       @return Family name of the device.
00109    */
00110   virtual string getFamilyName() const { return familyName; };
00111   
00112 
00113   /** Toggle the state of the PIO pin.
00114    */
00115   void cmd_Match() const;
00116  
00117    
00118   /** Toggle the state of the PIO pin and read its new state.
00119       
00120       <B>Note:</B> The return value is <B>inverted</B> compared to @ref cmd_SearchActive().
00121       
00122       @return  false, if the device IS driving the PIO pin low.
00123                true,  if the device is NOT driving the PIO pin low.
00124    */
00125   bool cmd_MatchRead() const;
00126   
00127   
00128   /** Read the logic state of the PIO pin (input).
00129 
00130       The device will not toggle the state of its PIO pin.
00131       The combination of Match ROM and Search ROM allows the user to change the state
00132       of the PIO pin and report the current state (Match ROM) or simply report the 
00133       current state of the PIO pin without changing it (Search ROM).
00134         
00135       @return  false, if the pulldown is on,
00136                       or the pulldown is off and the PIO pin is a logical 0.<BR>
00137                true,  if the pulldown is off and the PIO pin is a logical 1 (i.e. external pullup).
00138   */
00139   bool cmd_SearchRead() const;
00140 
00141     
00142   /** Read if the output pulldown is turned on.
00143       
00144       The device will not toggle the state of its PIO pin.
00145  
00146       <B>Note:</B> The return value is <B>inverted</B> compared to @ref cmd_MatchActive().
00147       
00148       @return  false, if the device is NOT driving the PIO pin low.
00149                true,  if the device IS driving the PIO pin low.
00150  
00151   */
00152   bool cmd_SearchActive() const;
00153 
00154   
00155 
00156 //=======================================================================================
00157 protected:
00158 
00159   //=====================================================================================
00160   //
00161   // static methods
00162   //
00163   
00164   /** Static pseudo constructor for registering with LOW_deviceFactory.
00165       @param  inSegment  Reference to network segment the device is on.
00166       @param  inDevID    Reference to device's ID.
00167       @return  New dynamic instance of specific device class.
00168    */
00169   static LOW_device* new_Instance( LOW_netSegment &inNetSegment, const LOW_deviceID &inDevID);
00170 
00171   
00172   
00173 //=======================================================================================
00174 private:
00175 
00176   //=====================================================================================
00177   //
00178   // static initializer
00179   //
00180   
00181   /** Needed for dirty little C++ hack to force static initialization on application start.
00182       @see initialize()
00183   */
00184   static int initHelper;
00185 
00186   /** Static inizializer to register the class with LOW_deviceFactory.
00187       @see initHelper
00188   */
00189   static int initialize();
00190     
00191 };
00192 
00193 #endif

Generated on Sun Jan 12 21:07:43 2003 by doxygen1.2.13.1 written by Dimitri van Heesch, © 1997-2001