|
solarpowerlog trunk
|
00001 /* 00002 * CConnectSlave.h 00003 * 00004 * This is the slave object for the Shared Communication.Please see the 00005 * CSharedConnection class for documentation... 00006 * 00007 * (In few words, this will will proxy requests over to amaster object 00008 * which then will do the comms) 00009 * 00010 * Created on: Sep 13, 2010 00011 * Author: coldtobi 00012 */ 00013 00014 #ifndef CCONNECTSLAVE_H_ 00015 #define CCONNECTSLAVE_H_ 00016 00017 #ifdef HAVE_CONFIG_H 00018 #include "config.h" 00019 #include "porting.h" 00020 #endif 00021 00022 #ifdef HAVE_COMMS_SHAREDCONNECTION 00023 00024 #include "interfaces/IConnect.h" 00025 #include "CSharedConnectionMaster.h" 00026 00027 class CSharedConnectionSlave: public IConnect 00028 { 00029 protected: 00030 friend class CSharedConnection; 00031 CSharedConnectionSlave(const string & configurationname); 00032 public: 00033 virtual ~CSharedConnectionSlave(); 00034 00035 protected: 00036 00037 virtual bool Connect(ICommand *callback); 00038 00039 virtual bool Disconnect(ICommand *callback); 00040 00041 virtual bool Send(const char *tosend, unsigned int len, ICommand *callback = 00042 NULL); 00043 00044 virtual bool Send(const string& tosend, ICommand *callback = NULL); 00045 00046 virtual bool Receive(ICommand *callback); 00047 00048 virtual bool CheckConfig(void); 00049 00050 virtual bool IsConnected(void); 00051 00052 private: 00053 class CSharedConnection *master; 00054 00055 }; 00056 00057 #endif 00058 00059 #endif /* CCONNECTSLAVE_H_ */