UniSet  2.6.0
PassiveObject.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 // --------------------------------------------------------------------------
00020 // -------------------------------------------------------------------------
00021 #ifndef PassiveObject_H_
00022 #define PassiveObject_H_
00023 // -------------------------------------------------------------------------
00024 
00025 #include <string>
00026 #include "UniSetTypes.h"
00027 #include "MessageType.h"
00028 #include "ProxyManager.h"
00029 // -------------------------------------------------------------------------
00030 namespace uniset
00031 {
00032 
00038 class PassiveObject
00039 {
00040     public:
00041         PassiveObject();
00042         PassiveObject( uniset::ObjectId id );
00043         PassiveObject( uniset::ObjectId id, ProxyManager* mngr );
00044         virtual ~PassiveObject();
00045 
00046         virtual void processingMessage( const uniset::VoidMessage* msg );
00047 
00048         void setID( uniset::ObjectId id );
00049         void init(ProxyManager* mngr);
00050 
00051         inline uniset::ObjectId getId() const
00052         {
00053             return id;
00054         }
00055         inline std::string getName() const
00056         {
00057             return myname;
00058         }
00059 
00060     protected:
00061         virtual void sysCommand( const uniset::SystemMessage* sm );
00062         virtual void askSensors( UniversalIO::UIOCommand cmd ) {}
00063         virtual void timerInfo( const uniset::TimerMessage* tm ) {}
00064         virtual void sensorInfo( const uniset::SensorMessage* sm ) {}
00065 
00066         std::string myname = { "" };
00067         ProxyManager* mngr = { nullptr };
00068 
00069     private:
00070         uniset::ObjectId id = { uniset::DefaultObjectId };
00071 };
00072 // -------------------------------------------------------------------------
00073 } // end of uniset namespace
00074 // -------------------------------------------------------------------------
00075 #endif // PassiveObject_H_
00076 // -------------------------------------------------------------------------