You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
59 lines
1.0 KiB
59 lines
1.0 KiB
#ifndef __CMD_NODE_CONVEYOUR_HEADER__
|
|
#define __CMD_NODE_CONVEYOUR_HEADER__
|
|
|
|
#include "dataBinder.h"
|
|
|
|
#include <map>
|
|
#include <queue>
|
|
#include <vector>
|
|
|
|
typedef struct S_NI_COMMAND
|
|
{
|
|
uint8_t cmd;
|
|
uint32_t db_cmd;
|
|
void * parameter;
|
|
} NI_COMMAND;
|
|
|
|
typedef std::queue<NI_COMMAND *> queueNI_COMMANDS;
|
|
|
|
typedef enum E_NI_COMMAND_STATUSES
|
|
{
|
|
NI_CMD_NEW = 0,
|
|
NI_CMD_STARTED = 1,
|
|
NI_CMD_FINISHED = 100,
|
|
NI_CMD_FAILED = 128
|
|
} NI_COMMAND_STATUSES;
|
|
|
|
class cmdNodeConveyor
|
|
{
|
|
private:
|
|
|
|
queueNI_COMMANDS m_qCommands;
|
|
basicMutex m_mCommandProtector;
|
|
NI_COMMAND * m_pCurrentCMD;
|
|
basicMutex m_mCurrentCMDProtector;
|
|
|
|
protected:
|
|
|
|
NI_COMMAND * fetchCommand();
|
|
|
|
public:
|
|
|
|
cmdNodeConveyor();
|
|
~cmdNodeConveyor();
|
|
void enqueueCommand(NI_COMMAND * ptr);
|
|
|
|
virtual bool updateCommandStatus(NI_COMMAND_STATUSES stt)
|
|
{
|
|
if ( stt ) return true;
|
|
return true;
|
|
}
|
|
|
|
virtual bool updateCommandAccomplishment(uint8_t perc)
|
|
{
|
|
if ( perc ) return true;
|
|
return true;
|
|
}
|
|
};
|
|
|
|
#endif
|