Line |
Branch |
Exec |
Source |
1 |
|
|
/***************************************************************************** |
2 |
|
|
* |
3 |
|
|
* Copyright (C) 2007-2016 Richard Hacker (lerichi at gmx dot net) |
4 |
|
|
* Florian Pose <fp@igh.de> |
5 |
|
|
* |
6 |
|
|
* This file is part of the PdCom library. |
7 |
|
|
* |
8 |
|
|
* The PdCom library is free software: you can redistribute it and/or modify |
9 |
|
|
* it under the terms of the GNU Lesser General Public License as published by |
10 |
|
|
* the Free Software Foundation, either version 3 of the License, or (at your |
11 |
|
|
* option) any later version. |
12 |
|
|
* |
13 |
|
|
* The PdCom library is distributed in the hope that it will be useful, but |
14 |
|
|
* WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY |
15 |
|
|
* or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public |
16 |
|
|
* License for more details. |
17 |
|
|
* |
18 |
|
|
* You should have received a copy of the GNU Lesser General Public License |
19 |
|
|
* along with the PdCom library. If not, see <http://www.gnu.org/licenses/>. |
20 |
|
|
* |
21 |
|
|
*****************************************************************************/ |
22 |
|
|
|
23 |
|
|
#ifndef PDCOM_PROTOCOLHANDLER_H |
24 |
|
|
#define PDCOM_PROTOCOLHANDLER_H |
25 |
|
|
|
26 |
|
|
#include <memory> |
27 |
|
|
#include <pdcom5/Process.h> |
28 |
|
|
#include <pdcom5/Subscription.h> |
29 |
|
|
#include <stddef.h> |
30 |
|
|
#include <stdint.h> |
31 |
|
|
#include <string> |
32 |
|
|
|
33 |
|
|
namespace PdCom { |
34 |
|
|
class Subscriber; |
35 |
|
|
template <class Exception, class... Result> |
36 |
|
|
class Promise; |
37 |
|
|
class Variable; |
38 |
|
|
|
39 |
|
|
namespace impl { |
40 |
|
|
class Process; |
41 |
|
|
class Variable; |
42 |
|
|
|
43 |
|
|
class ProtocolHandler |
44 |
|
|
{ |
45 |
|
|
public: |
46 |
|
|
using VariablePollPromise = PdCom::Promise< |
47 |
|
|
PdCom::Exception const &, |
48 |
|
|
PdCom::VariablePollResult, |
49 |
|
|
std::chrono::nanoseconds>; |
50 |
|
|
|
51 |
|
|
|
52 |
|
67 |
ProtocolHandler(PdCom::impl::Process *process) : process(process) {} |
53 |
|
67 |
virtual ~ProtocolHandler() = default; |
54 |
|
|
|
55 |
|
|
virtual bool asyncData() = 0; |
56 |
|
|
virtual bool find(const std::string &path) = 0; |
57 |
|
|
virtual bool list(const std::string &path) = 0; |
58 |
|
|
virtual void getClientStatistics() = 0; |
59 |
|
|
virtual bool login(const char *mech, const char *clientData) = 0; |
60 |
|
|
virtual void logout() = 0; |
61 |
|
|
|
62 |
|
|
virtual void |
63 |
|
|
pollVariable(const Variable &var, VariablePollPromise &&promise) = 0; |
64 |
|
|
|
65 |
|
|
virtual std::shared_ptr<Subscription> subscribe( |
66 |
|
|
PdCom::Subscription *subscription, |
67 |
|
|
const std::string &path, |
68 |
|
|
PdCom::Subscriber &subscriber, |
69 |
|
|
const PdCom::Selector &selector) = 0; |
70 |
|
|
virtual std::shared_ptr<Subscription> subscribe( |
71 |
|
|
PdCom::Subscription *subscription, |
72 |
|
|
std::shared_ptr<const Variable> var, |
73 |
|
|
PdCom::Subscriber &subscriber, |
74 |
|
|
const PdCom::Selector &selector) = 0; |
75 |
|
|
virtual void cancelSubscriptions() = 0; |
76 |
|
|
virtual void ping() = 0; |
77 |
|
|
virtual std::string name() const = 0; |
78 |
|
|
virtual std::string version() const = 0; |
79 |
|
|
|
80 |
|
|
virtual std::vector<PdCom::Process::SubscriptionInfo> |
81 |
|
|
getActiveSubscriptions() const = 0; |
82 |
|
|
|
83 |
|
|
virtual void |
84 |
|
|
broadcast(const std::string &message, const std::string &attr) = 0; |
85 |
|
|
|
86 |
|
|
virtual void getMessage(uint32_t seqNo) = 0; |
87 |
|
|
virtual void getActiveMessages() = 0; |
88 |
|
|
|
89 |
|
|
PdCom::impl::Process *const process; |
90 |
|
|
}; |
91 |
|
|
} // namespace impl |
92 |
|
|
} // namespace PdCom |
93 |
|
|
#endif // PDCOM_PROTOCOLHANDLER_H |
94 |
|
|
|