BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
Main Page
Related Pages
Data Structures
Files
File List
src
core
CommandHandler.h
1
#pragma once
2
3
#include <string>
4
5
#include "core/Command.h"
6
#include "core/Result.h"
7
#include "core/Answer.h"
8
9
namespace
BeeeOn {
10
11
class
Answer;
12
13
/*
14
* Interface for handling commands. It contains a method to check
15
* whether the command is supported and the method to execute
16
* such command.
17
*/
18
class
CommandHandler
{
19
public
:
20
CommandHandler
();
21
virtual
~
CommandHandler
();
22
23
/*
24
* Returns true if the given command can be handled by this handler.
25
*/
26
virtual
bool
accept(
const
Command::Ptr cmd) = 0;
27
28
/*
29
* This method is likely to be called concurrently. It must be
30
* implemented in a thread-safe way. It must create the Result
31
* and it must add the Answer.
32
*
33
* For example: Mutex::ScopedLock lock(m_mutex);
34
*/
35
virtual
void
handle(Command::Ptr cmd, Answer::Ptr answer) = 0;
36
};
37
38
}
BeeeOn::CommandHandler
Definition:
CommandHandler.h:18
Generated by
1.8.5