HealthDead
};
+/**
+ * enum for identifying plugin types and versions
+ *
+ * All plugins are started in the order defined by their value
+ * in this enum (lowest first, highest last).
+ * The plugins are stopped in opposite order (highest first,
+ * lowest last).
+ */
+typedef enum PluginApi
+{
+ Renderer_Api = 0x00010000,
+ Renderer_Api_v1,
+
+ SceneProvider_Api = 0x00020000,
+ SceneProvider_Api_v1,
+
+ Communicator_Api = 0x00040000,
+ Communicator_Api_v1,
+
+ HealthMonitor_Api = 0x00080000,
+ HealthMonitor_Api_v1
+} ilmPluginApi;
+
+#define PLUGIN_IS_COMMUNICATOR(x) ((x) & Communicator_Api)
+#define PLUGIN_IS_RENDERER(x) ((x) & Renderer_Api)
+#define PLUGIN_IS_SCENEPROVIDER(x) ((x) & SceneProvider_Api)
+#define PLUGIN_IS_HEALTHMONITOR(x) ((x) & HealthMonitor_Api)
+
#endif // _ILM_TYPES_H_
class IPlugin
{
public:
- virtual HealthCondition getHealth() = 0;
+ virtual PluginApi pluginGetApi() const = 0;
+ virtual t_ilm_const_string pluginGetName() const = 0;
+ virtual HealthCondition pluginGetHealth() = 0;
+
+ virtual ~IPlugin() {}
};
#endif // __IPLUGIN_H__
#define __PLUGINBASE_H__
#include "IPlugin.h"
+#include "ilm_types.h"
+
+class ICommandExecutor;
+class Configuration;
class PluginBase : public IPlugin
{
public:
- PluginBase();
- virtual HealthCondition getHealth();
+ PluginBase(ICommandExecutor& executor, Configuration& config, ilmPluginApi api);
+ virtual ~PluginBase();
+
+ // from IPlugin
+ virtual PluginApi pluginGetApi() const;
+ virtual t_ilm_const_string pluginGetName() const;
+ virtual HealthCondition pluginGetHealth();
+
+protected:
+ void pluginSetHealth(HealthCondition health);
protected:
- void setHealth(HealthCondition health);
+ ICommandExecutor& mExecutor;
+ Configuration& mConfiguration;
private:
+ PluginApi mApi;
HealthCondition mHealth;
};
while ((iter != iterEnd) && (HealthRunning == returnValue))
{
IPlugin* monitoredPlugin = *iter;
- returnValue = monitoredPlugin->getHealth();
+ returnValue = monitoredPlugin->pluginGetHealth();
++iter;
}
#include "ICommandExecutor.h"
#include "Scene.h"
-PluginBase::PluginBase()
-: mHealth(HealthStopped)
+PluginBase::PluginBase(ICommandExecutor& executor, Configuration& config, ilmPluginApi api)
+: mExecutor(executor)
+, mConfiguration(config)
+, mApi(api)
+, mHealth(HealthStopped)
{
}
-HealthCondition PluginBase::getHealth()
+PluginBase::~PluginBase()
+{
+}
+
+PluginApi PluginBase::pluginGetApi() const
+{
+ return mApi;
+}
+
+t_ilm_const_string PluginBase::pluginGetName() const
+{
+ return "NoName";
+}
+
+HealthCondition PluginBase::pluginGetHealth()
{
return mHealth;
}
-void PluginBase::setHealth(HealthCondition health)
+void PluginBase::pluginSetHealth(HealthCondition health)
{
mHealth = health;
}