00001 /*************************************************************************** 00002 LOW_devDS2401.h - description 00003 ------------------- 00004 begin : Sat Nov 8 2003 00005 copyright : (C) 2003 by Harald Roelle 00006 email : roelle@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_DEVDS2401_H 00019 #define LOW_DEVDS2401_H 00020 00021 00022 #include "LOW_device.h" 00023 00024 00025 00026 /** Device class for DS2401 Silicon Serial Number. 00027 00028 DS2401 features: 00029 00030 - Upgrade and drop-in replacement for DS2400 00031 - Extended 2.8 to 6.0 voltage range 00032 - Multiple DS2401s can reside on a common 1-Wire Net 00033 - Unique, factory-lasered and tested 64-bit registration number; guaranteed no two parts alike 00034 - Built-in multidrop controller ensures compatibility with other 1-Wire Net products 00035 - 8-bit family code specifies DS2401 communications requirements to reader 00036 - Presence Pulse acknowledges when the reader first applies voltage 00037 - Low-cost TO-92, SOT-223, and TSOC surface mount packages 00038 - Reduces control, address, data, and power to a single pin 00039 - Zero standby power required 00040 - Directly connects to a single port pin of a microprocessor and communicates at up to 16.3kbits/s 00041 - TO-92 Tape & Reel version with leads bent to 100mil spacing (default) or with straight leads (DS2401T-SL) 00042 - Applications: PCB Identification, Network Node ID, Equipment Registration 00043 - Operates over industrial temperature range of -40°C to +85°C 00044 00045 This class is thread-safe. 00046 00047 @author Harald Roelle 00048 @author Parts of the documentation by Dallas Semiconductors / Maxim Integrated Products 00049 */ 00050 class LOW_devDS2401 : public LOW_device { 00051 00052 //======================================================================================= 00053 public: 00054 00055 //===================================================================================== 00056 // 00057 // type definitions 00058 // 00059 00060 typedef std::vector<LOW_devDS2401*> devDS2401PtrVec_t; /**< Vector type of class device pointers. */ 00061 00062 00063 //===================================================================================== 00064 // 00065 // constants 00066 // 00067 00068 /** Family code of this specific device. */ 00069 static const LOW_deviceIDRaw::devFamCode_t familyCode = 0x01; 00070 00071 /** Family name of this specific device. */ 00072 static const std::string familyName; 00073 00074 00075 //===================================================================================== 00076 // 00077 // constructors 00078 // 00079 00080 /** Real constructor corresponding to static pseudo constructor new_Instance(). 00081 00082 External power supply status is initially detected here. 00083 00084 @param inSegment Reference to network segment the device is on. 00085 @param inDevID Reference to device's ID. 00086 */ 00087 LOW_devDS2401( LOW_netSegment &inSegment, const LOW_deviceID &inDevID); 00088 00089 00090 /** Destructor. 00091 */ 00092 virtual ~LOW_devDS2401(); 00093 00094 00095 //===================================================================================== 00096 // 00097 // methods 00098 // 00099 00100 /** Get the device's family code. 00101 <B>Note:</B> Subclasses must implement this method to return their specific family code. 00102 @return Family name of the device. 00103 */ 00104 virtual const LOW_deviceIDRaw::devFamCode_t getFamilyCode() const { return familyCode; }; 00105 00106 /** Get the device's family name. 00107 <B>Note:</B> Subclasses must implement this method to return a clear text 00108 name of their family. 00109 @return Family name of the device. 00110 */ 00111 virtual const std::string getFamilyName() const { return familyName; }; 00112 00113 00114 00115 //======================================================================================= 00116 protected: 00117 00118 //===================================================================================== 00119 // 00120 // static methods 00121 // 00122 00123 /** Static pseudo constructor for registering with LOW_deviceFactory. 00124 @param inSegment Reference to network segment the device is on. 00125 @param inDevID Reference to device's ID. 00126 @return New dynamic instance of specific device class. 00127 */ 00128 static LOW_device* new_Instance( LOW_netSegment &inNetSegment, const LOW_deviceID &inDevID); 00129 00130 00131 00132 //======================================================================================= 00133 private: 00134 00135 //===================================================================================== 00136 // 00137 // static initializer 00138 // 00139 00140 /** Needed for dirty little C++ hack to force static initialization on application start. 00141 @see initialize() 00142 */ 00143 static int initHelper; 00144 00145 /** Static inizializer to register the class with LOW_deviceFactory. 00146 @see initHelper 00147 */ 00148 static int initialize(); 00149 00150 }; 00151 00152 #endif