/src/opendnp3/cpp/lib/src/master/PollTaskBase.h
Line | Count | Source |
1 | | /* |
2 | | * Copyright 2013-2022 Step Function I/O, LLC |
3 | | * |
4 | | * Licensed to Green Energy Corp (www.greenenergycorp.com) and Step Function I/O |
5 | | * LLC (https://stepfunc.io) under one or more contributor license agreements. |
6 | | * See the NOTICE file distributed with this work for additional information |
7 | | * regarding copyright ownership. Green Energy Corp and Step Function I/O LLC license |
8 | | * this file to you under the Apache License, Version 2.0 (the "License"); you |
9 | | * may not use this file except in compliance with the License. You may obtain |
10 | | * a copy of the License at: |
11 | | * |
12 | | * http://www.apache.org/licenses/LICENSE-2.0 |
13 | | * |
14 | | * Unless required by applicable law or agreed to in writing, software |
15 | | * distributed under the License is distributed on an "AS IS" BASIS, |
16 | | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
17 | | * See the License for the specific language governing permissions and |
18 | | * limitations under the License. |
19 | | */ |
20 | | #ifndef OPENDNP3_POLLTASKBASE_H |
21 | | #define OPENDNP3_POLLTASKBASE_H |
22 | | |
23 | | #include "master/IMasterTask.h" |
24 | | |
25 | | #include <memory> |
26 | | #include <string> |
27 | | |
28 | | namespace opendnp3 |
29 | | { |
30 | | |
31 | | class ISOEHandler; |
32 | | |
33 | | /** |
34 | | * Base class for measurement polls |
35 | | */ |
36 | | class PollTaskBase : public IMasterTask |
37 | | { |
38 | | |
39 | | public: |
40 | | PollTaskBase(const std::shared_ptr<TaskContext>& context, |
41 | | IMasterApplication& application, |
42 | | std::shared_ptr<ISOEHandler> handler, |
43 | | const TaskBehavior& behavior, |
44 | | const Logger& logger, |
45 | | TaskConfig config); |
46 | | |
47 | | virtual const char* Name() const override |
48 | 0 | { |
49 | 0 | return "Application Poll"; |
50 | 0 | }; |
51 | | |
52 | | protected: |
53 | | virtual ResponseResult ProcessResponse(const APDUResponseHeader& header, |
54 | | const ser4cpp::rseq_t& objects) override final; |
55 | | |
56 | | ResponseResult ProcessMeasurements(const APDUResponseHeader& header, const ser4cpp::rseq_t& objects); |
57 | | |
58 | | virtual void Initialize() override final; |
59 | | |
60 | | uint32_t rxCount = 0; |
61 | | std::shared_ptr<ISOEHandler> handler; |
62 | | }; |
63 | | |
64 | | } // namespace opendnp3 |
65 | | |
66 | | #endif |