manager: [#25] add Event parser
This commit is contained in:
parent
df04fc9107
commit
a2b07be73b
@ -26,6 +26,12 @@ public:
|
|||||||
SetPoint
|
SetPoint
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef struct _EventPair
|
||||||
|
{
|
||||||
|
EventRawData rd;
|
||||||
|
EventType et;
|
||||||
|
} EventPair;
|
||||||
|
|
||||||
Event(Event::EventType type, EventRawData data)
|
Event(Event::EventType type, EventRawData data)
|
||||||
{
|
{
|
||||||
events.insert({type, data});
|
events.insert({type, data});
|
||||||
|
|||||||
@ -8,10 +8,10 @@
|
|||||||
#include "Manager.h"
|
#include "Manager.h"
|
||||||
#include "ThreadCommon.h"
|
#include "ThreadCommon.h"
|
||||||
|
|
||||||
Manager::Manager(ThreadCommon::QueueManager* qm) : _qm(qm)
|
Manager::Manager(ThreadCommon::QueueManager* qm)
|
||||||
|
: _qm(qm), set_point(0, 100, 5)
|
||||||
{
|
{
|
||||||
// TODO Auto-generated constructor stub
|
set_point.setCurrent(0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Manager::~Manager()
|
Manager::~Manager()
|
||||||
@ -19,12 +19,30 @@ Manager::~Manager()
|
|||||||
// TODO Auto-generated destructor stub
|
// TODO Auto-generated destructor stub
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Event::EventPair Manager::parseEvent(Event* e)
|
||||||
|
{
|
||||||
|
EventRawData raw_data;
|
||||||
|
for(Event::EventType i :
|
||||||
|
{Event::Rotary, Event::InternalTemp,
|
||||||
|
Event::ExternalTemp})
|
||||||
|
{
|
||||||
|
raw_data = e->getDataOf(i);
|
||||||
|
if(raw_data != ERROR_RETURN)
|
||||||
|
{
|
||||||
|
Event::EventPair p = {raw_data, i};
|
||||||
|
return p;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Manager::taskFunction()
|
void Manager::taskFunction()
|
||||||
{
|
{
|
||||||
Event data(Event::Null, 0);
|
Event data(Event::Null, 0);
|
||||||
|
Event::EventPair event_pair = {0, Event::EventType::Null};
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
_qm->receive<Event>(ThreadCommon::QueueManager::manager_event_master, &data, portMAX_DELAY);
|
_qm->receive<Event>(ThreadCommon::QueueManager::manager_event_master, &data, portMAX_DELAY);
|
||||||
|
event_pair= this->parseEvent(&data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -10,6 +10,8 @@
|
|||||||
|
|
||||||
#include "ThreadCommon.h"
|
#include "ThreadCommon.h"
|
||||||
#include "Event.h"
|
#include "Event.h"
|
||||||
|
#include "Counter.h"
|
||||||
|
|
||||||
|
|
||||||
class Manager {
|
class Manager {
|
||||||
public:
|
public:
|
||||||
@ -17,7 +19,13 @@ public:
|
|||||||
virtual ~Manager();
|
virtual ~Manager();
|
||||||
void taskFunction();
|
void taskFunction();
|
||||||
private:
|
private:
|
||||||
|
Event::EventPair parseEvent(Event* e);
|
||||||
ThreadCommon::QueueManager* _qm;
|
ThreadCommon::QueueManager* _qm;
|
||||||
|
Counter<EventRawData> set_point;
|
||||||
|
|
||||||
|
EventRawData int_temp;
|
||||||
|
EventRawData ext_temp;
|
||||||
|
EventRawData rotary_action;
|
||||||
};
|
};
|
||||||
|
|
||||||
void thread_manager(void* pvParams);
|
void thread_manager(void* pvParams);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user