UniSet  2.6.0
UConnector.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 // -------------------------------------------------------------------------
00017 #ifndef UConnector_H_
00018 #define UConnector_H_
00019 // --------------------------------------------------------------------------
00020 #include <memory>
00021 #include <string>
00022 #include "Configuration.h"
00023 #include "UInterface.h"
00024 #include "UTypes.h"
00025 #include "UExceptions.h"
00026 #include "UniSetActivator.h"
00027 // --------------------------------------------------------------------------
00028 class UConnector
00029 {
00030     public:
00031         UConnector( int argc, char** argv, const std::string& xmlfile ) throw(UException);
00032         UConnector( UTypes::Params* p, const std::string& xmlfile ) throw(UException);
00033         ~UConnector();
00034 
00035         inline std::string getUIType()
00036         {
00037             return string("uniset");
00038         }
00039 
00040         std::string getConfFileName();
00041         long getValue( long id, long node )throw(UException);
00042         void setValue( long id, long val, long node, long supplier = UTypes::DefaultSupplerID ) throw(UException);
00043         UTypes::ShortIOInfo getTimeChange( long id, long node = UTypes::DefaultID );
00044 
00045         long getSensorID( const std::string& name );
00046         long getNodeID( const std::string& name );
00047         long getObjectID( const std::string& name );
00048 
00049         std::string getShortName( long id );
00050         std::string getName( long id );
00051         std::string getTextName( long id );
00052 
00053         std::string getObjectInfo( long id, const std::string& params, long node = UTypes::DefaultID ) throw(UException);
00054         std::string apiRequest( long id, const std::string& query, long node = UTypes::DefaultID ) throw(UException);
00055 
00056         void activate_objects() throw(UException);
00057 
00058     private:
00059         std::shared_ptr<uniset::Configuration> conf;
00060         std::shared_ptr<uniset::UInterface> ui;
00061         std::string xmlfile;
00062 };
00063 //---------------------------------------------------------------------------
00064 #endif
00065 //---------------------------------------------------------------------------