UniSet  2.6.0
IOController_i.idl
00001 /*
00002  * Copyright (c) 2015 Pavel Vainerman.
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU Lesser General Public License as
00006  * published by the Free Software Foundation, version 2.1.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00011  * Lesser General Lesser Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00015  */
00016 // --------------------------------------------------------------------------
00020 // --------------------------------------------------------------------------
00021 #ifndef BaseIOController_i_IDL_
00022 #define BaseIOController_i_IDL_
00023 // --------------------------------------------------------------------------
00024 #include "../UniSetTypes/UniSetTypes_i.idl"
00025 #include "../UniSetTypes/UniSetManager_i.idl"
00026 // --------------------------------------------------------------------------------------------------------------
00027 
00033 interface IOController_i : UniSetManager_i
00034 {
00035     // исключения
00036 
00038     exception NameNotFound
00039     {
00040         string err;
00041     };
00042 
00043     exception IOBadParam
00044     {
00045         string err;
00046     };
00047 
00051     exception Undefined
00052     {
00053     };
00054 
00056     struct SensorInfo
00057     {
00058         uniset::ObjectId id;    
00059         uniset::ObjectId node;  
00060     };
00061 
00062     long getValue(in uniset::ObjectId sid) raises(NameNotFound,Undefined);
00063     void setValue(in uniset::ObjectId sid, in long value,
00064                     in uniset::ObjectId sup_id) raises(NameNotFound,Undefined);
00065 
00066     // установка неопределённого состояния
00067     // (пока работает только для аналоговых датчиков)
00068     void setUndefinedState(in uniset::ObjectId sid, in boolean undefined, in uniset::ObjectId sup_id )
00069                             raises(NameNotFound);
00070 
00071     UniversalIO::IOType getIOType(in uniset::ObjectId sid) raises(NameNotFound);
00072 
00073     // --- Интерфейс для конфигурирования ---
00074 
00076     long getRawValue( in uniset::ObjectId sid ) raises(NameNotFound);
00077 
00078     struct CalibrateInfo
00079     {
00080         long minRaw;      
00081         long maxRaw;      
00082         long minCal;      
00083         long maxCal;      
00084         short precision;  
00085     };
00086 
00087     void calibrate( in uniset::ObjectId sid, in CalibrateInfo ci, in uniset::ObjectId adminId ) raises(NameNotFound);
00088     CalibrateInfo getCalibrateInfo( in uniset::ObjectId sid ) raises(NameNotFound);
00089 
00090     // --- Интерфес получения информации о всех датчиках ---
00092     struct SensorIOInfo
00093     {
00094         long value;                   
00095         boolean undefined;            
00096         boolean blocked;              
00097         long real_value;              
00098         UniversalIO::IOType type;     
00099         long priority;                
00100         IOController_i::SensorInfo si;
00101         long default_val;             
00102         CalibrateInfo ci;             
00103         unsigned long tv_sec;    
00104         unsigned long tv_nsec;   
00105         uniset::ObjectId supplier;  
00106         boolean dbignore;             
00107     };
00108 
00109     typedef sequence<SensorIOInfo> SensorInfoSeq;
00110 
00111     SensorInfoSeq getSensorsMap();
00112     SensorIOInfo getSensorIOInfo( in uniset::ObjectId sid ) raises(NameNotFound);
00113 
00114     // -- Функции работы со списком датчиков --
00115 
00117     SensorInfoSeq getSensorSeq( in uniset::IDSeq lst );
00118 
00120     struct OutInfo
00121     {
00122         SensorInfo si;    
00123         long value;       
00124     };
00125 
00126     typedef sequence<OutInfo> OutSeq;
00127 
00133     uniset::IDSeq setOutputSeq( in OutSeq lst, in uniset::ObjectId sup_id );
00134 
00135 
00137     struct ShortIOInfo
00138     {
00139         long value;
00140 
00141         // могут быть проблеммы в 64bit-ных
00142         unsigned long tv_sec;    
00143         unsigned long tv_nsec;   
00144         uniset::ObjectId supplier; 
00145     };
00146 
00147     ShortIOInfo getTimeChange( in uniset::ObjectId sid ) raises(NameNotFound);
00148 
00149 
00151     struct ShortMap
00152     {
00153         UniversalIO::IOType type;
00154         long value;
00155         long id;
00156     };
00157 
00158     typedef sequence<ShortMap> ShortMapSeq;
00159 
00160     ShortMapSeq getSensors();
00161 };
00162 
00163 // --------------------------------------------------------------------------------------------------------------
00173 interface IONotifyController_i : IOController_i
00174 {
00176     exception BadRange
00177     {
00178     };
00179 
00183     void askSensor(in uniset::ObjectId sid, in uniset::ConsumerInfo ci, in UniversalIO::UIOCommand cmd ) raises(NameNotFound,IOBadParam);
00184 
00190     uniset::IDSeq askSensorsSeq( in uniset::IDSeq lst,
00191                                         in uniset::ConsumerInfo ci,
00192                                         in UniversalIO::UIOCommand cmd );
00193 
00194 
00196     enum ThresholdState
00197     {
00198         LowThreshold,       
00199         NormalThreshold,    
00200         HiThreshold         
00201     };
00202 
00203     struct ThresholdInfo
00204     {
00205         uniset::ThresholdId id;
00206         long hilimit;         
00207         long lowlimit;        
00208         ThresholdState state;
00209         unsigned long tv_sec;    
00210         unsigned long tv_nsec;   
00211         boolean invert;       
00212     };
00213 
00214     typedef sequence<ThresholdInfo> ThresholdInfoSeq;
00215 
00225     void askThreshold(in uniset::ObjectId sid, in uniset::ConsumerInfo ci, in uniset::ThresholdId tid,
00226                         in long lowLimit, in long hiLimit, in boolean invert,
00227                         in UniversalIO::UIOCommand cmd ) raises(NameNotFound, IOBadParam, BadRange);
00228 
00229 
00233     ThresholdInfo getThresholdInfo( in uniset::ObjectId sid, in uniset::ThresholdId tid ) raises(NameNotFound);
00234 
00235     struct ThresholdList
00236     {
00237         IOController_i::SensorInfo si;
00238         UniversalIO::IOType type;
00239         long value;
00240         ThresholdInfoSeq tlist;
00241     };
00242 
00243     typedef sequence<ThresholdList> ThresholdsListSeq;
00244 
00246     ThresholdList getThresholds( in uniset::ObjectId sid ) raises(NameNotFound);
00247 
00249     ThresholdsListSeq getThresholdsList();
00250 };
00251 // --------------------------------------------------------------------------
00252 #endif