diff --git a/reactos/tools/sysreg/sysreg.rbuild b/reactos/tools/sysreg/sysreg.rbuild index 784ed0ac63b..0958973d0f0 100644 --- a/reactos/tools/sysreg/sysreg.rbuild +++ b/reactos/tools/sysreg/sysreg.rbuild @@ -21,4 +21,5 @@ sysreg.cpp file_reader.cpp os_support.cpp + timer_command_callback.cpp diff --git a/reactos/tools/sysreg/timer_callback.h b/reactos/tools/sysreg/timer_callback.h new file mode 100644 index 00000000000..a786fe1f9a0 --- /dev/null +++ b/reactos/tools/sysreg/timer_callback.h @@ -0,0 +1,56 @@ +#ifndef TIMER_CALLBACK_H__ +#define TIMER_CALLBACK_H__ + + +namespace System_ +{ +//--------------------------------------------------------------------------------------- +/// +/// TimerCallback +/// +/// Description: base class for all timer callback functions + + class TimerCallback + { + public: +//--------------------------------------------------------------------------------------- +/// +/// TimerCallback +/// +/// Description: constructor of class TimerCallback + + TimerCallback() {} + +//--------------------------------------------------------------------------------------- +/// +/// TimerCallback +/// +/// Description: destructor of class TimerCallback + + virtual ~TimerCallback() {} + + +//--------------------------------------------------------------------------------------- +/// +/// initialize +/// +/// Description: this function is called when the timercallback object is initialized in +/// in the callback mechanism + + virtual bool initialize(){ return true;} + + +//--------------------------------------------------------------------------------------- +/// +/// hasExpired +/// +/// Description: this function is called everytime timer event has started. The callback object +/// should return true if the expiration function has expired. +/// Note: the function should then also cleanup all consumed resourced + + virtual bool hasExpired() = 0; + }; //end of class TimerCallback + +}// end of namespace System_ + +#endif diff --git a/reactos/tools/sysreg/timer_command_callback.cpp b/reactos/tools/sysreg/timer_command_callback.cpp new file mode 100644 index 00000000000..f83fb98cd56 --- /dev/null +++ b/reactos/tools/sysreg/timer_command_callback.cpp @@ -0,0 +1,41 @@ +#include "timer_command_callback.h" + + +namespace System_ +{ + using Sysreg_::ConfigParser; + + string TimerCommandCallback::ROS_TIMER_COMMAND="ROS_TIMER_COMMAND"; + string TimerCommandCallback::ROS_TIMER_TIMEOUT="ROS_TIMER_TIMEOUT"; + +//--------------------------------------------------------------- + TimerCommandCallback::TimerCommandCallback(ConfigParser &conf_parser) : TimerCallback(), m_parser(conf_parser), m_Cmd(""), m_Timeout(0) + { + } +//--------------------------------------------------------------- + TimerCommandCallback::~TimerCommandCallback() + { + } +//--------------------------------------------------------------- + bool TimerCommandCallback::initialize() + { + m_parser.getStringValue(ROS_TIMER_COMMAND, m_Cmd); + m_parser.getIntValue(ROS_TIMER_TIMEOUT, m_Timeout); + //FIXME + // calculate current time + + return true; + } + +//--------------------------------------------------------------- + bool TimerCommandCallback::hasExpired() + { + + // FIXME + // calculate current time + // calculate difference + // and invoke m_Cmd when it has expired + return false; + } + +} // end of namespace System_ diff --git a/reactos/tools/sysreg/timer_command_callback.h b/reactos/tools/sysreg/timer_command_callback.h new file mode 100644 index 00000000000..79beabe83ff --- /dev/null +++ b/reactos/tools/sysreg/timer_command_callback.h @@ -0,0 +1,57 @@ +#ifndef TIMER_COMMAND_CALLBACK_H__ //timer_command_callback.h +#define TIMER_COMMAND_CALLBACK_H__ + +#include "conf_parser.h" +#include "timer_callback.h" + +namespace System_ +{ + + class TimerCommandCallback : public TimerCallback + { + public: +//--------------------------------------------------------------- +/// +/// TimerCommandCallback +/// +/// Description: constructor of class TimerCommandCallback +/// +/// @param conf_parser contains configuration data + + TimerCommandCallback(Sysreg_::ConfigParser &conf_parser); + +//--------------------------------------------------------------- +/// +/// ~TimerCommandCallback +/// +/// Description: destructor of class TimerCommandCallback + + virtual ~TimerCommandCallback(); + +//--------------------------------------------------------------- +/// +/// initialize +/// +/// Description: initializes the callback object + + virtual bool initialize(); + +//--------------------------------------------------------------- +/// +/// hasExpired +/// +/// Description: returns true when the callback object has expired + + virtual bool hasExpired(); + protected: + Sysreg_::ConfigParser & m_parser; + string m_Cmd; + long int m_Timeout; + static string ROS_TIMER_TIMEOUT; + static string ROS_TIMER_COMMAND; + }; + +} /* EOF namspace System_ */ + + +#endif /* EOF TIMER_COMMAND_CALLBACK_H__ */