UniSet  2.0.0
SMInterface.h
00001 #ifndef SMInterface_H_
00002 #define SMInterface_H_
00003 //--------------------------------------------------------------------------
00004 #include <string>
00005 #include "UniSetTypes.h"
00006 #include "Mutex.h"
00007 #include "IONotifyController.h"
00008 #include "UInterface.h"
00009 class SMInterface
00010 {
00011     public:
00012 
00013         SMInterface( UniSetTypes::ObjectId _shmID, UInterface* ui,
00014                         UniSetTypes::ObjectId myid, IONotifyController* ic=0 );
00015         ~SMInterface();
00016 
00017         void setValue ( UniSetTypes::ObjectId, long value );
00018         void setUndefinedState( IOController_i::SensorInfo& si, bool undefined, UniSetTypes::ObjectId supplier );
00019 
00020         long getValue ( UniSetTypes::ObjectId id );
00021 
00022         void askSensor( UniSetTypes::ObjectId id, UniversalIO::UIOCommand cmd,
00023                         UniSetTypes::ObjectId backid = UniSetTypes::DefaultObjectId );
00024 
00025         IOController_i::SensorInfoSeq* getSensorsMap();
00026         IONotifyController_i::ThresholdsListSeq* getThresholdsList();
00027 
00028         void localSetValue( IOController::IOStateList::iterator& it,
00029                                 UniSetTypes::ObjectId sid,
00030                                 CORBA::Long newvalue, UniSetTypes::ObjectId sup_id );
00031 
00032           long localGetValue( IOController::IOStateList::iterator& it,
00033                             UniSetTypes::ObjectId sid );
00034 
00039         void localSetUndefinedState( IOController::IOStateList::iterator& it,
00040                                     bool undefined, UniSetTypes::ObjectId sid );
00041 
00042         // специальные функции
00043         IOController::IOStateList::iterator ioEnd();
00044         void initIterator( IOController::IOStateList::iterator& it );
00045 
00046         bool exist();
00047         bool waitSMready( int msec, int pause=5000 );
00048         bool waitSMworking( UniSetTypes::ObjectId, int msec, int pause=3000 );
00049 
00050         inline bool isLocalwork(){ return (ic==NULL); }
00051         inline UniSetTypes::ObjectId ID(){ return myid; }
00052         inline IONotifyController* SM(){ return ic; }
00053         inline UniSetTypes::ObjectId getSMID(){ return shmID; }
00054 
00055     protected:
00056         IONotifyController* ic;
00057         UInterface* ui;
00058         CORBA::Object_var oref;
00059         UniSetTypes::ObjectId shmID;
00060         UniSetTypes::ObjectId myid;
00061         UniSetTypes::uniset_rwmutex shmMutex;
00062 };
00063 
00064 //--------------------------------------------------------------------------
00065 #endif