UniSet  2.6.0
SViewer.h
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 //--------------------------------------------------------------------------------
00021 //--------------------------------------------------------------------------------
00022 #ifndef _SVIEWER_H
00023 #define _SVIEWER_H
00024 //--------------------------------------------------------------------------------
00025 #include <string>
00026 #include <memory>
00027 #include "IOController_i.hh"
00028 #include "ObjectRepository.h"
00029 #include "UInterface.h"
00030 #include "PassiveTimer.h"
00031 //--------------------------------------------------------------------------------
00032 namespace uniset
00033 {
00034 
00035 class SViewer
00036 {
00037     public:
00038 
00039         explicit SViewer(const std::string& ControllersSection, bool isShortName = true);
00040         virtual ~SViewer();
00041 
00042         void view();
00043         void monitor( timeout_t timeoutMS = 500 );
00044 
00045     protected:
00046         void readSection(const std::string& sec, const std::string& secRoot);
00047         void getInfo(uniset::ObjectId id);
00048 
00049         virtual void updateSensors( IOController_i::SensorInfoSeq_var& amap, uniset::ObjectId oid );
00050         virtual void updateThresholds( IONotifyController_i::ThresholdsListSeq_var& tlst, uniset::ObjectId oid );
00051 
00052         const std::string csec;
00053         void printInfo(uniset::ObjectId id, const std::string& sname, long value, const std::string& supplier,
00054                        const std::string& txtname, const std::string& iotype);
00055 
00056         std::shared_ptr<UInterface> ui;
00057 
00058     private:
00059         ObjectRepository rep;
00060         bool isShortName = { true };
00061 
00062 };
00063 // -------------------------------------------------------------------------
00064 } // end of uniset namespace
00065 // --------------------------------------------------------------------------
00066 #endif
00067 // --------------------------------------------------------------------------