UniSet  1.4.0
IOController_i.idl
См. документацию.
00001 /* This file is part of the UniSet project
00002  * Copyright (c) 2002 Free Software Foundation, Inc.
00003  * Copyright (c) 2002 Pavel Vainerman
00004  *
00005  * This program is free software; you can redistribute it and/or modify
00006  * it under the terms of the GNU General Public License as published by
00007  * the Free Software Foundation; either version 2 of the License, or
00008  * (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00018  */
00019 // --------------------------------------------------------------------------
00025 // --------------------------------------------------------------------------
00026 #ifndef BaseIOController_i_IDL_
00027 #define BaseIOController_i_IDL_
00028 // --------------------------------------------------------------------------
00029 #include "../UniSetTypes/UniSetTypes_i.idl"
00030 #include "../UniSetTypes/ObjectsManager_i.idl"
00031 // --------------------------------------------------------------------------------------------------------------
00032 
00038 interface IOController_i : ObjectsManager_i 
00039 {
00040     // исключения
00041     
00043     exception NameNotFound
00044     {   
00045         string err;
00046     };
00047 
00048     exception IOBadParam
00049     {   
00050         string err;
00051     };
00052 
00053 
00057     exception Undefined
00058     {   
00059     };
00060 
00061 
00063     struct SensorInfo
00064     {
00065         UniSetTypes::ObjectId id;   
00066         UniSetTypes::ObjectId node; 
00067     };
00068 
00069     boolean getState(in SensorInfo si) raises(NameNotFound,Undefined);
00070     long getValue(in SensorInfo si) raises(NameNotFound,Undefined);
00071     void setState(in SensorInfo si, in boolean state,
00072                     in UniSetTypes::ObjectId sup_id) raises(NameNotFound);
00073     void setValue(in SensorInfo si, in long value,
00074                     in UniSetTypes::ObjectId sup_id) raises(NameNotFound);
00075 
00076     void saveState(in SensorInfo si, in boolean state, in UniversalIO::IOTypes type,
00077                         in UniSetTypes::ObjectId sup_id) raises(IOBadParam,NameNotFound);
00078     void saveValue(in SensorInfo si, in long value, in UniversalIO::IOTypes type, 
00079                         in UniSetTypes::ObjectId sup_id) raises(IOBadParam,NameNotFound);
00080 
00081     // установка неопределённого состояния
00082     // (пока работает только для аналоговых датчиков)
00083     void setUndefinedState(in SensorInfo si, in boolean undefined, in UniSetTypes::ObjectId sup_id ) 
00084                             raises(NameNotFound);
00085 
00086     // fast version (не вырабатывает исключения)
00087     oneway void fastSaveState(in SensorInfo si, in boolean state, in UniversalIO::IOTypes type,
00088                         in UniSetTypes::ObjectId sup_id);
00089     oneway void fastSaveValue(in SensorInfo si, in long value, in UniversalIO::IOTypes type, 
00090                         in UniSetTypes::ObjectId sup_id);
00091 
00092     oneway void fastSetState(in SensorInfo si, in boolean state, in UniSetTypes::ObjectId sup_id);
00093     oneway void fastSetValue(in SensorInfo si, in long value, in UniSetTypes::ObjectId sup_id);
00094 
00095     UniversalIO::IOTypes getIOType(in SensorInfo si) raises(NameNotFound);
00096 
00097     // --- Интерфейс для конфигурирования ---
00098 
00100     long getRawValue( in SensorInfo si ) raises(NameNotFound);
00101     
00102     struct CalibrateInfo
00103     {
00104         long minRaw;        
00105         long maxRaw;        
00106         long minCal;        
00107         long maxCal;        
00108         long sensibility;   
00109         short precision;    
00110     };
00111 
00112     void calibrate( in SensorInfo si, in CalibrateInfo ci, in UniSetTypes::ObjectId adminId ) raises(NameNotFound);
00113     CalibrateInfo getCalibrateInfo( in SensorInfo si ) raises(NameNotFound);
00114 
00115     // --- Интерфес получения информации о всех датчиках ---
00116 
00118     struct DigitalIOInfo
00119     {
00120         boolean state;              
00121         boolean undefined;          
00122         boolean blocked;            
00123         boolean real_state;         
00124         UniversalIO::IOTypes type;  
00125         long priority;              
00126         IOController_i::SensorInfo si;
00127         boolean default_val;        
00128         long tv_sec;    
00129         long tv_usec;   
00130     };
00131 
00133     struct AnalogIOInfo
00134     {
00135         long value;                 
00136         boolean undefined;          
00137         boolean blocked;            
00138         long real_value;            
00139         UniversalIO::IOTypes type;  
00140         long priority;              
00141         IOController_i::SensorInfo si;
00142         long default_val;           
00143         CalibrateInfo ci;           
00144         long tv_sec;                
00145         long tv_usec;               
00146     };
00147 
00148     typedef sequence<AnalogIOInfo> ASensorInfoSeq;
00149     typedef sequence<DigitalIOInfo> DSensorInfoSeq;
00150 
00151     ASensorInfoSeq getAnalogSensorsMap();
00152     DSensorInfoSeq getDigitalSensorsMap();  
00153     
00154     DigitalIOInfo getDInfo(in SensorInfo si) raises(NameNotFound);
00155     AnalogIOInfo getAInfo(in SensorInfo si) raises(NameNotFound);
00156 
00157 
00158     // -- Функции работы со списком датчиков --
00159     
00160     // Для простоты функции сделаны универсальными и не различающими
00161     // дискретные или аналоговые датчики или выходы
00162 
00163 
00168     ASensorInfoSeq getSensorSeq( in UniSetTypes::IDSeq lst );
00169 
00171     struct OutInfo
00172     {
00173         SensorInfo si;  
00174         long value;     
00175     };
00176 
00177     typedef sequence<OutInfo> OutSeq;
00178 
00184     UniSetTypes::IDSeq setOutputSeq( in OutSeq lst, in UniSetTypes::ObjectId sup_id );
00185 
00186 
00188     struct ShortIOInfo
00189     {
00190         long value;
00191         long tv_sec;    
00192         long tv_usec;   
00193     };
00194 
00195     ShortIOInfo getChangedTime(in SensorInfo si) raises(NameNotFound);
00196 
00197 
00199     struct ShortMap
00200     {
00201         UniversalIO::IOTypes type;
00202         long value;
00203         long id;
00204     };
00205 
00206     typedef sequence<ShortMap> ShortMapSeq;
00207 
00208     ShortMapSeq getSensors();
00209 };
00210 
00211 // --------------------------------------------------------------------------------------------------------------
00221 interface IONotifyController_i : IOController_i
00222 {
00224     exception BadRange
00225     {   
00226     };
00227 
00228 
00232     void askState(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
00233 
00237     void askValue(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
00238 
00243     void askSensor(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
00244 
00255     void askThreshold(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniSetTypes::ThresholdId tid,
00256                         in long lowLimit, in long hiLimit, in long sensibility,
00257                         in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange);
00258 
00259 
00264     void askOutput(in SensorInfo si, in UniSetTypes::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
00265 
00266 
00272     UniSetTypes::IDSeq askSensorsSeq( in UniSetTypes::IDSeq lst, 
00273                                         in UniSetTypes::ConsumerInfo ci,
00274                                         in UniversalIO::UIOCommand cmd );
00275 
00276 
00278     enum ThresholdState
00279     {
00280         LowThreshold,       
00281         NormalThreshold,    
00282         HiThreshold         
00283     };
00284 
00285     struct ThresholdInfo
00286     {
00287         UniSetTypes::ThresholdId id;
00288         long hilimit;           
00289         long lowlimit;          
00290         long sensibility;       
00291         ThresholdState state;   
00292         long tv_sec;            
00293         long tv_usec;           
00294         boolean inverse;        
00295     };
00296 
00297     typedef sequence<ThresholdInfo> ThresholdInfoSeq;
00298     
00299     
00300     struct ThresholdList
00301     {
00302         IOController_i::SensorInfo si;
00303         UniversalIO::IOTypes type;
00304         long value;
00305         ThresholdInfoSeq tlist;
00306     };
00307     
00308     typedef sequence<ThresholdList> ThresholdsListSeq;
00309     ThresholdsListSeq getThresholdsList();
00310 
00311 };
00312 // --------------------------------------------------------------------------
00313 #endif