/src/opendnp3/cpp/lib/src/master/UserPollTask.cpp
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 | | #include "UserPollTask.h" |
21 | | |
22 | | #include <utility> |
23 | | |
24 | | namespace opendnp3 |
25 | | { |
26 | | |
27 | | UserPollTask::UserPollTask(const std::shared_ptr<TaskContext>& context, |
28 | | HeaderBuilderT builder, |
29 | | const TaskBehavior& behavior, |
30 | | bool recurring, |
31 | | IMasterApplication& app, |
32 | | std::shared_ptr<ISOEHandler> soeHandler, |
33 | | const Logger& logger, |
34 | | TaskConfig config) |
35 | 0 | : PollTaskBase(context, app, std::move(soeHandler), behavior, logger, config), |
36 | 0 | builder(std::move(builder)), |
37 | 0 | recurring(recurring) |
38 | 0 | { |
39 | 0 | } |
40 | | |
41 | | bool UserPollTask::BuildRequest(APDURequest& request, uint8_t seq) |
42 | 0 | { |
43 | 0 | this->rxCount = 0; |
44 | 0 | request.SetFunction(FunctionCode::READ); |
45 | 0 | request.SetControl(AppControlField::Request(seq)); |
46 | 0 | auto writer = request.GetWriter(); |
47 | 0 | return builder(writer); |
48 | 0 | } |
49 | | |
50 | | } // namespace opendnp3 |