UniSet  2.6.0
UConnector.h
1 /*
2  * Copyright (c) 2015 Pavel Vainerman.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 2.1.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Lesser Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 // -------------------------------------------------------------------------
17 #ifndef UConnector_H_
18 #define UConnector_H_
19 // --------------------------------------------------------------------------
20 #include <memory>
21 #include <string>
22 #include "Configuration.h"
23 #include "UInterface.h"
24 #include "UTypes.h"
25 #include "UExceptions.h"
26 #include "UniSetActivator.h"
27 // --------------------------------------------------------------------------
29 {
30  public:
31  UConnector( int argc, char** argv, const std::string& xmlfile ) throw(UException);
32  UConnector( UTypes::Params* p, const std::string& xmlfile ) throw(UException);
33  ~UConnector();
34 
35  inline std::string getUIType()
36  {
37  return string("uniset");
38  }
39 
40  std::string getConfFileName();
41  long getValue( long id, long node )throw(UException);
42  void setValue( long id, long val, long node, long supplier = UTypes::DefaultSupplerID ) throw(UException);
43  UTypes::ShortIOInfo getTimeChange( long id, long node = UTypes::DefaultID );
44 
45  long getSensorID( const std::string& name );
46  long getNodeID( const std::string& name );
47  long getObjectID( const std::string& name );
48 
49  std::string getShortName( long id );
50  std::string getName( long id );
51  std::string getTextName( long id );
52 
53  std::string getObjectInfo( long id, const std::string& params, long node = UTypes::DefaultID ) throw(UException);
54  std::string apiRequest( long id, const std::string& query, long node = UTypes::DefaultID ) throw(UException);
55 
56  void activate_objects() throw(UException);
57 
58  private:
59  std::shared_ptr<uniset::Configuration> conf;
60  std::shared_ptr<uniset::UInterface> ui;
61  std::string xmlfile;
62 };
63 //---------------------------------------------------------------------------
64 #endif
65 //---------------------------------------------------------------------------